git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 00/18] tree-walk.h: slimmed down

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Mar 31, 2021, 19:09 UTC
Message-ID
<cover-00.19-00000000000-20210331T190531Z-avarab@gmail.com>
In-Reply-To
<87o8fcqrg8.fsf@evledraar.gmail.com>

These are preparatory changes to the tree-walk.h API to eventually fix long-broken git-fsck mode checks.

Per http://lore.kernel.org/git/xmqqtup5cnlu.fsf@gitster.g I think the previous round of this was too big.

So here's a slimmed-down version which stops short of migrating anything to "enum object_type". There's just:

 * Tests
 * Renaming relevant API *() to *_mode() (the next series will propose a *_type())
 * Adding *_path() API for those users that don't need the "mode" the
   *_mode() function provides
 * Comment updates, fixes to comments.
 * Whitespace changes that would be needed by the next series, but
   which are a good idea anyway while we're at it, e.g. aligning
   function declarations.
Ævar Arnfjörð Bjarmason (18):
  cache.h: add a comment to object_type()
  merge-ort: correct reference to test in 62fdec17a11
  cache.h: have base_name_compare() take "is tree?", not "mode"
  fast-import tests: test for sorting dir/file foo v.s. foo.txt
  mktree tests: test that "mode" is passed when sorting
  diff tests: test that "mode" is passed when sorting
  merge-tree tests: test for the mode comparison in same_entry()
  blame: emit a better error on 'git blame directory'
  notes & match-trees: use name_entry's "pathlen" member
  tree-walk.h users: use temporary variable(s) for "mode"
  match-trees: use "tmp" for mode in shift_tree_by()
  tree.h: format argument lists of read_tree() users
  tree-walk.h API: formatting changes for subsequent commit
  tree-walk.h API doc: improve documentation of get_tree_entry()
  tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()
  tree-walk.h API: add a get_tree_entry_path() function
  tree-walk.h API: document and format tree_entry_extract()
  tree-entry.h API: rename tree_entry_extract() to
    tree_entry_extract_mode()
 archive.c                       | 21 ++++----
 blame.c                         |  6 +--
 builtin/checkout.c              |  4 +-
 builtin/fast-import.c           | 12 +++--
 builtin/log.c                   |  5 +-
 builtin/ls-tree.c               |  4 +-
 builtin/merge-tree.c            | 12 +++--
 builtin/mktree.c                |  4 +-
 builtin/rm.c                    |  2 +-
 builtin/update-index.c          |  2 +-
 cache.h                         | 11 +++--
 combine-diff.c                  |  8 +--
 fsck.c                          |  2 +-
 line-log.c                      |  2 +-
 match-trees.c                   | 44 ++++++++---------
 merge-ort.c                     | 11 +++--
 merge-recursive.c               | 29 ++++++-----
 notes.c                         | 10 ++--
 object-name.c                   |  7 ++-
 read-cache.c                    | 16 +++---
 t/t1450-fsck.sh                 | 66 +++++++++++++++++++++++++
 t/t4300-merge-tree.sh           | 44 +++++++++++++++++
 t/t8004-blame-with-conflicts.sh | 21 ++++++++
 t/t9300-fast-import.sh          | 87 +++++++++++++++++++++++++++++++++
 tree-diff.c                     | 24 +++++----
 tree-walk.c                     | 30 ++++++++----
 tree-walk.h                     | 35 +++++++++----
 tree.h                          |  5 +-
 unpack-trees.c                  | 18 ++++---
 29 files changed, 410 insertions(+), 132 deletions(-)
Range-diff:
 1:  c307eb53331 <  -:  ----------- show tests: add test for "git show <tree>"
 2:  f37d7705cf0 <  -:  ----------- ls-files tests: add meaningful --with-tree tests
 3:  6291d8a1b5e <  -:  ----------- tree.c API: move read_tree() into builtin/ls-files.c
 4:  466b518e915 <  -:  ----------- ls-files: don't needlessly pass around stage variable
 5:  30c3abfe9b9 <  -:  ----------- ls-files: refactor away read_tree()
 6:  02c42be9249 <  -:  ----------- archive: stop passing "stage" through read_tree_recursive()
 7:  d55e8d4042b <  -:  ----------- tree.h API: expose read_tree_1() as read_tree_at()
 8:  fa157d8baee <  -:  ----------- tree.h API: simplify read_tree_recursive() signature
