]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'vd/adjust-mfow-doc-to-updated-headers'
authorJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2023 18:30:42 +0000 (11:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jul 2023 18:30:42 +0000 (11:30 -0700)
Code snippets in a tutorial document no longer compiled after
recent header shuffling, which have been corrected.

* vd/adjust-mfow-doc-to-updated-headers:
  docs: add necessary headers to Documentation/MFOW.txt

1  2 
Documentation/MyFirstObjectWalk.txt

index 200e628e301284bf0afca715660bfd8ec98e268d,6f606fb07313ddb21bf2a405b15a39b44f667871..c68cdb11b9d5a53ddc11361d0f1c889edeb24536
@@@ -41,6 -41,7 +41,7 @@@ Open up a new file `builtin/walken.c` a
   */
  
  #include "builtin.h"
+ #include "trace.h"
  
  int cmd_walken(int argc, const char **argv, const char *prefix)
  {
  }
  ----
  
- NOTE: `trace_printf()` differs from `printf()` in that it can be turned on or
- off at runtime. For the purposes of this tutorial, we will write `walken` as
- though it is intended for use as a "plumbing" command: that is, a command which
- is used primarily in scripts, rather than interactively by humans (a "porcelain"
- command). So we will send our debug output to `trace_printf()` instead. When
- running, enable trace output by setting the environment variable `GIT_TRACE`.
+ NOTE: `trace_printf()`, defined in `trace.h`, differs from `printf()` in
+ that it can be turned on or off at runtime. For the purposes of this
+ tutorial, we will write `walken` as though it is intended for use as
+ a "plumbing" command: that is, a command which is used primarily in
+ scripts, rather than interactively by humans (a "porcelain" command).
+ So we will send our debug output to `trace_printf()` instead.
+ When running, enable trace output by setting the environment variable `GIT_TRACE`.
  
  Add usage text and `-h` handling, like all subcommands should consistently do
  (our test suite will notice and complain if you fail to do so).
@@@ -124,7 -126,7 +126,7 @@@ parameters provided by the user over th
  
  `nr` represents the number of `rev_cmdline_entry` present in the array.
  
 -`alloc` is used by the `ALLOC_GROW` macro. Check `cache.h` - this variable is
 +`alloc` is used by the `ALLOC_GROW` macro. Check `alloc.h` - this variable is
  used to track the allocated size of the list.
  
  Per entry, we find:
@@@ -341,6 -343,10 +343,10 @@@ the walk loop below the `prepare_revisi
  `walken_commit_walk()`:
  
  ----
+ #include "pretty.h"
+ ...
  static void walken_commit_walk(struct rev_info *rev)
  {
        struct commit *commit;
@@@ -754,6 -760,10 +760,10 @@@ reachable objects are walked in order t
  First, add the `struct oidset` and related items we will use to iterate it:
  
  ----
+ #include "oidset.h"
+ ...
  static void walken_object_walk(
        ...
  
@@@ -805,6 -815,10 +815,10 @@@ just walks of commits. First, we'll mak
  go:
  
  ----
+ #include "hex.h"
+ ...
  static void walken_show_commit(struct commit *cmt, void *buf)
  {
        trace_printf("commit: %s\n", oid_to_hex(&cmt->object.oid));