1. Stefan Saasen
  2. git


Junio C Hamano  committed f899e5a Merge

Merge branch 'jc/add-delete-default' into pu

"git add dir/" updated modified files and added new files, but does
not notice removed files, which may be "Huh?" to some users. They
can of course use "git add -A dir/", but why should they?

Resurrected from graveyard, as I thought it was a worthwhile thing
to do in the longer term.

Stalled mostly due to lack of responses.

* jc/add-delete-default:
git add: notice removal of tracked paths by default

  • Participants
  • Parent commits 428b99d, 0b3f34e
  • Branches pu

Comments (0)

Files changed (2)

File builtin/add.c

View file
  • Ignore whitespace
 	if (addremove && take_worktree_changes)
 		die(_("-A and -u are mutually incompatible"));
+	/* default "git add pathspec..." to "git add -A pathspec..." */
+	if (!take_worktree_changes && argc)
+		addremove = 1;
 	if (!show_only && ignore_missing)
 		die(_("Option --ignore-missing can only be used together with --dry-run"));
 	if (addremove) {

File t/t2200-add-update.sh

View file
  • Ignore whitespace
 	echo 2 >path3 &&
 	echo 2 >path5 &&
-	# Explicit resolving by adding removed paths should fail
-	test_must_fail git add path4 &&
-	test_must_fail git add path6 &&
 	# "add -u" should notice removals no matter what stages
 	# the index entries are in.
 	git add -u &&