All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Enter interactive mode if no parameters are given to git-add
Date: Tue, 19 Dec 2006 15:16:09 +0000	[thread overview]
Message-ID: <200612191516.09606.andyparkins@gmail.com> (raw)

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

             reply	other threads:[~2006-12-19 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 15:16 Andy Parkins [this message]
2006-12-19 16:42 ` [PATCH] Enter interactive mode if no parameters are given to git-add Jakub Narebski
2006-12-19 18:00 ` Junio C Hamano
2006-12-19 19:04   ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612191516.09606.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.