10:  186f7a7a44b =  1:  a74e02ff0ba cache.h: add a comment to object_type()
24:  092472f3c8d =  2:  57092359bbb merge-ort: correct reference to test in 62fdec17a11
16:  1b6a10f814c !  3:  44c3fdd0085 cache.h: have base_name_compare() take "is tree?", not "mode"
    @@ Commit message
         function to take a boolean argument indicating whether the entry is a
         tree or not, instead of having them call S_ISDIR(mode) on their own.
     
    -    This makes use of the new "object_type" field in the "name_entry".
    +    This introduces no functional change, but makes later (not part of
    +    this series) changes to abstract away "object_type" from "mode" more
    +    readable.
     
         The API being modified here was originally added way back in
         958ba6c96eb (Introduce "base_name_compare()" helper function,
    @@ match-trees.c: static void *fill_tree_desc_strict(struct tree_desc *desc,
      {
     -	return base_name_compare(a->path, tree_entry_len(a), a->mode,
     -				 b->path, tree_entry_len(b), b->mode);
    -+	int istree_a = (a->object_type == OBJ_TREE);
    -+	int istree_b = (b->object_type == OBJ_TREE);
    ++	int istree_a = S_ISDIR(a->mode);
    ++	int istree_b = S_ISDIR(b->mode);
     +	return base_name_compare(a->path, tree_entry_len(a), istree_a,
     +				 b->path, tree_entry_len(b), istree_b);
      }
    @@ tree-diff.c: static int tree_entry_pathcmp(struct tree_desc *t1, struct tree_des
      		return -1;
      
      	e1 = &t1->entry;
    -+	istree_e1 = (e1->object_type == OBJ_TREE);
    ++	istree_e1 = S_ISDIR(e1->mode);
      	e2 = &t2->entry;
     -	cmp = base_name_compare(e1->path, tree_entry_len(e1), e1->mode,
     -				e2->path, tree_entry_len(e2), e2->mode);
    -+	istree_e2 = (e2->object_type == OBJ_TREE);
    ++	istree_e2 = S_ISDIR(e2->mode);
     +	cmp = base_name_compare(e1->path, tree_entry_len(e1), istree_e1,
     +				e2->path, tree_entry_len(e2), istree_e2);
      	return cmp;
    @@ unpack-trees.c: static int do_compare_entry(const struct cache_entry *ce,
      static int compare_entry(const struct cache_entry *ce, const struct traverse_info *info, const struct name_entry *n)
      {
     -	int cmp = do_compare_entry(ce, info, n->path, n->pathlen, n->mode);
    -+	int istree = (n->object_type == OBJ_TREE);
    ++	int istree = S_ISDIR(n->mode);
     +	int cmp = do_compare_entry(ce, info, n->path, n->pathlen, istree);
      	if (cmp)
      		return cmp;
13:  7016008554a =  4:  2ff35f410cd fast-import tests: test for sorting dir/file foo v.s. foo.txt
14:  b0546197b1b =  5:  b3289f7bbe5 mktree tests: test that "mode" is passed when sorting
15:  73e92ac187d =  6:  0be013e47c4 diff tests: test that "mode" is passed when sorting
23:  592fecb7abc !  7:  3367850559b merge-tree tests: test for the mode comparison in same_entry()
    @@ Commit message
         but as seen here it's important that we don't think a path with the
         same content but different modes is the same_entry().
     
    -    The rest of this series will touch code that's relevant to this, but
    -    won't change its behavior. This test is just something I came up with
    -    in testing whether the mode test in same_entry() was needed at all.
    -
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## t/t4300-merge-tree.sh ##
36:  81da5490221 !  8:  3c2ca98716d blame: emit a better error on 'git blame directory'
    @@ Commit message
         something uniquely bad when in a conflicted merge. See
         cd8ae20195 (git-blame shouldn't crash if run in an unmerged tree,
         2007-10-18) and 9aeaab6811 (blame: allow "blame file" in the middle of
    -    a conflicted merge, 2012-09-11) for the bug the t8004 test was
    -    originally meant to address.
    +    a conflicted merge, 2012-09-11) for the bug the test was originally
    +    meant to address.
     
         But when extending it let's grep out the specific error message for
         good measure. Having to change it in the future (e.g. as part of my
    @@ Commit message
     
      ## blame.c ##
     @@ blame.c: static void verify_working_tree_path(struct repository *r,
    + 		struct object_id blob_oid;
    + 		unsigned short mode;
      
    - 	for (parents = work_tree->parents; parents; parents = parents->next) {
    - 		const struct object_id *commit_oid = &parents->item->object.oid;
    --		struct object_id blob_oid;
    --		unsigned short mode;
    --		int ret = get_tree_entry_mode(r, commit_oid, path, &blob_oid,
    --					      &mode);
    --
    --		if (!ret && oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
    -+		struct object_id oid;
    -+		if (!get_tree_entry_path(r, commit_oid, path, &oid))
    +-		if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode) &&
    +-		    oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
    ++		if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode))
      			return;
      	}
      
 9:  0390b1e9ded =  9:  749be26bf8e notes & match-trees: use name_entry's "pathlen" member
11:  4fed508f3cb <  -:  ----------- tree-walk.h: add object_type member to name_entry
12:  c557b67231b <  -:  ----------- tree-walk.c: migrate to using new "object_type" field when possible
17:  f8912a409b5 <  -:  ----------- tree-walk.h users: switch object_type(...) to new .object_type
26:  4babecb7855 ! 10:  5c0a49c188f tree-walk.h users: use temporary variable(s) for "mode"
    @@ Commit message
         In preparation for an eventual rename of the "mode" field, add
         temporary variable(s) in those places where it's used more than once.
     
    -    This will make a subsequent commits easier to read., since we're only
    +    This will make those later commits easier to read, since we're only
         going to need to modify the line on which the assignment happens.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    @@ builtin/merge-tree.c: static struct merge_list *link_entry(unsigned stage, const
      	struct merge_list *link;
     +	unsigned int link_mode;
      
    - 	if (n->object_type == OBJ_NONE)
    + 	if (!n->mode)
      		return entry;
     @@ builtin/merge-tree.c: static struct merge_list *link_entry(unsigned stage, const struct traverse_info
      		path = entry->path;
29:  40f37e99cd9 ! 11:  e190ed39754 match-trees: use "tmp" for mode in shift_tree_by()
    @@ match-trees.c: void shift_tree_by(struct repository *r,
      	unsigned candidate = 0;
      
      	/* Can hash2 be a tree at shift_prefix in tree hash1? */
    --	if (!get_tree_entry_mode(r, hash1, shift_prefix, &sub1, &mode1) &&
    +-	if (!get_tree_entry(r, hash1, shift_prefix, &sub1, &mode1) &&
     -	    S_ISDIR(mode1))
    -+	if (!get_tree_entry_mode(r, hash1, shift_prefix, &sub1, &tmp) &&
    ++	if (!get_tree_entry(r, hash1, shift_prefix, &sub1, &tmp) &&
     +	    S_ISDIR(tmp))
      		candidate |= 1;
      
      	/* Can hash1 be a tree at shift_prefix in tree hash2? */
    --	if (!get_tree_entry_mode(r, hash2, shift_prefix, &sub2, &mode2) &&
    +-	if (!get_tree_entry(r, hash2, shift_prefix, &sub2, &mode2) &&
     -	    S_ISDIR(mode2))
    -+	if (!get_tree_entry_mode(r, hash2, shift_prefix, &sub2, &tmp) &&
    ++	if (!get_tree_entry(r, hash2, shift_prefix, &sub2, &tmp) &&
     +	    S_ISDIR(tmp))
      		candidate |= 2;
      
18:  df43f1a76ac ! 12:  960e15bc7d5 tree.h: format argument lists of read_tree_recursive() users
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    tree.h: format argument lists of read_tree_recursive() users
    +    tree.h: format argument lists of read_tree() users
     
    -    In preparation for adding a new argument to read_tree_fn_t re-indent
    -    and format the argument list of read_tree_recursive() callbacks, and
    +    Re-indent and format the argument list of read_tree() callbacks, and
         the relevant functions they call.
     
    -    This is a whitespace-only change to make reading subsequent commits
    -    easier. I'll be adding a new argument on the "mode" line, so leave
    -    space on it.
    +    This is a whitespace-only change to make changes in a later series
    +    easier to read. In that series I'll be adding a new argument on the
    +    "mode" line, so leave space on it for a new argument.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
19:  152c6d88542 <  -:  ----------- tree.h API: make read_tree_fn_t take an "enum object_type"
20:  1c2f65cb674 <  -:  ----------- tree-walk.h users: migrate "p->mode &&" pattern
21:  163922d427c <  -:  ----------- tree-walk.h users: refactor chained "mode" if/else into switch
22:  21df7c668be <  -:  ----------- tree-walk.h users: migrate miscellaneous "mode" to "object_type"
25:  685da1abbdc <  -:  ----------- fsck.c: switch on "object_type" in fsck_walk_tree()
27:  7251654dd52 ! 13:  9c96d472472 tree-walk.h API: formatting changes for subsequent commit
    @@ Commit message
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
    - ## blame.c ##
    -@@ blame.c: static void verify_working_tree_path(struct repository *r,
    - 		const struct object_id *commit_oid = &parents->item->object.oid;
    - 		struct object_id blob_oid;
    - 		unsigned short mode;
    -+		int ret = get_tree_entry(r, commit_oid, path, &blob_oid,
    -+					 &mode);
    - 
    --		if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode) &&
    --		    oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
    -+		if (!ret && oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
    - 			return;
    - 	}
    - 
    -
      ## tree-walk.c ##
     @@ tree-walk.c: static int find_tree_entry(struct repository *r, struct tree_desc *t,
      			oidcpy(result, &oid);
30:  7f699bf2d5c ! 14:  44f16d74426 tree-walk.h API: add get_tree_entry_type()
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    tree-walk.h API: add get_tree_entry_type()
    +    tree-walk.h API doc: improve documentation of get_tree_entry()
     
    -    Add a get_tree_entry_type() helper function to compliment the existing
    -    get_tree_entry(), and a static get_tree_entry_all() which it uses internally.
    -
    -    Move those users of get_tree_entry_type() who didn't care about the
    -    mode specifically, but just want to know whether the tree entry is one
    -    of OBJ_{BLOB,COMMIT,TREE} over to the new get_tree_entry_type().
    -
    -    The get_tree_entry_all() function itself will be made non-static in a
    -    subsequent commit. I'm leaving its argument list indented accordingly
    -    to reduce churn when I do so.
    +    Change a mention of sha1 to OID and change the comment to a listing of
    +    functions discussed below, right now there's only one function, but
    +    subsequent commits will add more.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
    - ## archive.c ##
    -@@ archive.c: static void parse_treeish_arg(const char **argv,
    - 
    - 	if (prefix) {
    - 		struct object_id tree_oid;
    --		unsigned short mode;
    -+		enum object_type object_type;
    - 		int err;
    - 
    --		err = get_tree_entry_mode(ar_args->repo,
    -+		err = get_tree_entry_type(ar_args->repo,
    - 					  &tree->object.oid,
    - 					  prefix, &tree_oid,
    --					  &mode);
    --		if (err || !S_ISDIR(mode))
    -+					  &object_type);
    -+		if (err || object_type != OBJ_TREE)
    - 			die(_("current working directory is untracked"));
    - 
    - 		tree = parse_tree_indirect(&tree_oid);
    -
    - ## match-trees.c ##
    -@@ match-trees.c: void shift_tree_by(struct repository *r,
    - 		   const char *shift_prefix)
    - {
    - 	struct object_id sub1, sub2;
    --	unsigned short tmp;
    -+	enum object_type tmp;
    - 	unsigned candidate = 0;
    - 
    - 	/* Can hash2 be a tree at shift_prefix in tree hash1? */
    --	if (!get_tree_entry_mode(r, hash1, shift_prefix, &sub1, &tmp) &&
    --	    S_ISDIR(tmp))
    -+	if (!get_tree_entry_type(r, hash1, shift_prefix, &sub1, &tmp) &&
    -+	    tmp == OBJ_TREE)
    - 		candidate |= 1;
    - 
    - 	/* Can hash1 be a tree at shift_prefix in tree hash2? */
    --	if (!get_tree_entry_mode(r, hash2, shift_prefix, &sub2, &tmp) &&
    --	    S_ISDIR(tmp))
    -+	if (!get_tree_entry_type(r, hash2, shift_prefix, &sub2, &tmp) &&
    -+	    tmp == OBJ_TREE)
    - 		candidate |= 2;
    - 
    - 	if (candidate == 3) {
    -
    - ## tree-walk.c ##
    -@@ tree-walk.c: struct dir_state {
    - 	struct object_id oid;
    - };
    - 
    -+static int get_tree_entry_all(struct repository *r,
    -+			      const struct object_id *tree_oid,
    -+			      const char *name,
    -+			      struct object_id *oid,
    -+			      unsigned short *mode,
    -+			      enum object_type *object_type);
    -+
    - static int find_tree_entry(struct repository *r, struct tree_desc *t,
    - 			   const char *name, struct object_id *result,
    --			   unsigned short *mode)
    -+			   unsigned short *mode,
    -+			   enum object_type *object_type)
    - {
    - 	int namelen = strlen(name);
    - 	while (t->size) {
    -@@ tree-walk.c: static int find_tree_entry(struct repository *r, struct tree_desc *t,
    - 		}
    - 		if (name[entrylen] != '/')
    - 			continue;
    --		if (!S_ISDIR(*mode))
    -+		if (*object_type != OBJ_TREE)
    - 			break;
    - 		if (++entrylen == namelen) {
    - 			oidcpy(result, &oid);
    - 			return 0;
    - 		}
    --		return get_tree_entry_mode(r, &oid, name + entrylen, result,
    --					   mode);
    -+		return get_tree_entry_all(r, &oid, name + entrylen, result,
    -+					  mode, object_type);
    - 	}
    - 	return -1;
    - }
    - 
    --int get_tree_entry_mode(struct repository *r,
    --			const struct object_id *tree_oid,
    --			const char *name,
    --			struct object_id *oid,
    --			unsigned short *mode)
    -+static int get_tree_entry_all(struct repository *r,
    -+		       const struct object_id *tree_oid,
    -+		       const char *name,
    -+		       struct object_id *oid,
    -+		       unsigned short *mode,
    -+		       enum object_type *object_type)
    - {
    - 	int retval;
    - 	void *tree;
    -@@ tree-walk.c: int get_tree_entry_mode(struct repository *r,
    - 		struct tree_desc t;
    - 		init_tree_desc(&t, tree, size);
    - 		retval = find_tree_entry(r, &t, name, oid,
    --					 mode);
    -+					 mode, object_type);
    - 	}
    - 	free(tree);
    - 	return retval;
    - }
    - 
    -+int get_tree_entry_mode(struct repository *r,
    -+			const struct object_id *tree_oid,
    -+			const char *name,
    -+			struct object_id *oid,
    -+			unsigned short *mode)
    -+{
    -+	enum object_type object_type;
    -+	return get_tree_entry_all(r, tree_oid, name, oid,
    -+				  mode, &object_type);
    -+}
    -+
    -+int get_tree_entry_type(struct repository *r,
    -+			const struct object_id *tree_oid,
    -+			const char *name,
    -+			struct object_id *oid,
    -+			enum object_type *object_type)
    -+{
    -+	unsigned short mode;
    -+	return get_tree_entry_all(r, tree_oid, name, oid,
    -+				  &mode, object_type);
    -+}
    -+
    - /*
    -  * This is Linux's built-in max for the number of symlinks to follow.
    -  * That limit, of course, does not affect git, but it's a reasonable
    -@@ tree-walk.c: enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
    - 		int find_result;
    - 		char *first_slash;
    - 		char *remainder = NULL;
    -+		enum object_type object_type;
    - 
    - 		if (!t.buffer) {
    - 			void *tree;
    -@@ tree-walk.c: enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
    - 		/* Look up the first (or only) path component in the tree. */
    - 		find_result = find_tree_entry(r, &t, namebuf.buf,
    - 					      &current_tree_oid,
    --					      mode);
    -+					      mode, &object_type);
    - 		if (find_result) {
    - 			goto done;
    - 		}
    -
      ## tree-walk.h ##
     @@ tree-walk.h: struct traverse_info {
    -  * Find an entry in a tree given a pathname and the sha1 of a tree to
    + };
    + 
    + /**
    +- * Find an entry in a tree given a pathname and the sha1 of a tree to
    ++ * Find an entry in a tree given a pathname and the OID of a tree to
       * search. Returns 0 if the entry is found and -1 otherwise.
       *
     - * The third and fourth parameters are set to the entry's sha1 and
     - * mode respectively.
    -+ * There are variants of this function depending on what fields in the
    -+ * "struct name_entry" you'd like. You always need a pointer to an
    -+ * appropriate variable to fill in (NULL won't do!):
    ++ * You always need a pointer to an appropriate variable to fill in
    ++ * (NULL won't do!). That variable is:
     + *
    -+ * get_tree_entry_mode(): unsigned int mode
    -+ * get_tree_entry_type(): enum object_type
    ++ * get_tree_entry(): unsigned short mode
       */
    - int get_tree_entry_mode(struct repository *, const struct object_id *, const char *,
    - 			struct object_id *,
    - 			unsigned short *);
    -+int get_tree_entry_type(struct repository *, const struct object_id *, const char *,
    -+			struct object_id *,
    -+			enum object_type *);
    - 
    - /**
    -  * Generate the full pathname of a tree entry based from the root of the
    + int get_tree_entry(struct repository *, const struct object_id *, const char *,
    + 		   struct object_id *,
28:  9e521a3cbf2 ! 15:  adbada0ade8 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()
    @@ Commit message
         change is only a search-replacement of the name and indentation of the
         argument lists.
     
    -    A subsequent commits will add get_tree_entry_type() and
    -    get_tree_entry_all() functions. Those changes will be much easier to
    -    read if we do this rename first.
    +    Subsequent commits will add another get_tree_entry_*() function. Those
    +    changes will be much easier to read if we do this rename first.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
    @@ blame.c: static void verify_working_tree_path(struct repository *r,
      		const struct object_id *commit_oid = &parents->item->object.oid;
      		struct object_id blob_oid;
      		unsigned short mode;
    --		int ret = get_tree_entry(r, commit_oid, path, &blob_oid,
    --					 &mode);
    -+		int ret = get_tree_entry_mode(r, commit_oid, path, &blob_oid,
    -+					      &mode);
    - 
    - 		if (!ret && oid_object_info(r, &blob_oid, NULL) == OBJ_BLOB)
    +-
    +-		if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode))
    ++		if (!get_tree_entry_mode(r, commit_oid, path, &blob_oid, &mode))
      			return;
    + 	}
    + 
     @@ blame.c: static int fill_blob_sha1_and_mode(struct repository *r,
      {
      	if (!is_null_oid(&origin->blob_oid))
    @@ match-trees.c: void shift_tree_by(struct repository *r,
      	unsigned candidate = 0;
      
      	/* Can hash2 be a tree at shift_prefix in tree hash1? */
    --	if (!get_tree_entry(r, hash1, shift_prefix, &sub1, &mode1) &&
    -+	if (!get_tree_entry_mode(r, hash1, shift_prefix, &sub1, &mode1) &&
    - 	    S_ISDIR(mode1))
    +-	if (!get_tree_entry(r, hash1, shift_prefix, &sub1, &tmp) &&
    ++	if (!get_tree_entry_mode(r, hash1, shift_prefix, &sub1, &tmp) &&
    + 	    S_ISDIR(tmp))
      		candidate |= 1;
      
      	/* Can hash1 be a tree at shift_prefix in tree hash2? */
    --	if (!get_tree_entry(r, hash2, shift_prefix, &sub2, &mode2) &&
    -+	if (!get_tree_entry_mode(r, hash2, shift_prefix, &sub2, &mode2) &&
    - 	    S_ISDIR(mode2))
    +-	if (!get_tree_entry(r, hash2, shift_prefix, &sub2, &tmp) &&
    ++	if (!get_tree_entry_mode(r, hash2, shift_prefix, &sub2, &tmp) &&
    + 	    S_ISDIR(tmp))
      		candidate |= 2;
      
     
    @@ tree-walk.c: static int find_tree_entry(struct repository *r, struct tree_desc *
     
      ## tree-walk.h ##
     @@ tree-walk.h: struct traverse_info {
    -  * The third and fourth parameters are set to the entry's sha1 and
    -  * mode respectively.
    +  * You always need a pointer to an appropriate variable to fill in
    +  * (NULL won't do!). That variable is:
    +  *
    +- * get_tree_entry(): unsigned short mode
    ++ * get_tree_entry_mode(): unsigned short mode
       */
     -int get_tree_entry(struct repository *, const struct object_id *, const char *,
     -		   struct object_id *,
35:  a2a34fd3e2d ! 16:  3ba77fd3a47 tree-walk.h API: add a get_tree_entry_path() function
    @@ Commit message
         tree-walk.h API: add a get_tree_entry_path() function
     
         Add a get_tree_entry_path() variant in addition to
    -    get_tree_entry_path_{mode,type,all}(). This is for those callers that
    -    need neither the mode nor "enum object_type" parameters filled for
    -    them.
    +    get_tree_entry_path_mode(). This is for those callers that don't need
    +    the "mode" filled for them.
     
    -    There are callers here which don't need the "struct object_id" filled;
    -    forcing callers to pass one just requires they create a throwaway
    -    variable.
    +    There are callers here which don't need the "struct object_id" filled
    +    either, but let's leave that for now. I'm focusing downstream code
    +    that depends on "mode" (or "enum object_type").
     
    -    See the following commits for the introduction of such code that's
    -    being modified here:
    +    The code being modified here was introduced in:
     
          - shift_tree(): 68faf68938e (A new merge stragety[sic] 'subtree'.,
             2007-02-15) for the shift_tree()
    @@ Commit message
          - diagnose_invalid_oid_path(): 009fee4774d (Detailed diagnosis when
            parsing an object name fails., 2009-12-07)
     
    -    Those could potentially be refactored too, but I've got to stop at
    -    some point, and right now I'm focusing downstream code that depends on
    -    "mode" (or "enum object_type").
    -
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## match-trees.c ##
    @@ object-name.c: static void diagnose_invalid_oid_path(struct repository *r,
      			    fullname,
     
      ## tree-walk.c ##
    -@@ tree-walk.c: int get_tree_entry_all(struct repository *r,
    +@@ tree-walk.c: int get_tree_entry_mode(struct repository *r,
      	return retval;
      }
      
    @@ tree-walk.c: int get_tree_entry_all(struct repository *r,
     +			struct object_id *oid)
     +{
     +	unsigned short mode;
    -+	enum object_type object_type;
    -+	return get_tree_entry_all(r, tree_oid, name, oid,
    -+				  &mode, &object_type);
    ++	return get_tree_entry_mode(r, tree_oid, name, oid, &mode);
     +}
     +
    - int get_tree_entry_mode(struct repository *r,
    - 			const struct object_id *tree_oid,
    - 			const char *name,
    + /*
    +  * This is Linux's built-in max for the number of symlinks to follow.
    +  * That limit, of course, does not affect git, but it's a reasonable
     
      ## tree-walk.h ##
     @@ tree-walk.h: struct traverse_info {
    -  * "struct name_entry" you'd like. You always need a pointer to an
    -  * appropriate variable to fill in (NULL won't do!):
    +  * You always need a pointer to an appropriate variable to fill in
    +  * (NULL won't do!). That variable is:
       *
     + * get_tree_entry_path(): <no extra argument, just get the common 'path'>
    -  * get_tree_entry_mode(): unsigned int mode
    -  * get_tree_entry_type(): enum object_type
    -  * get_tree_entry_all(): unsigned int mode, enum object_type
    +  * get_tree_entry_mode(): unsigned short mode
       */
     +int get_tree_entry_path(struct repository *, const struct object_id *, const char *,
     +			struct object_id *);
31:  7ab7576cb16 ! 17:  dc895822828 tree-walk.h API: document and format tree_entry_extract()
    @@ Commit message
         tree-walk.h API: document and format tree_entry_extract()
     
         Document and format the argument list of the tree_entry_extract()
    -    function in preparation for adding a sister function.
    +    function in preparation for eventually adding a sister function.
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
    @@ tree-walk.h: struct tree_desc {
     + * "struct name_entry" you'd like. You always need a pointer to an
     + * appropriate variable to fill in (NULL won't do!):
     + *
    -+ * tree_entry_extract_mode(): const char *path, unsigned int mode
    ++ * tree_entry_extract(): const char *path, unsigned int mode
       */
     -static inline const struct object_id *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned short *modep)
     +static inline const struct object_id *tree_entry_extract(struct tree_desc *desc,
32:  a1bd81d64aa ! 18:  e961a0e8b5b tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()
    @@ tree-diff.c: static struct combine_diff_path *emit_path(struct combine_diff_path
      
      		isdir = S_ISDIR(mode);
     
    + ## tree-walk.c ##
    +@@ tree-walk.c: static int find_tree_entry(struct repository *r, struct tree_desc *t,
    + 		struct object_id oid;
    + 		int entrylen, cmp;
    + 
    +-		oidcpy(&oid, tree_entry_extract(t, &entry, mode));
    ++		oidcpy(&oid, tree_entry_extract_mode(t, &entry, mode));
    + 		entrylen = tree_entry_len(&t->entry);
    + 		update_tree_entry(t);
    + 		if (entrylen > namelen)
    +
      ## tree-walk.h ##
     @@ tree-walk.h: struct tree_desc {
    +  * "struct name_entry" you'd like. You always need a pointer to an
    +  * appropriate variable to fill in (NULL won't do!):
       *
    -  * tree_entry_extract_mode(): const char *path, unsigned int mode
    +- * tree_entry_extract(): const char *path, unsigned int mode
    ++ * tree_entry_extract_mode(): const char *path, unsigned int mode
       */
     -static inline const struct object_id *tree_entry_extract(struct tree_desc *desc,
     -							 const char **pathp,
33:  ce7c19ad39c <  -:  ----------- tree-walk.h API: add a tree_entry_extract_all() function
34:  95eec961be8 <  -:  ----------- tree-walk.h API: add get_tree_entry_all()
37:  4d51da4ea39 <  -:  ----------- tree-walk.h API: add a tree_entry_extract_type() function
-- 
2.31.1.474.g72d45d12706
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 75 of 262 in “read_tree(): pass "int stage" as context to read_tree_recursive()”
  1. read_tree(): pass "int stage" as context to read_tree_recursive()Nguyễn Thái Ngọc Duy, Apr 18, 2009
  2. 0/7 Move the read_tree() function to its only userÆvar Arnfjörð Bjarmason, Mar 6, 2021
  3. Elijah NewrenMar 6, 2021
  4. 2/6 tree.c API: move read_tree() into builtin/ls-files.cÆvar Arnfjörð Bjarmason, Mar 8, 2021
  5. Junio C HamanoMar 8, 2021
  6. Junio C HamanoMar 12, 2021
  7. 1/6 ls-files tests: add meaningful --with-tree testsÆvar Arnfjörð Bjarmason, Mar 8, 2021
  8. 3/6 ls-files: don't needlessly pass around stage variableÆvar Arnfjörð Bjarmason, Mar 8, 2021
  9. Junio C HamanoMar 8, 2021
  10. 0/6 Move the read_tree() function to its only userÆvar Arnfjörð Bjarmason, Mar 8, 2021
  11. 02/30 notes & match-trees: use name_entry's "pathlen" memberÆvar Arnfjörð Bjarmason, Mar 8, 2021
  12. 00/30 tree-walk: mostly "mode" to "enum object_type"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  13. Elijah NewrenMar 9, 2021
  14. Elijah NewrenMar 9, 2021
  15. Ævar Arnfjörð BjarmasonMar 9, 2021
  16. Elijah NewrenMar 12, 2021
  17. 02/29 notes & match-trees: use name_entry's "pathlen" memberÆvar Arnfjörð Bjarmason, Mar 16, 2021
  18. 00/29 tree-walk: mostly replace "mode" with "enum object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  19. Elijah NewrenMar 16, 2021
  20. Ævar Arnfjörð BjarmasonMar 16, 2021
  21. 01/32 diff.c: remove redundant canon_mode() callÆvar Arnfjörð Bjarmason, Mar 16, 2021
  22. 02/32 notes & match-trees: use name_entry's "pathlen" memberÆvar Arnfjörð Bjarmason, Mar 16, 2021
  23. 03/32 cache.h: add a comment to object_type()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  24. 00/32 tree-walk: mostly replace "mode" with "enum object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  25. Elijah NewrenMar 16, 2021
  26. 00/29 tree-walk: mostly replace "mode" with "enum object_type"Ævar Arnfjörð Bjarmason, Mar 21, 2021
  27. 01/29 notes & match-trees: use name_entry's "pathlen" memberÆvar Arnfjörð Bjarmason, Mar 21, 2021
  28. 02/29 cache.h: add a comment to object_type()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  29. 05/29 fast-import tests: test for sorting dir/file foo v.s. foo.txtÆvar Arnfjörð Bjarmason, Mar 21, 2021
  30. 04/29 tree-walk.c: migrate to using new "object_type" field when possibleÆvar Arnfjörð Bjarmason, Mar 21, 2021
  31. 08/29 cache.h: have base_name_compare() take "is tree?", not "mode"Ævar Arnfjörð Bjarmason, Mar 21, 2021
  32. 09/29 tree-walk.h users: switch object_type(...) to new .object_typeÆvar Arnfjörð Bjarmason, Mar 21, 2021
  33. 15/29 merge-tree tests: test for the mode comparison in same_entry()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  34. 06/29 mktree tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 21, 2021
  35. 11/29 tree.h API: make read_tree_fn_t take an "enum object_type"Ævar Arnfjörð Bjarmason, Mar 21, 2021
  36. 03/29 tree-walk.h: add object_type member to name_entryÆvar Arnfjörð Bjarmason, Mar 21, 2021
  37. 13/29 tree-walk.h users: refactor chained "mode" if/else into switchÆvar Arnfjörð Bjarmason, Mar 21, 2021
  38. 14/29 tree-walk.h users: migrate miscellaneous "mode" to "object_type"Ævar Arnfjörð Bjarmason, Mar 21, 2021
  39. 12/29 tree-walk.h users: migrate "p->mode &&" patternÆvar Arnfjörð Bjarmason, Mar 21, 2021
  40. 10/29 tree.h: format argument lists of read_tree_recursive() usersÆvar Arnfjörð Bjarmason, Mar 21, 2021
  41. 18/29 tree-walk.h users: use temporary variable(s) for "mode"Ævar Arnfjörð Bjarmason, Mar 21, 2021
  42. 17/29 fsck.c: switch on "object_type" in fsck_walk_tree()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  43. 07/29 diff tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 21, 2021
  44. 16/29 merge-ort: correct reference to test in 62fdec17a11Ævar Arnfjörð Bjarmason, Mar 21, 2021
  45. 21/29 match-trees: use "tmp" for mode in shift_tree_by()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  46. 19/29 tree-walk.h API: formatting changes for subsequent commitÆvar Arnfjörð Bjarmason, Mar 21, 2021
  47. 23/29 tree-walk.h API: document and format tree_entry_extract()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  48. 22/29 tree-walk.h API: add get_tree_entry_type()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  49. 20/29 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  50. 24/29 tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  51. 28/29 blame: emit a better error on 'git blame directory'Ævar Arnfjörð Bjarmason, Mar 21, 2021
  52. 29/29 tree-walk.h API: add a tree_entry_extract_type() functionÆvar Arnfjörð Bjarmason, Mar 21, 2021
  53. 25/29 tree-walk.h API: add a tree_entry_extract_all() functionÆvar Arnfjörð Bjarmason, Mar 21, 2021
  54. 26/29 tree-walk.h API: add get_tree_entry_all()Ævar Arnfjörð Bjarmason, Mar 21, 2021
  55. 27/29 tree-walk.h API: add a get_tree_entry_path() functionÆvar Arnfjörð Bjarmason, Mar 21, 2021
  56. Junio C HamanoMar 21, 2021
  57. Ævar Arnfjörð BjarmasonMar 21, 2021
  58. 0/2 diff --no-index: fix test blind spotsÆvar Arnfjörð Bjarmason, Mar 21, 2021
  59. 2/2 diff --no-index tests: test mode normalizationÆvar Arnfjörð Bjarmason, Mar 21, 2021
  60. 1/2 diff --no-index tests: add test for --exit-codeÆvar Arnfjörð Bjarmason, Mar 21, 2021
  61. Ramsay JonesMar 21, 2021
  62. Junio C HamanoMar 21, 2021
  63. Ævar Arnfjörð BjarmasonMar 21, 2021
  64. 0/2 diff --no-index: fix test blind spotsÆvar Arnfjörð Bjarmason, Mar 21, 2021
  65. 1/2 diff --no-index tests: add test for --exit-codeÆvar Arnfjörð Bjarmason, Mar 21, 2021
  66. 2/2 diff --no-index tests: test mode normalizationÆvar Arnfjörð Bjarmason, Mar 21, 2021
  67. Junio C HamanoMar 22, 2021
  68. Junio C HamanoMar 22, 2021
  69. 0/2 diff --no-index: fix test blind spotsÆvar Arnfjörð Bjarmason, Mar 23, 2021
  70. 2/2 diff --no-index tests: test mode normalizationÆvar Arnfjörð Bjarmason, Mar 23, 2021
  71. 1/2 diff --no-index tests: add test for --exit-codeÆvar Arnfjörð Bjarmason, Mar 23, 2021
  72. Junio C HamanoMar 23, 2021
  73. Junio C HamanoMar 21, 2021
  74. Ævar Arnfjörð BjarmasonMar 21, 2021
  75. 00/18 tree-walk.h: slimmed downÆvar Arnfjörð Bjarmason, Mar 31, 2021
  76. 01/18 cache.h: add a comment to object_type()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  77. Junio C HamanoMar 31, 2021
  78. 02/18 merge-ort: correct reference to test in 62fdec17a11Ævar Arnfjörð Bjarmason, Mar 31, 2021
  79. 05/18 mktree tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 31, 2021
  80. Junio C HamanoMar 31, 2021
  81. 04/18 fast-import tests: test for sorting dir/file foo v.s. foo.txtÆvar Arnfjörð Bjarmason, Mar 31, 2021
  82. 03/18 cache.h: have base_name_compare() take "is tree?", not "mode"Ævar Arnfjörð Bjarmason, Mar 31, 2021
  83. Junio C HamanoMar 31, 2021
  84. 08/18 blame: emit a better error on 'git blame directory'Ævar Arnfjörð Bjarmason, Mar 31, 2021
  85. Junio C HamanoMar 31, 2021
  86. Ævar Arnfjörð BjarmasonApr 2, 2021
  87. Junio C HamanoApr 2, 2021
  88. 09/18 notes & match-trees: use name_entry's "pathlen" memberÆvar Arnfjörð Bjarmason, Mar 31, 2021
  89. Junio C HamanoMar 31, 2021
  90. 10/18 tree-walk.h users: use temporary variable(s) for "mode"Ævar Arnfjörð Bjarmason, Mar 31, 2021
  91. 07/18 merge-tree tests: test for the mode comparison in same_entry()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  92. Junio C HamanoMar 31, 2021
  93. 16/18 tree-walk.h API: add a get_tree_entry_path() functionÆvar Arnfjörð Bjarmason, Mar 31, 2021
  94. Junio C HamanoApr 1, 2021
  95. Ævar Arnfjörð BjarmasonApr 2, 2021
  96. 17/18 tree-walk.h API: document and format tree_entry_extract()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  97. Junio C HamanoApr 1, 2021
  98. 13/18 tree-walk.h API: formatting changes for subsequent commitÆvar Arnfjörð Bjarmason, Mar 31, 2021
  99. 15/18 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  100. 06/18 diff tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 31, 2021
  101. Junio C HamanoMar 31, 2021
  102. 12/18 tree.h: format argument lists of read_tree() usersÆvar Arnfjörð Bjarmason, Mar 31, 2021
  103. 11/18 match-trees: use "tmp" for mode in shift_tree_by()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  104. Junio C HamanoMar 31, 2021
  105. 14/18 tree-walk.h API doc: improve documentation of get_tree_entry()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  106. Junio C HamanoApr 1, 2021
  107. Ævar Arnfjörð BjarmasonApr 2, 2021
  108. 18/18 tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()Ævar Arnfjörð Bjarmason, Mar 31, 2021
  109. Junio C HamanoApr 1, 2021
  110. 05/32 tree-walk.c: migrate to using new "object_type" field when possibleÆvar Arnfjörð Bjarmason, Mar 16, 2021
  111. 04/32 tree-walk.h: add object_type member to name_entryÆvar Arnfjörð Bjarmason, Mar 16, 2021
  112. 07/32 mktree tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 16, 2021
  113. 08/32 diff tests: test that "mode" is passed when sortingÆvar Arnfjörð Bjarmason, Mar 16, 2021
  114. 13/32 archive: get rid of 'stage' parameterÆvar Arnfjörð Bjarmason, Mar 16, 2021
  115. 10/32 tree-walk.h users: switch object_type(...) to new .object_typeÆvar Arnfjörð Bjarmason, Mar 16, 2021
  116. 09/32 cache.h: have base_name_compare() take "is tree?", not "mode"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  117. 06/32 fast-import tests: test for sorting dir/file foo v.s. foo.txtÆvar Arnfjörð Bjarmason, Mar 16, 2021
  118. 12/32 tree.h users: format argument lists in archive.cÆvar Arnfjörð Bjarmason, Mar 16, 2021
  119. 11/32 tree.h: format argument lists of read_tree_recursive() usersÆvar Arnfjörð Bjarmason, Mar 16, 2021
  120. 14/32 tree.h API: make read_tree_fn_t take an "enum object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  121. 16/32 tree-walk.h users: refactor chained "mode" if/else into switchÆvar Arnfjörð Bjarmason, Mar 16, 2021
  122. 17/32 tree-walk.h users: migrate miscellaneous "mode" to "object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  123. 15/32 tree-walk.h users: migrate "p->mode &&" patternÆvar Arnfjörð Bjarmason, Mar 16, 2021
  124. 18/32 merge-tree tests: test for the mode comparison in same_entry()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  125. 19/32 merge-ort: correct reference to test in 62fdec17a11Ævar Arnfjörð Bjarmason, Mar 16, 2021
  126. 22/32 tree-walk.h API: formatting changes for subsequent commitÆvar Arnfjörð Bjarmason, Mar 16, 2021
  127. 20/32 fsck.c: switch on "object_type" in fsck_walk_tree()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  128. 21/32 tree-walk.h users: use temporary variable(s) for "mode"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  129. 23/32 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  130. 24/32 match-trees: use "tmp" for mode in shift_tree_by()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  131. 25/32 tree-walk.h API: add get_tree_entry_type()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  132. 26/32 tree-walk.h API: document and format tree_entry_extract()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  133. 29/32 tree-walk.h API: add get_tree_entry_all()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  134. 28/32 tree-walk.h API: add a tree_entry_extract_all() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  135. 27/32 tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  136. 31/32 blame: emit a better error on 'git blame directory'Ævar Arnfjörð Bjarmason, Mar 16, 2021
  137. 30/32 tree-walk.h API: add a get_tree_entry_path() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  138. 32/32 tree-walk.h API: add a tree_entry_extract_type() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  139. 03/29 cache.h: add a comment to object_type()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  140. 05/29 tree-walk.c: migrate to using new "object_type" field when possibleÆvar Arnfjörð Bjarmason, Mar 16, 2021
  141. 06/29 cache.h: have base_name_compare() take "is tree?", not "mode"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  142. Elijah NewrenMar 16, 2021
  143. 01/29 diff.c: remove redundant canon_mode() callÆvar Arnfjörð Bjarmason, Mar 16, 2021
  144. 04/29 tree-walk.h: add object_type member to name_entryÆvar Arnfjörð Bjarmason, Mar 16, 2021
  145. 10/29 archive: get rid of 'stage' parameterÆvar Arnfjörð Bjarmason, Mar 16, 2021
  146. 07/29 tree-walk.h users: switch object_type(...) to new .object_typeÆvar Arnfjörð Bjarmason, Mar 16, 2021
  147. 13/29 tree-walk.h users: refactor chained "mode" if/else into switchÆvar Arnfjörð Bjarmason, Mar 16, 2021
  148. 08/29 tree.h: format argument lists of read_tree_recursive() usersÆvar Arnfjörð Bjarmason, Mar 16, 2021
  149. 11/29 tree.h API: make read_tree_fn_t take an "enum object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  150. 15/29 merge-tree tests: test for the mode comparison in same_entry()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  151. 14/29 tree-walk.h users: migrate miscellaneous "mode" to "object_type"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  152. 16/29 merge-ort: correct reference to test in 62fdec17a11Ævar Arnfjörð Bjarmason, Mar 16, 2021
  153. 18/29 tree-walk.h users: use temporary variable(s) for "mode"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  154. 17/29 fsck.c: switch on "object_type" in fsck_walk_tree()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  155. 20/29 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  156. 21/29 tree-walk.h API users: use "tmp" for mode in shift_tree_by()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  157. Elijah NewrenMar 16, 2021
  158. 23/29 tree-walk.h API: document and format tree_entry_extract()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  159. 22/29 tree-walk.h API: add get_tree_entry_type()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  160. 09/29 tree.h users: format argument lists in archive.cÆvar Arnfjörð Bjarmason, Mar 16, 2021
  161. 26/29 tree-walk.h API: add get_tree_entry_all()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  162. 24/29 tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  163. 25/29 tree-walk.h API: add a tree_entry_extract_all() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  164. 12/29 tree-walk.h users: migrate "p->mode &&" patternÆvar Arnfjörð Bjarmason, Mar 16, 2021
  165. 27/29 tree-walk.h API: add a get_tree_entry_path() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  166. Elijah NewrenMar 16, 2021
  167. 28/29 blame: emit a better error on 'git blame directory'Ævar Arnfjörð Bjarmason, Mar 16, 2021
  168. Elijah NewrenMar 16, 2021
  169. 29/29 tree-walk.h API: add a tree_entry_extract_type() functionÆvar Arnfjörð Bjarmason, Mar 16, 2021
  170. 19/29 tree-walk.h API: formatting changes for subsequent commitÆvar Arnfjörð Bjarmason, Mar 16, 2021
  171. 01/30 diff.c: remove redundant canon_mode() callÆvar Arnfjörð Bjarmason, Mar 8, 2021
  172. 03/30 cache.h: add a comment to object_type()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  173. Elijah NewrenMar 9, 2021
  174. 04/30 tree-walk.h: add object_type member to name_entryÆvar Arnfjörð Bjarmason, Mar 8, 2021
  175. 05/30 tree-walk.c: migrate to using new "object_type" field when possibleÆvar Arnfjörð Bjarmason, Mar 8, 2021
  176. Elijah NewrenMar 9, 2021
  177. 12/30 tree-walk.h users: migrate "p->mode &&" patternÆvar Arnfjörð Bjarmason, Mar 8, 2021
  178. Elijah NewrenMar 9, 2021
  179. 06/30 cache.h: have base_name_compare() take "is tree?", not "mode"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  180. Elijah NewrenMar 9, 2021
  181. 07/30 tree-walk.h users: switch object_type(...) to new .object_typeÆvar Arnfjörð Bjarmason, Mar 8, 2021
  182. 08/30 tree.h: format argument lists of read_tree_recursive() usersÆvar Arnfjörð Bjarmason, Mar 8, 2021
  183. 09/30 tree.h users: format argument lists in archive.cÆvar Arnfjörð Bjarmason, Mar 8, 2021
  184. Elijah NewrenMar 9, 2021
  185. 13/30 tree-walk.h users: refactor chained "mode" if/else into switchÆvar Arnfjörð Bjarmason, Mar 8, 2021
  186. Elijah NewrenMar 9, 2021
  187. 11/30 tree.h API: make read_tree_fn_t take an "enum object_type"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  188. 10/30 archive: get rid of 'stage' parameterÆvar Arnfjörð Bjarmason, Mar 8, 2021
  189. 21/30 tree-walk.h API users: use "tmp" for mode in shift_tree_by()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  190. Elijah NewrenMar 9, 2021
  191. 18/30 tree-walk.h users: use temporary variable(s) for "mode"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  192. 20/30 tree-walk.h API: rename get_tree_entry() to get_tree_entry_mode()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  193. 16/30 merge-ort: correct reference to test in 62fdec17a11Ævar Arnfjörð Bjarmason, Mar 8, 2021
  194. Elijah NewrenMar 9, 2021
  195. 22/30 tree-walk.h API: Add get_tree_entry_type()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  196. Elijah NewrenMar 9, 2021
  197. 14/30 tree-walk.h users: migrate miscellaneous "mode" to "object_type"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  198. 19/30 tree-walk.h API: formatting changes for subsequent commitÆvar Arnfjörð Bjarmason, Mar 8, 2021
  199. 17/30 fsck.c: switch on "object_type" in fsck_walk_tree()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  200. 15/30 merge-tree tests: test for the mode comparison in same_entry()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  201. Elijah NewrenMar 9, 2021
  202. 24/30 tree-walk.h API: document and format tree_entry_extract()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  203. Elijah NewrenMar 9, 2021
  204. 25/30 tree-entry.h API: rename tree_entry_extract() to tree_entry_extract_mode()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  205. 23/30 tree-walk.h API: add a get_tree_entry_path() functionÆvar Arnfjörð Bjarmason, Mar 8, 2021
  206. Elijah NewrenMar 9, 2021
  207. 26/30 tree-walk.h API: add a tree_entry_extract_all() functionÆvar Arnfjörð Bjarmason, Mar 8, 2021
  208. Elijah NewrenMar 9, 2021
  209. 28/30 tree-walk.h API users: rename "struct name_entry"'s "mode" to "raw_mode"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  210. Elijah NewrenMar 9, 2021
  211. 29/30 tree.h API users: rename read_tree_fn_t's "mode" to "raw_mode"Ævar Arnfjörð Bjarmason, Mar 8, 2021
  212. Elijah NewrenMar 9, 2021
  213. 30/30 tree-walk.h API: move canon_mode() back out of decode_tree_entry()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  214. Elijah NewrenMar 9, 2021
  215. 27/30 tree-walk.h API: add a tree_entry_extract_type() functionÆvar Arnfjörð Bjarmason, Mar 8, 2021
  216. Elijah NewrenMar 8, 2021
  217. 1/9 ls-files tests: add meaningful --with-tree testsÆvar Arnfjörð Bjarmason, Mar 15, 2021
  218. 0/9 read_tree() and read_tree_recursive() refactoringÆvar Arnfjörð Bjarmason, Mar 15, 2021
  219. Elijah NewrenMar 16, 2021
  220. 0/9 read_tree() and read_tree_recursive() refactoringÆvar Arnfjörð Bjarmason, Mar 16, 2021
  221. 1/9 ls-files tests: add meaningful --with-tree testsÆvar Arnfjörð Bjarmason, Mar 16, 2021
  222. 3/9 ls-files: don't needlessly pass around stage variableÆvar Arnfjörð Bjarmason, Mar 16, 2021
  223. 4/9 ls-files: refactor away read_tree()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  224. 2/9 tree.c API: move read_tree() into builtin/ls-files.cÆvar Arnfjörð Bjarmason, Mar 16, 2021
  225. 5/9 tree.h API: remove support for starting at prefix != ""Ævar Arnfjörð Bjarmason, Mar 16, 2021
  226. 6/9 tree.h API: remove "stage" parameter from read_tree_recursive()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  227. 8/9 show tests: add test for "git show <tree>"Ævar Arnfjörð Bjarmason, Mar 16, 2021
  228. 9/9 tree.h API: expose read_tree_1() as read_tree_at()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  229. 7/9 tree.h API: rename read_tree_recursive() to read_tree()Ævar Arnfjörð Bjarmason, Mar 16, 2021
  230. Junio C HamanoMar 17, 2021
  231. 0/8 read_tree() and read_tree_recursive() refactoringÆvar Arnfjörð Bjarmason, Mar 20, 2021
  232. 2/8 ls-files tests: add meaningful --with-tree testsÆvar Arnfjörð Bjarmason, Mar 20, 2021
  233. 1/8 show tests: add test for "git show <tree>"Ævar Arnfjörð Bjarmason, Mar 20, 2021
  234. 4/8 ls-files: don't needlessly pass around stage variableÆvar Arnfjörð Bjarmason, Mar 20, 2021
  235. 3/8 tree.c API: move read_tree() into builtin/ls-files.cÆvar Arnfjörð Bjarmason, Mar 20, 2021
  236. 5/8 ls-files: refactor away read_tree()Ævar Arnfjörð Bjarmason, Mar 20, 2021
  237. 6/8 archive: stop passing "stage" through read_tree_recursive()Ævar Arnfjörð Bjarmason, Mar 20, 2021
  238. 7/8 tree.h API: expose read_tree_1() as read_tree_at()Ævar Arnfjörð Bjarmason, Mar 20, 2021
  239. 8/8 tree.h API: simplify read_tree_recursive() signatureÆvar Arnfjörð Bjarmason, Mar 20, 2021
  240. Junio C HamanoMar 20, 2021
  241. 3/9 ls-files: don't needlessly pass around stage variableÆvar Arnfjörð Bjarmason, Mar 15, 2021
  242. 4/9 ls-files: refactor away read_tree()Ævar Arnfjörð Bjarmason, Mar 15, 2021
  243. 2/9 tree.c API: move read_tree() into builtin/ls-files.cÆvar Arnfjörð Bjarmason, Mar 15, 2021
  244. 8/9 show tests: add test for "git show <tree>"Ævar Arnfjörð Bjarmason, Mar 15, 2021
  245. Elijah NewrenMar 16, 2021
  246. 5/9 tree.h API: remove support for starting at prefix != ""Ævar Arnfjörð Bjarmason, Mar 15, 2021
  247. 9/9 tree.h API: expose read_tree_1() as read_tree_at()Ævar Arnfjörð Bjarmason, Mar 15, 2021
  248. 7/9 tree.h API: rename read_tree_recursive() to read_tree()Ævar Arnfjörð Bjarmason, Mar 15, 2021
  249. 6/9 tree.h API: remove "stage" parameter from read_tree_recursive()Ævar Arnfjörð Bjarmason, Mar 15, 2021
  250. 5/6 tree.h API: remove support for starting at prefix != ""Ævar Arnfjörð Bjarmason, Mar 8, 2021
  251. 6/6 tree.h API: remove "stage" parameter from read_tree_recursive()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  252. 4/6 ls-files: refactor away read_tree()Ævar Arnfjörð Bjarmason, Mar 8, 2021
  253. Junio C HamanoMar 8, 2021
  254. 1/7 tree.c API: move read_tree() into builtin/ls-files.cÆvar Arnfjörð Bjarmason, Mar 6, 2021
  255. 5/7 ls-files: refactor read_one_entry_quick() to use a strbufÆvar Arnfjörð Bjarmason, Mar 6, 2021
  256. 2/7 ls-files: don't needlessly pass around stage variableÆvar Arnfjörð Bjarmason, Mar 6, 2021
  257. 3/7 ls-files: remove cache juggling + sortingÆvar Arnfjörð Bjarmason, Mar 6, 2021
  258. Elijah NewrenMar 6, 2021
  259. 6/7 tree.h API: remove support for starting at prefix != ""Ævar Arnfjörð Bjarmason, Mar 6, 2021
  260. Elijah NewrenMar 6, 2021
  261. 7/7 tree.h API: remove "stage" parameter from read_tree_recursive()Ævar Arnfjörð Bjarmason, Mar 6, 2021
  262. 4/7 merge-ort: move cmp_cache_name_compare() from tree.cÆvar Arnfjörð Bjarmason, Mar 6, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.