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

[PATCH] refs.h: rename submodule arguments to submodule_path

From
Stefan Beller <sbeller@google.com>
Date
Apr 12, 2017, 20:00 UTC
Message-ID
<20170412200037.18752-1-sbeller@google.com>

In submodule land we carefully need to distinguish between the path of a submodule and its name.

The path of a submodule is the path that is recorded in the working tree of the superproject and describes where the submodule is bound to the superprojects tree.

The name as introduced in 941987a554 (git-submodule: give submodules proper names, 2007-06-11) exists to track submodules across renames of submodules. It is also used for the internal path in .git/modules/<name> to store the git directory of the submodule inside the superproject.

When looking up ref functions to use, I was confused which of the two submodule properties are meant in the argument of the ref functions. The context in which the functions were used however revealed it is the path of the submodules.

Rename the arguments to clearly describe what is expected as an input argument.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 refs.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/refs.h b/refs.h
index 3df0d45ebb..451f92958a 100644
--- a/refs.h
+++ b/refs.h
@@ -86,7 +86,7 @@ int peel_ref(const char *refname, unsigned char *sha1);
  * successful, return 0 and set sha1 to the name of the object;
  * otherwise, return a non-zero value.
  */
-int resolve_gitlink_ref(const char *submodule, const char *refname,
+int resolve_gitlink_ref(const char *submodule_path, const char *refname,
 			unsigned char *sha1);
 
 /*
@@ -204,16 +204,16 @@ int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data);
 int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
 			 const char *prefix, void *cb_data);
 
-int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data);
-int for_each_ref_submodule(const char *submodule,
+int head_ref_submodule(const char *submodule_path, each_ref_fn fn, void *cb_data);
+int for_each_ref_submodule(const char *submodule_path,
 			   each_ref_fn fn, void *cb_data);
-int for_each_ref_in_submodule(const char *submodule, const char *prefix,
+int for_each_ref_in_submodule(const char *submodule_path, const char *prefix,
 		each_ref_fn fn, void *cb_data);
-int for_each_tag_ref_submodule(const char *submodule,
+int for_each_tag_ref_submodule(const char *submodule_path,
 			       each_ref_fn fn, void *cb_data);
-int for_each_branch_ref_submodule(const char *submodule,
+int for_each_branch_ref_submodule(const char *submodule_path,
 				  each_ref_fn fn, void *cb_data);
-int for_each_remote_ref_submodule(const char *submodule,
+int for_each_remote_ref_submodule(const char *submodule_path,
 				  each_ref_fn fn, void *cb_data);
 
 int head_ref_namespaced(each_ref_fn fn, void *cb_data);
-- 
2.12.2.603.g7b28dc31ba
Next: Stefan Beller
Message 1 of 6 in “refs.h: rename submodule arguments to submodule_path”
  1. refs.h: rename submodule arguments to submodule_pathStefan Beller, Apr 12, 2017
  2. Stefan BellerApr 20, 2017
  3. Junio C HamanoApr 21, 2017
  4. Michael HaggertyApr 21, 2017
  5. Michael HaggertyApr 21, 2017
  6. Duy NguyenApr 21, 2017

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.