Skip to contentSkip to conversation

t0003: move setup for `--all` into new block

PATCH Superseded Karthik Nayak 3 participants 6 messages Jan 12, 2023 – Jan 14, 2023 1 message not in the archive Documentation

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#2 lore raw

PATCH v6 1/2 t0003: move setup for `--all` into new block

In reply to Karthik Nayak

There is some setup code which is used by multiple tests being setup in attribute test: --all option. This means when we run "sh ./t0003-attributes.sh --run=setup,<num>" there is a chance of failing since we missed this setup block.

So to ensure that setups are independent of test logic, move this to a new setup block.

---
 t/t0003-attributes.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
t/t0003-attributes.sh +5 -2
index f7ee2f2ff0..b3aabb8aa3 100755
@@ -203,9 +203,12 @@ test_expect_success 'attribute test: read paths from stdin' '
 	test_cmp expect actual
 '
 
-test_expect_success 'attribute test: --all option' '
+test_expect_success 'setup --all option' '
 	grep -v unspecified <expect-all | sort >specified-all &&
-	sed -e "s/:.*//" <expect-all | uniq >stdin-all &&
+	sed -e "s/:.*//" <expect-all | uniq >stdin-all
+'
+
+test_expect_success 'attribute test: --all option' '
 	git check-attr --stdin --all <stdin-all >tmp &&
 	sort tmp >actual &&
 	test_cmp specified-all actual
Signature · 1 line
2.39.0
#3 lore raw

PATCH v6 2/2 attr: add flag `--source` to work with tree-ish

In reply to Karthik Nayak

The contents of the .gitattributes files may evolve over time, but "git check-attr" always checks attributes against them in the working tree and/or in the index. It may be beneficial to optionally allow the users to check attributes taken from a commit other than HEAD against paths.

Add a new flag --source which will allow users to check the attributes against a commit (actually any tree-ish would do). When the user uses this flag, we go through the stack of .gitattributes files but instead of checking the current working tree and/or in the index, we check the blobs from the provided tree-ish object. This allows the command to also be used in bare repositories.

Since we use a tree-ish object, the user can pass "--source HEAD:subdirectory" and all the attributes will be looked up as if subdirectory was the root directory of the repository.

We cannot simply use the <rev>:<path> syntax without the --source flag, similar to how it is used in git show because any non-flag parameter before -- is treated as an attribute and any parameter after -- is treated as a pathname.

The change involves creating a new function read_attr_from_blob, which given the path reads the blob for the path against the provided source and parses the attributes line by line. This function is plugged into read_attr() function wherein we go through the stack of attributes files.

---
 Documentation/git-check-attr.txt |  9 ++-
 archive.c                        |  2 +-
 attr.c                           | 97 +++++++++++++++++++++++---------
 attr.h                           |  7 ++-
 builtin/check-attr.c             | 35 +++++++-----
 builtin/pack-objects.c           |  2 +-
 convert.c                        |  2 +-
 ll-merge.c                       |  4 +-
 pathspec.c                       |  2 +-
 t/t0003-attributes.sh            | 41 +++++++++++++-
 userdiff.c                       |  2 +-
 ws.c                             |  2 +-
 12 files changed, 152 insertions(+), 53 deletions(-)
Documentation/git-check-attr.txt +7 -2
index 84f41a8e82..6e4f3aaf34 100644
@@ -9,8 +9,8 @@ git-check-attr - Display gitattributes information
 SYNOPSIS
 --------
 [verse]
-'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
-'git check-attr' --stdin [-z] [-a | --all | <attr>...]
+'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
+'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
 
 DESCRIPTION
 -----------
@@ -36,6 +36,11 @@ OPTIONS
 	If `--stdin` is also given, input paths are separated
 	with a NUL character instead of a linefeed character.
 
+--source=<tree-ish>::
+	Check attributes against the specified tree-ish. It is common to
+	specify the source tree by naming a commit, branch or tag associated
+	with it.
+
 \--::
 	Interpret all preceding arguments as attributes and all following
 	arguments as path names.
