From: Junio C Hamano Date: Tue, 10 May 2011 05:51:13 GMT Subject: [PATCH 4/9] add ":" is a pathspec that is too wide Message-ID: <1305006678-4051-5-git-send-email-gitster@pobox.com> In-Reply-To: <1305006678-4051-1-git-send-email-gitster@pobox.com> "git cmd :" should be exactly the same as "git cmd" run from the root level of the working tree. "git add" without any pathspec should not add anything. Signed-off-by: Junio C Hamano --- builtin/add.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index e127d5a..43a8aad 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -406,12 +406,12 @@ 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) { + pathspec = validate_pathspec(argc, argv, prefix); + if (require_pathspec && (!argc || !pathspec)) { fprintf(stderr, "Nothing specified, nothing added.\n"); fprintf(stderr, "Maybe you wanted to say 'git add .'?\n"); return 0; } - pathspec = validate_pathspec(argc, argv, prefix); if (read_cache() < 0) die("index file corrupt"); -- 1.7.5.1.290.g1b565