]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'es/walken-tutorial-fix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 18:46:23 +0000 (11:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Sep 2021 18:46:23 +0000 (11:46 -0700)
Typofix.

* es/walken-tutorial-fix:
  doc: fix syntax error and the format of printf

1  2 
Documentation/MyFirstObjectWalk.txt

index 2d10eea7a9f65f23f766dc3b730495018e8f1234,9cc9f7804baed14f5e20474de70f56732b5fcff3..45eb84d8b489e4f1859fb7f2301ceff05953029a
@@@ -17,7 -17,7 +17,7 @@@ revision walk is used for operations li
  
  - `Documentation/user-manual.txt` under "Hacking Git" contains some coverage of
    the revision walker in its various incarnations.
 -- `Documentation/technical/api-revision-walking.txt`
 +- `revision.h`
  - https://eagain.net/articles/git-for-computer-scientists/[Git for Computer Scientists]
    gives a good overview of the types of objects in Git and what your object
    walk is really describing.
@@@ -119,8 -119,9 +119,8 @@@ 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
 -`Documentation/technical/api-allocation-growing.txt` - this variable is used to
 -track the allocated size of the list.
 +`alloc` is used by the `ALLOC_GROW` macro. Check `cache.h` - this variable is
 +used to track the allocated size of the list.
  
  Per entry, we find:
  
@@@ -182,6 -183,30 +182,6 @@@ its `init_log_defaults()` sets its own 
  `grep` and `diff` to initialize themselves by calling each of their
  initialization functions.
  
 -For our first example within `git walken`, we don't intend to use any other
 -components within Git, and we don't have any configuration to do.  However, we
 -may want to add some later, so for now, we can add an empty placeholder. Create
 -a new function in `builtin/walken.c`:
 -
 -----
 -static void init_walken_defaults(void)
 -{
 -      /*
 -       * We don't actually need the same components `git log` does; leave this
 -       * empty for now.
 -       */
 -}
 -----
 -
 -Make sure to add a line invoking it inside of `cmd_walken()`.
 -
 -----
 -int cmd_walken(int argc, const char **argv, const char *prefix)
 -{
 -      init_walken_defaults();
 -}
 -----
 -
  ==== Configuring From `.gitconfig`
  
  Next, we should have a look at any relevant configuration settings (i.e.,
@@@ -333,6 -358,9 +333,6 @@@ static void walken_commit_walk(struct r
        ...
  
        while ((commit = get_revision(rev))) {
 -              if (!commit)
 -                      continue;
 -
                strbuf_reset(&prettybuf);
                pp_commit_easy(CMIT_FMT_ONELINE, commit, &prettybuf);
                puts(prettybuf.buf);
@@@ -364,9 -392,17 +364,9 @@@ Next, let's try to filter the commits w
  equivalent to running `git log --author=<pattern>`. We can add a filter by
  modifying `rev_info.grep_filter`, which is a `struct grep_opt`.
  
 -First some setup. Add `init_grep_defaults()` to `init_walken_defaults()` and add
 -`grep_config()` to `git_walken_config()`:
 +First some setup. Add `grep_config()` to `git_walken_config()`:
  
  ----
 -static void init_walken_defaults(void)
 -{
 -      init_grep_defaults(the_repository);
 -}
 -
 -...
 -
  static int git_walken_config(const char *var, const char *value, void *cb)
  {
        grep_config(var, value, cb);
@@@ -691,7 -727,7 +691,7 @@@ help understand. In our case, that mean
  referenced by `HEAD` or `HEAD`'s history, because we begin the walk with only
  `HEAD` in the `pending` list.)
  
- First, we'll need to `#include "list-objects-filter-options.h`" and set up the
+ First, we'll need to `#include "list-objects-filter-options.h"` and set up the
  `struct list_objects_filter_options` at the top of the function.
  
  ----
@@@ -779,7 -815,7 +779,7 @@@ Count all the objects within and modif
        while ((oid = oidset_iter_next(&oit)))
                omitted_count++;
  
-       printf("commits %d\nblobs %d\ntags %d\ntrees%d\nomitted %d\n",
+       printf("commits %d\nblobs %d\ntags %d\ntrees %d\nomitted %d\n",
                commit_count, blob_count, tag_count, tree_count, omitted_count);
  ----