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

[PATCH] make commit --interactive lock index

From
Paolo Bonzini <bonzini@gnu.org>
Date
May 29, 2008, 08:09 UTC
Message-ID
<E1K1eXH-00063c-Bt@fencepost.gnu.org>

I noticed that the way "git commit --interactive" sets up the commit is different from the way a normal "git commit" does it. Commit 2888605c changed one, but not the other. This makes the behavior equivalent in the two cases.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
---
 builtin-commit.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
	I am sending this patch for review as I don't know if it's
	necessary.  The code is a tad cleaner, but it does cause more
	system calls in the commit --interactive case, because of the
	additional read of the index.
	The assert tests that, in the interactive case, we'll go down to
	the COMMIT_ASIS case.
	The patch is on top of the previous change I sent for signal
	handling in git-commit.
diff --git a/builtin-commit.c b/builtin-commit.c
index ef8b1f0..5a5f9a3 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -219,13 +219,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 	struct path_list partial;
 	const char **pathspec = NULL;
 
-	if (interactive) {
+	if (interactive)
 		interactive_add(argc, argv, prefix);
-		if (read_cache() < 0)
-			die("index file corrupt");
-		commit_style = COMMIT_AS_IS;
-		return get_index_file();
-	}
 
 	if (read_cache() < 0)
 		die("index file corrupt");
@@ -233,6 +228,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 	if (*argv)
 		pathspec = get_pathspec(prefix, argv);
 
+	assert (!(interactive && pathspec && *pathspec));
+
 	signal (SIGINT, rollback_on_signal);
 	signal (SIGHUP, rollback_on_signal);
 	signal (SIGTERM, rollback_on_signal);
-- 
1.5.5
Next: Johannes Schindelin
Message 1 of 12 in “make commit --interactive lock index”
  1. make commit --interactive lock indexPaolo Bonzini, May 29, 2008
  2. Johannes SchindelinMay 29, 2008
  3. Paolo BonziniMay 29, 2008
  4. Johannes SchindelinMay 29, 2008
  5. Paolo BonziniMay 29, 2008
  6. Alex RiesenMay 29, 2008
  7. Paolo BonziniMay 29, 2008
  8. Alex RiesenMay 29, 2008
  9. Paolo BonziniMay 29, 2008
  10. Junio C HamanoMay 30, 2008
  11. Paolo BonziniMay 30, 2008
  12. Paolo BonziniJun 2, 2008

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.