archive.c +1 -1
index 941495f5d7..81ff76fce9 100644
@@ -120,7 +120,7 @@ static const struct attr_check *get_archive_attrs(struct index_state *istate,
 	static struct attr_check *check;
 	if (!check)
 		check = attr_check_initl("export-ignore", "export-subst", NULL);
-	git_check_attr(istate, path, check);
+	git_check_attr(istate, NULL, path, check);
 	return check;
 }
 
attr.c +70 -27

191 lines not on this page · raw message

attr.h +5 -2
index 3fb40cced0..f4a2bedd68 100644
@@ -1,6 +1,8 @@
 #ifndef ATTR_H
 #define ATTR_H
 
+#include "hash.h"
+
 /**
  * gitattributes mechanism gives a uniform way to associate various attributes
  * to set of paths.
@@ -190,13 +192,14 @@ void attr_check_free(struct attr_check *check);
 const char *git_attr_name(const struct git_attr *);
 
 void git_check_attr(struct index_state *istate,
-		    const char *path, struct attr_check *check);
+		    const struct object_id *tree_oid, const char *path,
+		    struct attr_check *check);
 
 /*
  * Retrieve all attributes that apply to the specified path.
  * check holds the attributes and their values.
  */
-void git_all_attrs(struct index_state *istate,
+void git_all_attrs(struct index_state *istate, const struct object_id *tree_oid,
 		   const char *path, struct attr_check *check);
 
 enum git_attr_direction {
builtin/check-attr.c +22 -13
index 0fef10eb6b..d7a40e674c 100644
@@ -9,9 +9,10 @@
 static int all_attrs;
 static int cached_attrs;
 static int stdin_paths;
+static char *source;
 static const char * const check_attr_usage[] = {
-N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
-N_("git check-attr --stdin [-z] [-a | --all | <attr>...]"),
+N_("git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>..."),
+N_("git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"),
 NULL
 };
 
@@ -23,6 +24,7 @@ static const struct option check_attr_options[] = {
 	OPT_BOOL(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
 	OPT_BOOL('z', NULL, &nul_term_line,
 		 N_("terminate input and output records by a NUL character")),
+	OPT_STRING(0, "source", &source, N_("<tree-ish>"), N_("which tree-ish to check attributes at")),
 	OPT_END()
 };
 
@@ -55,27 +57,26 @@ static void output_attr(struct attr_check *check, const char *file)
 	}
 }
 
-static void check_attr(const char *prefix,
-		       struct attr_check *check,
-		       int collect_all,
+static void check_attr(const char *prefix, struct attr_check *check,
+		       const struct object_id *tree_oid, int collect_all,
 		       const char *file)
+
 {
 	char *full_path =
 		prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
 
 	if (collect_all) {
-		git_all_attrs(&the_index, full_path, check);
+		git_all_attrs(&the_index, tree_oid, full_path, check);
 	} else {
-		git_check_attr(&the_index, full_path, check);
+		git_check_attr(&the_index, tree_oid, full_path, check);
 	}
 	output_attr(check, file);
 
 	free(full_path);
 }
 
-static void check_attr_stdin_paths(const char *prefix,
-				   struct attr_check *check,
-				   int collect_all)
+static void check_attr_stdin_paths(const char *prefix, struct attr_check *check,
+				   const struct object_id *tree_oid, int collect_all)
 {
 	struct strbuf buf = STRBUF_INIT;
 	struct strbuf unquoted = STRBUF_INIT;
@@ -89,7 +90,7 @@ static void check_attr_stdin_paths(const char *prefix,
 				die("line is badly quoted");
 			strbuf_swap(&buf, &unquoted);
 		}
-		check_attr(prefix, check, collect_all, buf.buf);
+		check_attr(prefix, check, tree_oid, collect_all, buf.buf);
 		maybe_flush_or_die(stdout, "attribute to stdout");
 	}
 	strbuf_release(&buf);
@@ -105,6 +106,8 @@ static NORETURN void error_with_usage(const char *msg)
 int cmd_check_attr(int argc, const char **argv, const char *prefix)
 {
 	struct attr_check *check;
+	struct object_id *tree_oid = NULL;
+	struct object_id initialized_oid;
 	int cnt, i, doubledash, filei;
 
 	if (!is_bare_repository())
@@ -176,11 +179,17 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
 		}
 	}
 
+	if (source) {
+		if (repo_get_oid_tree(the_repository, source, &initialized_oid))
+			die("%s: not a valid tree-ish source", source);
+		tree_oid = &initialized_oid;
+	}
+
 	if (stdin_paths)
-		check_attr_stdin_paths(prefix, check, all_attrs);
+		check_attr_stdin_paths(prefix, check, tree_oid, all_attrs);
 	else {
 		for (i = filei; i < argc; i++)
-			check_attr(prefix, check, all_attrs, argv[i]);
+			check_attr(prefix, check, tree_oid, all_attrs, argv[i]);
 		maybe_flush_or_die(stdout, "attribute to stdout");
 	}
 
builtin/pack-objects.c +1 -1
index 573d0b20b7..89535cfa6a 100644
@@ -1318,7 +1318,7 @@ static int no_try_delta(const char *path)
 
 	if (!check)
 		check = attr_check_initl("delta", NULL);
-	git_check_attr(the_repository->index, path, check);
+	git_check_attr(the_repository->index, NULL, path, check);
 	if (ATTR_FALSE(check->items[0].value))
 		return 1;
 	return 0;
convert.c +1 -1
index 9b67649032..a54d1690c0 100644
@@ -1308,7 +1308,7 @@ void convert_attrs(struct index_state *istate,
 		git_config(read_convert_config, NULL);
 	}
 
-	git_check_attr(istate, path, check);
+	git_check_attr(istate, NULL, path, check);
 	ccheck = check->items;
 	ca->crlf_action = git_path_check_crlf(ccheck + 4);
 	if (ca->crlf_action == CRLF_UNDEFINED)
ll-merge.c +2 -2
index 22a603e8af..130d26501c 100644
@@ -391,7 +391,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf,
 		normalize_file(theirs, path, istate);
 	}
 
