Skip to contentSkip to conversation

attr: fix instructions on how to check attrs

PATCH Superseded John Cai via GitGitGadget 3 participants 6 messages Jan 22, 2023 – Jan 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 attr: fix instructions on how to check attrs

From: John Cai <[email protected]>

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

---
attr: fix instructions on how to check attrs

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1441%2Fjohn-cai%2Fjc%2Ffix-attr-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1441/john-cai/jc/fix-attr-docs-v1
Pull-Request: https://github.com/git/git/pull/1441

 attr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
attr.h +1 -1
index 2f22dffadb3..47f1111f391 100644
@@ -45,7 +45,7 @@
  * const char *path;
  *
  * setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, path, check);
  * ------------
  *
  * - Act on `.value` member of the result, left in `check->items[]`:

base-commit: 904d404274fef6695c78a6b055edd184b72e2f9b

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 6 lines · John Cai via GitGitGadget

From: John Cai <[email protected]>

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

Sounds quite sensible. It would have been very good to explain some research in the above, like

When 7a400a2c (attr: remove an implicit dependency on the_index, 2018-08-13) started passing an index_state instance to git_check_attr(), it forgot to update the API documentation that was in Documentation/technical/api-gitattributes.txt. Later, 3a1b3415 (attr: move doc to attr.h, 2019-11-17) moved the API documentation to attr.h and made it to a comment, without realizing the earlier mistake.

or something like that.

Thanks.

Quoted 15 lines
attr.h +1 -1
index 2f22dffadb3..47f1111f391 100644
@@ -45,7 +45,7 @@
  * const char *path;
  *
  * setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, path, check);
  * ------------
  *
  * - Act on `.value` member of the result, left in `check->items[]`:

base-commit: 904d404274fef6695c78a6b055edd184b72e2f9b

#2 lore raw

Hi Junio,

Quoted 20 lines · Junio C Hamano
Quoted 6 lines · John Cai via GitGitGadget

From: John Cai <[email protected]>

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

Sounds quite sensible. It would have been very good to explain some research in the above, like

When 7a400a2c (attr: remove an implicit dependency on the_index, 2018-08-13) started passing an index_state instance to git_check_attr(), it forgot to update the API documentation that was in Documentation/technical/api-gitattributes.txt. Later, 3a1b3415 (attr: move doc to attr.h, 2019-11-17) moved the API documentation to attr.h and made it to a comment, without realizing the earlier mistake.

Quoted 1 line

or something like that.

good tip about including some history. I'll include that in the re-roll

thanks!

Quoted 18 lines

Thanks.

Quoted 15 lines
attr.h +1 -1
index 2f22dffadb3..47f1111f391 100644
@@ -45,7 +45,7 @@
  * const char *path;
  *
  * setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, path, check);
  * ------------
  *
  * - Act on `.value` member of the result, left in `check->items[]`:

base-commit: 904d404274fef6695c78a6b055edd184b72e2f9b

#3 lore raw

PATCH v2 1/1 attr: fix instructions on how to check attrs

In reply to John Cai via GitGitGadget

From: John Cai <[email protected]>

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr().

When 7a400a2c (attr: remove an implicit dependency on the_index, 2018-08-13) started passing an index_state instance to git_check_attr(), it forgot to update the API documentation in Documentation/technical/api-gitattributes.txt. Later, 3a1b3415 (attr: move doc to attr.h, 2019-11-17) moved the API documentation to attr.h as a comment, but still left out the index_state as an argument.

Fix this to make the documentation in the comment consistent with the actual function signature.

---
attr: fix instructions on how to check attrs

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

Changes since V1:

* updated commit message to include some history

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1441%2Fjohn-cai%2Fjc%2Ffix-attr-docs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1441/john-cai/jc/fix-attr-docs-v2
Pull-Request: https://github.com/git/git/pull/1441

Range-diff vs v1:

1: 63bb84db487 ! 1: 8cfee55e48f attr: fix instructions on how to check attrs
@@ Commit message
attr: fix instructions on how to check attrs

