Skip to content

Commit f7722a4

Browse files
committed
Merge branch 'jc/add-u-A-default-to-top'
"git --literal-pathspecs add -u/-A" without any command line argument misbehaved ever since Git 2.0. * jc/add-u-A-default-to-top: add: simplify -u/-A without pathspec
2 parents 908700c + 29abb33 commit f7722a4

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

builtin/add.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
336336
if (!show_only && ignore_missing)
337337
die(_("Option --ignore-missing can only be used together with --dry-run"));
338338

339-
if ((0 < addremove_explicit || take_worktree_changes) && !argc) {
340-
static const char *whole[2] = { ":/", NULL };
341-
argc = 1;
342-
argv = whole;
343-
}
344-
345339
add_new_files = !take_worktree_changes && !refresh_only;
346-
require_pathspec = !take_worktree_changes;
340+
require_pathspec = !(take_worktree_changes || (0 < addremove_explicit));
347341

348342
hold_locked_index(&lock_file, 1);
349343

t/t2200-add-update.sh

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ test_expect_success 'non-qualified update in subdir updates from the root' '
8484
(
8585
cd dir1 &&
8686
echo even more >>sub2 &&
87+
git --literal-pathspecs add -u &&
88+
echo even more >>sub2 &&
8789
git add -u
8890
) &&
8991
: >expect &&

t/t2202-add-addremove.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test_expect_success setup '
1414
echo expect
1515
echo ignored
1616
) >.gitignore &&
17+
git --literal-pathspecs add --all &&
1718
>will-remove &&
1819
git add --all &&
1920
test_tick &&

0 commit comments

Comments
 (0)