-	git_check_attr(istate, path, check);
+	git_check_attr(istate, NULL, path, check);
 	ll_driver_name = check->items[0].value;
 	if (check->items[1].value) {
 		marker_size = atoi(check->items[1].value);
@@ -419,7 +419,7 @@ int ll_merge_marker_size(struct index_state *istate, const char *path)
 
 	if (!check)
 		check = attr_check_initl("conflict-marker-size", NULL);
-	git_check_attr(istate, path, check);
+	git_check_attr(istate, NULL, path, check);
 	if (check->items[0].value) {
 		marker_size = atoi(check->items[0].value);
 		if (marker_size <= 0)
pathspec.c +1 -1
index 46e77a85fe..48dec2c709 100644
@@ -732,7 +732,7 @@ int match_pathspec_attrs(struct index_state *istate,
 	if (name[namelen])
 		name = to_free = xmemdupz(name, namelen);
 
-	git_check_attr(istate, name, item->attr_check);
+	git_check_attr(istate, NULL, name, item->attr_check);
 
 	free(to_free);
 
t/t0003-attributes.sh +40 -1

78 lines not on this page · raw message

userdiff.c +1 -1
index 151d9a5278..b66f090a0b 100644
@@ -412,7 +412,7 @@ struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
 		check = attr_check_initl("diff", NULL);
 	if (!path)
 		return NULL;
-	git_check_attr(istate, path, check);
+	git_check_attr(istate, NULL, path, check);
 
 	if (ATTR_TRUE(check->items[0].value))
 		return &driver_true;
ws.c +1 -1
index 6e69877f25..eadbbe5667 100644
@@ -78,7 +78,7 @@ unsigned whitespace_rule(struct index_state *istate, const char *pathname)
 	if (!attr_whitespace_rule)
 		attr_whitespace_rule = attr_check_initl("whitespace", NULL);
 
-	git_check_attr(istate, pathname, attr_whitespace_rule);
+	git_check_attr(istate, NULL, pathname, attr_whitespace_rule);
 	value = attr_whitespace_rule->items[0].value;
 	if (ATTR_TRUE(value)) {
 		/* true (whitespace) */
Signature · 1 line
2.39.0
#1 lore raw

v6 cover check-attr: add support to work with tree-ish

In reply to a message not in the archive

v1: https://lore.kernel.org/git/[email protected]/
v2: https://lore.kernel.org/git/CAOLa=ZSsFGBw3ta1jWN8cmUch2ca=zTEjp1xMA6Linafx9W53g@mail.gmail.com/T/#t
v3: https://lore.kernel.org/git/[email protected]/
v4: https://lore.kernel.org/git/[email protected]
v5: https://lore.kernel.org/git/[email protected]/

Given a pathname, git-check-attr(1) will list the attributes which apply to that pathname by reading all relevant gitattributes files. Currently there is no way to specify a tree-ish to read the gitattributes from.

This is specifically useful in bare repositories wherein the gitattributes are only present in the git working tree but not available directly on the filesystem.

This series aims to add a new flag --source to git-check-attr(1) which allows us to read gitattributes from the specified tree-ish.

Changes since v5:
- Changed the documentation and helper code to say 'tree-ish' instead of 'tree'
- Fixed broken tests because of missing &&

Range-diff against v5:

1:  6224754179 = 1:  6224754179 t0003: move setup for `--all` into new block
2:  d835d989ad ! 2:  57f5957127 attr: add flag `--source` to work with tree-ish
    @@ Documentation/git-check-attr.txt: git-check-attr - Display gitattributes informa
      [verse]
     -'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
     -'git check-attr' --stdin [-z] [-a | --all | <attr>...]
    -+'git check-attr' [--source <tree>] [-a | --all | <attr>...] [--] <pathname>...
    -+'git check-attr' --stdin [-z] [--source <tree>] [-a | --all | <attr>...]
    ++'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
    ++'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
      
      DESCRIPTION
      -----------
    @@ Documentation/git-check-attr.txt: OPTIONS
      	If `--stdin` is also given, input paths are separated
      	with a NUL character instead of a linefeed character.
      
    -+--source=<tree>::
    -+	Check attributes against the specified tree-ish. Paths provided as part
    -+	of the revision will be treated as the root directory. It is common to
    ++--source=<tree-ish>::
    ++	Check attributes against the specified tree-ish. It is common to
     +	specify the source tree by naming a commit, branch or tag associated
     +	with it.
     +
    @@ attr.c: void git_check_attr(struct index_state *istate,
      		const char *name = check->all_attrs[i].attr->name;
     
      ## attr.h ##
    +@@
    + #ifndef ATTR_H
    + #define ATTR_H
    + 
    ++#include "hash.h"
    ++
    + /**
    +  * gitattributes mechanism gives a uniform way to associate various attributes
    +  * to set of paths.
     @@ attr.h: void attr_check_free(struct attr_check *check);
      const char *git_attr_name(const struct git_attr *);
      
    @@ builtin/check-attr.c
      static const char * const check_attr_usage[] = {
     -N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
     -N_("git check-attr --stdin [-z] [-a | --all | <attr>...]"),
    -+N_("git check-attr [--source <tree>] [-a | --all | <attr>...] [--] <pathname>..."),
    -+N_("git check-attr --stdin [-z] [--source <tree>] [-a | --all | <attr>...]"),
    ++N_("git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>..."),
    ++N_("git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"),
      NULL
      };
      
    @@ t/t0003-attributes.sh: attr_check_quote () {
      
     +	git $git_opts check-attr --source $source test -- "$path" >actual 2>err &&
     +	echo "$path: test: $expect" >expect &&
    -+	test_cmp expect actual
    ++	test_cmp expect actual &&
     +	test_must_be_empty err
      }
      
    @@ t/t0003-attributes.sh: test_expect_success 'setup' '
      
     +test_expect_success 'setup branches' '
     +	mkdir -p foo/bar &&
    -+	test_commit --printf "add .gitattributes" foo/bar/.gitattribute \
    ++	test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
     +		"f test=f\na/i test=n\n" tag-1 &&
    -+
    -+	mkdir -p foo/bar &&
    -+	test_commit --printf "add .gitattributes" foo/bar/.gitattribute \
    -+		"g test=g\na/i test=m\n" tag-2
    ++	test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
    ++		"g test=g\na/i test=m\n" tag-2 &&
    ++	rm foo/bar/.gitattributes
     +'
     +
      test_expect_success 'command line checks' '

Karthik Nayak (2):
t0003: move setup for --all into new block
attr: add flag --source to work with tree-ish

 Documentation/git-check-attr.txt |  9 ++-
 archive.c                        |  2 +-
 attr.c                           | 97 +++++++++++++++++++++++---------
 attr.h                           |  7 ++-
 builtin/check-attr.c             | 35 +++++++-----
 builtin/pack-objects.c           |  2 +-
 convert.c                        |  2 +-
 ll-merge.c                       |  4 +-
 pathspec.c                       |  2 +-
 t/t0003-attributes.sh            | 48 +++++++++++++++-
 userdiff.c                       |  2 +-
 ws.c                             |  2 +-
 12 files changed, 157 insertions(+), 55 deletions(-)
Signature · 1 line
2.39.0
#6 lore raw

Re: [PATCH v6 0/2] check-attr: add support to work with tree-ish

Hi Karthik

Quoted 93 lines · Karthik Nayak

v1: https://lore.kernel.org/git/[email protected]/
v2: https://lore.kernel.org/git/CAOLa=ZSsFGBw3ta1jWN8cmUch2ca=zTEjp1xMA6Linafx9W53g@mail.gmail.com/T/#t
v3: https://lore.kernel.org/git/[email protected]/
v4: https://lore.kernel.org/git/[email protected]
v5: https://lore.kernel.org/git/[email protected]/

Given a pathname, git-check-attr(1) will list the attributes which apply to that pathname by reading all relevant gitattributes files. Currently there is no way to specify a tree-ish to read the gitattributes from.

This is specifically useful in bare repositories wherein the gitattributes are only present in the git working tree but not available directly on the filesystem.

This series aims to add a new flag --source to git-check-attr(1) which allows us to read gitattributes from the specified tree-ish.

Changes since v5:
- Changed the documentation and helper code to say 'tree-ish' instead of 'tree'
- Fixed broken tests because of missing &&

Range-diff against v5:

1:  6224754179 = 1:  6224754179 t0003: move setup for `--all` into new block
2:  d835d989ad ! 2:  57f5957127 attr: add flag `--source` to work with tree-ish
     @@ Documentation/git-check-attr.txt: git-check-attr - Display gitattributes informa
       [verse]
      -'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
      -'git check-attr' --stdin [-z] [-a | --all | <attr>...]
     -+'git check-attr' [--source <tree>] [-a | --all | <attr>...] [--] <pathname>...
     -+'git check-attr' --stdin [-z] [--source <tree>] [-a | --all | <attr>...]
     ++'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
     ++'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
       
       DESCRIPTION
       -----------
     @@ Documentation/git-check-attr.txt: OPTIONS
       	If `--stdin` is also given, input paths are separated
       	with a NUL character instead of a linefeed character.
       
     -+--source=<tree>::
     -+	Check attributes against the specified tree-ish. Paths provided as part
     -+	of the revision will be treated as the root directory. It is common to
     ++--source=<tree-ish>::
     ++	Check attributes against the specified tree-ish. It is common to
      +	specify the source tree by naming a commit, branch or tag associated
      +	with it.
      +
     @@ attr.c: void git_check_attr(struct index_state *istate,
       		const char *name = check->all_attrs[i].attr->name;
      
       ## attr.h ##
     +@@
     + #ifndef ATTR_H
     + #define ATTR_H
     +
     ++#include "hash.h"
     ++
     + /**
     +  * gitattributes mechanism gives a uniform way to associate various attributes
     +  * to set of paths.
      @@ attr.h: void attr_check_free(struct attr_check *check);
       const char *git_attr_name(const struct git_attr *);
       
     @@ builtin/check-attr.c
       static const char * const check_attr_usage[] = {
      -N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
      -N_("git check-attr --stdin [-z] [-a | --all | <attr>...]"),
     -+N_("git check-attr [--source <tree>] [-a | --all | <attr>...] [--] <pathname>..."),
     -+N_("git check-attr --stdin [-z] [--source <tree>] [-a | --all | <attr>...]"),
     ++N_("git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>..."),
     ++N_("git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"),
       NULL
       };
       
     @@ t/t0003-attributes.sh: attr_check_quote () {
       
      +	git $git_opts check-attr --source $source test -- "$path" >actual 2>err &&
      +	echo "$path: test: $expect" >expect &&
     -+	test_cmp expect actual
     ++	test_cmp expect actual &&
      +	test_must_be_empty err
       }
       
     @@ t/t0003-attributes.sh: test_expect_success 'setup' '
       
      +test_expect_success 'setup branches' '
      +	mkdir -p foo/bar &&
     -+	test_commit --printf "add .gitattributes" foo/bar/.gitattribute \
     ++	test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
      +		"f test=f\na/i test=n\n" tag-1 &&
     -+
     -+	mkdir -p foo/bar &&
Quoted 8 lines
     -+	test_commit --printf "add .gitattributes" foo/bar/.gitattribute \
     -+		"g test=g\na/i test=m\n" tag-2
     ++	test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
     ++		"g test=g\na/i test=m\n" tag-2 &&
     ++	rm foo/bar/.gitattributes
      +'
      +
       test_expect_success 'command line checks' '

The changes in the range-diff look good - this version addresses all of my previous comments - thanks.

Best Wishes

Phillip

Quoted 18 lines

Karthik Nayak (2):
t0003: move setup for --all into new block
attr: add flag --source to work with tree-ish

  Documentation/git-check-attr.txt |  9 ++-
  archive.c                        |  2 +-
  attr.c                           | 97 +++++++++++++++++++++++---------
  attr.h                           |  7 ++-
  builtin/check-attr.c             | 35 +++++++-----
  builtin/pack-objects.c           |  2 +-
  convert.c                        |  2 +-
  ll-merge.c                       |  4 +-
  pathspec.c                       |  2 +-
  t/t0003-attributes.sh            | 48 +++++++++++++++-
  userdiff.c                       |  2 +-
  ws.c                             |  2 +-
  12 files changed, 157 insertions(+), 55 deletions(-)
#4 lore raw

Re: [PATCH v6 2/2] attr: add flag `--source` to work with tree-ish

In reply to Karthik Nayak

attr.h line 4

Quoted 9 lines · Karthik Nayak
attr.h +1 -0
index 3fb40cced0..f4a2bedd68 100644
@@ -1,6 +1,8 @@
 #ifndef ATTR_H
 #define ATTR_H
 
+#include "hash.h"

You only want "struct object_id" declared. Why include the whole file?

#5 lore raw

Re: [PATCH v6 2/2] attr: add flag `--source` to work with tree-ish

Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Karthik Nayak
attr.h +0 -0
index 3fb40cced0..f4a2bedd68 100644
@@ -1,6 +1,8 @@
 #ifndef ATTR_H
 #define ATTR_H
 
Quoted 4 lines

attr.h line 4

Quoted 1 line
attr.h +1 -0
+#include "hash.h"

You only want "struct object_id" declared. Why include the whole file?

I see, I should have just used your patch, will add this and Ævar's
[0] suggestion and do a quick re-roll. Thanks!

[0]: https://lore.kernel.org/git/[email protected]/