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

[PATCH 1/3] submodule: convert stage_updated_gitmodules to take a struct index_state

From
BWBrandon Williams <bmwill@google.com>
Date
Dec 12, 2017, 19:53 UTC
Message-ID
<20171212195352.146675-2-bmwill@google.com>
In-Reply-To
<20171212195352.146675-1-bmwill@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
---
 builtin/mv.c | 2 +-
 builtin/rm.c | 2 +-
 submodule.c  | 4 ++--
 submodule.h  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c
index ffdd5f01a..cf3684d90 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -291,7 +291,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	}
 
 	if (gitmodules_modified)
-		stage_updated_gitmodules();
+		stage_updated_gitmodules(&the_index);
 
 	if (active_cache_changed &&
 	    write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
diff --git a/builtin/rm.c b/builtin/rm.c
index d91451fea..4a2fcca27 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -382,7 +382,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 		}
 		strbuf_release(&buf);
 		if (gitmodules_modified)
-			stage_updated_gitmodules();
+			stage_updated_gitmodules(&the_index);
 	}
 
 	if (active_cache_changed) {
diff --git a/submodule.c b/submodule.c
index 95e6aff2b..7097be806 100644
--- a/submodule.c
+++ b/submodule.c
@@ -143,9 +143,9 @@ int remove_path_from_gitmodules(const char *path)
 	return 0;
 }
 
-void stage_updated_gitmodules(void)
+void stage_updated_gitmodules(struct index_state *istate)
 {
-	if (add_file_to_cache(GITMODULES_FILE, 0))
+	if (add_file_to_index(istate, GITMODULES_FILE, 0))
 		die(_("staging updated .gitmodules failed"));
 }
 
diff --git a/submodule.h b/submodule.h
index f0da0277a..cd984ecba 100644
--- a/submodule.h
+++ b/submodule.h
@@ -37,7 +37,7 @@ extern int is_gitmodules_unmerged(const struct index_state *istate);
 extern int is_staging_gitmodules_ok(const struct index_state *istate);
 extern int update_path_in_gitmodules(const char *oldpath, const char *newpath);
 extern int remove_path_from_gitmodules(const char *path);
-extern void stage_updated_gitmodules(void);
+extern void stage_updated_gitmodules(struct index_state *istate);
 extern void set_diffopt_flags_from_submodule_config(struct diff_options *,
 		const char *path);
 extern int git_default_submodule_config(const char *var, const char *value, void *cb);
-- 
2.15.1.504.g5279b80103-goog
Previous: Brandon WilliamsNext: Brandon Williams
Message 2 of 8 in “convert submodule.c to not use the index compat macros”
  1. 0/3 convert submodule.c to not use the index compat macrosBrandon Williams, Dec 12, 2017
  2. 1/3 submodule: convert stage_updated_gitmodules to take a struct index_stateBrandon Williams, Dec 12, 2017
  3. 2/3 submodule: used correct index in is_staging_gitmodules_okBrandon Williams, Dec 12, 2017
  4. Eric SunshineDec 12, 2017
  5. 3/3 submodule: convert get_next_submodule to not rely on the_indexBrandon Williams, Dec 12, 2017
  6. Stefan BellerDec 12, 2017
  7. Junio C HamanoDec 12, 2017
  8. Junio C HamanoDec 12, 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.