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

[PATCH] Enter interactive mode if no parameters are given to git-add

From
APAndy Parkins <andyparkins@gmail.com>
Date
Dec 19, 2006, 15:16 UTC
Message-ID
<200612191516.09606.andyparkins@gmail.com>

git-add with no parameters previously adds every modified file. This patch instead makes git-add enter interactive mode.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
This patch is against pu.

It seemed a bit nasty to add content without explicit instructions to do so. Instead, just drop into interactive mode, which they can easily get out of if it was all a big accident, and additionally is quicker than typing --interactive.

 builtin-add.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index aa2f0f3..52a63a0 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -96,10 +96,12 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		if (!strcmp("--interactive", argv[i]))
 			add_interactive++;
 	}
+	if (argc == 1)
+		add_interactive++;
 	if (add_interactive) {
 		const char *args[] = { "add--interactive", NULL };
 
-		if (add_interactive != 1 || argc != 2)
+		if (add_interactive != 1 || argc > 2)
 			die("add --interactive does not take any parameters");
 		execv_git_cmd(args);
 		exit(1);
-- 
1.4.4.2.g95ee-dirty
Next: Jakub Narebski
Message 1 of 4 in “Enter interactive mode if no parameters are given to git-add”
  1. Enter interactive mode if no parameters are given to git-addAndy Parkins, Dec 19, 2006
  2. Jakub NarebskiDec 19, 2006
  3. Junio C HamanoDec 19, 2006
  4. Linus TorvaldsDec 19, 2006

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.