git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Price <price@MIT.EDU>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] add: cut redundant require_pathspec logic
Date: Wed, 6 Mar 2013 02:24:21 -0500	[thread overview]
Message-ID: <20130306072414.GA15534@biohazard-cafe.mit.edu> (raw)

If take_worktree_changes is true, then the logic around
option_with_implicit_dot ensures argc is positive by this point.
So require_pathspec never has an effect.

Signed-off-by: Greg Price <price@mit.edu>
---
 builtin/add.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 0dd014e..9feb2ba 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -358,7 +358,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	struct dir_struct dir;
 	int flags;
 	int add_new_files;
-	int require_pathspec;
 	char *seen = NULL;
 	const char *option_with_implicit_dot = NULL;
 	const char *short_option_with_implicit_dot = NULL;
@@ -399,7 +398,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	}
 
 	add_new_files = !take_worktree_changes && !refresh_only;
-	require_pathspec = !take_worktree_changes;
 
 	newfd = hold_locked_index(&lock_file, 1);
 
@@ -410,7 +408,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		 (!(addremove || take_worktree_changes)
 		  ? ADD_CACHE_IGNORE_REMOVAL : 0));
 
-	if (require_pathspec && argc == 0) {
+	if (argc == 0) {
 		fprintf(stderr, _("Nothing specified, nothing added.\n"));
 		fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n"));
 		return 0;
-- 
1.7.11.3

                 reply	other threads:[~2013-03-06  7:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130306072414.GA15534@biohazard-cafe.mit.edu \
    --to=price@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).