{"thread":{"id":"33081","subject":"[PATCH] add: cut redundant require_pathspec logic","startedAt":"2013-03-06T07:24:21Z","lastAt":"2013-03-06T07:24:21Z","messageCount":1,"participants":["Greg Price"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"210673","messageId":"20130306072414.GA15534@biohazard-cafe.mit.edu","threadId":"33081","inReplyTo":null,"subject":"[PATCH] add: cut redundant require_pathspec logic","fromName":"Greg Price","fromEmail":"price@mit.edu","sentAt":"2013-03-06T07:24:21Z","receivedAt":"2013-03-06T07:24:21Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"If take_worktree_changes is true, then the logic around\noption_with_implicit_dot ensures argc is positive by this point.\nSo require_pathspec never has an effect.\n\nSigned-off-by: Greg Price <price@mit.edu>\n---\n builtin/add.c | 4 +---\n 1 file changed, 1 insertion(+), 3 deletions(-)\n\ndiff --git a/builtin/add.c b/builtin/add.c\nindex 0dd014e..9feb2ba 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -358,7 +358,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \tstruct dir_struct dir;\n \tint flags;\n \tint add_new_files;\n-\tint require_pathspec;\n \tchar *seen = NULL;\n \tconst char *option_with_implicit_dot = NULL;\n \tconst char *short_option_with_implicit_dot = NULL;\n@@ -399,7 +398,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \t}\n \n \tadd_new_files = !take_worktree_changes && !refresh_only;\n-\trequire_pathspec = !take_worktree_changes;\n \n \tnewfd = hold_locked_index(&lock_file, 1);\n \n@@ -410,7 +408,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)\n \t\t (!(addremove || take_worktree_changes)\n \t\t  ? ADD_CACHE_IGNORE_REMOVAL : 0));\n \n-\tif (require_pathspec && argc == 0) {\n+\tif (argc == 0) {\n \t\tfprintf(stderr, _(\"Nothing specified, nothing added.\\n\"));\n \t\tfprintf(stderr, _(\"Maybe you wanted to say 'git add .'?\\n\"));\n \t\treturn 0;\n-- \n1.7.11.3\n"}]}