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

[PATCH v2 2/6] git-submodule.sh: rename unused variables

From
Stefan Beller <sbeller@google.com>
Date
Jul 17, 2018, 00:26 UTC
Message-ID
<20180717002654.120375-3-sbeller@google.com>
In-Reply-To
<20180717002654.120375-1-sbeller@google.com>

The 'mode' variable is not used in cmd_update for its original purpose, rename it to 'dummy' as it only serves the purpose to abort quickly documenting this knowledge.

The variable 'stage' is also not used any more in cmd_update, so remove it.

This went unnoticed as first each function used the commonly used submodule listing, which was converted in 74703a1e4df (submodule: rewrite `module_list` shell function in C, 2015-09-02). When cmd_update was using its own function starting in 48308681b07 (git submodule update: have a dedicated helper for cloning, 2016-02-29), its removal was missed.

A later patch in this series also touches the communication between the submodule helper and git-submodule.sh, but let's have this as a preparatory patch, as it eases the next patch, which stores the raw data instead of the line printed for this communication.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/submodule--helper.c | 5 ++---
 git-submodule.sh            | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 20ae9191ca3..ebcfe85bfa9 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1571,9 +1571,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
 	needs_cloning = !file_exists(sb.buf);
 
 	strbuf_reset(&sb);
-	strbuf_addf(&sb, "%06o %s %d %d\t%s\n", ce->ce_mode,
-			oid_to_hex(&ce->oid), ce_stage(ce),
-			needs_cloning, ce->name);
+	strbuf_addf(&sb, "dummy %s %d\t%s\n",
+		    oid_to_hex(&ce->oid), needs_cloning, ce->name);
 	string_list_append(&suc->projectlines, sb.buf);
 
 	if (!needs_cloning)
diff --git a/git-submodule.sh b/git-submodule.sh
index 8a611865397..56588aa304d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -531,9 +531,9 @@ cmd_update()
 		"$@" || echo "#unmatched" $?
 	} | {
 	err=
-	while read -r mode sha1 stage just_cloned sm_path
+	while read -r quickabort sha1 just_cloned sm_path
 	do
-		die_if_unmatched "$mode" "$sha1"
+		die_if_unmatched "$quickabort" "$sha1"
 
 		name=$(git submodule--helper name "$sm_path") || exit
 		if ! test -z "$update"
-- 
2.18.0.203.gfac676dfb9-goog
Previous: Stefan BellerNext: Stefan Beller
Message 3 of 20 in “git-submodule.sh: convert part of cmd_update to C”
  1. 0/6 git-submodule.sh: convert part of cmd_update to CStefan Beller, Jul 17, 2018
  2. 1/6 git-submodule.sh: align error reporting for update mode to use pathStefan Beller, Jul 17, 2018
  3. 2/6 git-submodule.sh: rename unused variablesStefan Beller, Jul 17, 2018
  4. 3/6 builtin/submodule--helper: factor out submodule updatingStefan Beller, Jul 17, 2018
  5. 4/6 builtin/submodule--helper: store update_clone information in a structStefan Beller, Jul 17, 2018
  6. 5/6 builtin/submodule--helper: factor out method to update a single submoduleStefan Beller, Jul 17, 2018
  7. 6/6 submodule--helper: introduce new update-module-mode helperStefan Beller, Jul 17, 2018
  8. SZEDER GáborJul 17, 2018
  9. Junio C HamanoJul 17, 2018
  10. Junio C HamanoJul 17, 2018
  11. Stefan BellerJul 17, 2018
  12. Eric SunshineJul 17, 2018
  13. Stefan BellerJul 18, 2018
  14. Eric SunshineJul 18, 2018
  15. Junio C HamanoJul 18, 2018
  16. Junio C HamanoJul 17, 2018
  17. Stefan BellerJul 17, 2018
  18. Junio C HamanoJul 17, 2018
  19. Johannes SchindelinJul 26, 2018
  20. Stefan BellerJul 26, 2018

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.