The instructions in attr.h describing what functions to call to check
- attributes is missing the index as the first argument to git_check_attr.
+ attributes is missing the index as the first argument to
+ git_check_attr().

- Fix this to make it consistent with the actual function signature.
+ When 7a400a2c (attr: remove an implicit dependency on the_index,
+ 2018-08-13) started passing an index_state instance to git_check_attr(),
+ it forgot to update the API documentation in
+ Documentation/technical/api-gitattributes.txt. Later, 3a1b3415
+ (attr: move doc to attr.h, 2019-11-17) moved the API documentation to
+ attr.h as a comment, but still left out the index_state as an argument.
+
+ Fix this to make the documentation in the comment consistent with the
+ actual function signature.

 attr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
attr.h +1 -1
index 2f22dffadb3..47f1111f391 100644
@@ -45,7 +45,7 @@
  * const char *path;
  *
  * setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, path, check);
  * ------------
  *
  * - Act on `.value` member of the result, left in `check->items[]`:

base-commit: 904d404274fef6695c78a6b055edd184b72e2f9b

Signature · 1 line
gitgitgadget
#4 lore raw

PATCH v3 1/1 attr: fix instructions on how to check attrs

From: John Cai <[email protected]>

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr(), as well as tree_oid as the second argument.

When 7a400a2c (attr: remove an implicit dependency on the_index, 2018-08-13) started passing an index_state instance to git_check_attr(), it forgot to update the API documentation in Documentation/technical/api-gitattributes.txt. Later, 3a1b3415 (attr: move doc to attr.h, 2019-11-17) moved the API documentation to attr.h as a comment, but still left out the index_state as an argument.

In 47cfc9b (attr: add flag --source to work with tree-ish 2023-01-14) added tree_oid as an optional parameter but was not added to the docs in attr.h

Fix this to make the documentation in the comment consistent with the actual function signature.

---
attr: fix instructions on how to check attrs

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to git_check_attr.

Fix this to make it consistent with the actual function signature.

Changes since V2:

* updated with adding second argument after rebasing against master

Changes since V1:

* updated commit message to include some history

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1441%2Fjohn-cai%2Fjc%2Ffix-attr-docs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1441/john-cai/jc/fix-attr-docs-v3
Pull-Request: https://github.com/git/git/pull/1441

Range-diff vs v2:

1: 8cfee55e48f ! 1: cf6f456af47 attr: fix instructions on how to check attrs
@@ Commit message

The instructions in attr.h describing what functions to call to check attributes is missing the index as the first argument to
- git_check_attr().
+ git_check_attr(), as well as tree_oid as the second argument.

When 7a400a2c (attr: remove an implicit dependency on the_index, 2018-08-13) started passing an index_state instance to git_check_attr(),
@@ Commit message
(attr: move doc to attr.h, 2019-11-17) moved the API documentation to attr.h as a comment, but still left out the index_state as an argument.

+ In 47cfc9b (attr: add flag --source to work with tree-ish 2023-01-14)
+ added tree_oid as an optional parameter but was not added to the docs in
+ attr.h
+
Fix this to make the documentation in the comment consistent with the actual function signature.

@@ attr.h
*
* setup_check();
- * git_check_attr(path, check);
-+ * git_check_attr(&the_index, path, check);
++ * git_check_attr(&the_index, tree_oid, path, check);
* ------------
*
* - Act on .value member of the result, left in check->items[]:

 attr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
attr.h +1 -1
index 58a2bc1344f..9884ea2bc60 100644
@@ -45,7 +45,7 @@
  * const char *path;
  *
  * setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, tree_oid, path, check);
  * ------------
  *
  * - Act on `.value` member of the result, left in `check->items[]`:

base-commit: 5dec958dcf965fc75e0f459f8e8ccf9c9f495b15

Signature · 1 line
gitgitgadget
#5 lore raw
Quoted 3 lines · John Cai via GitGitGadget

Changes since V2:

* updated with adding second argument after rebasing against master

Ahh, thanks for being so careful. I forgot all about that other topic changing the function signature.