Commits

Anonymous committed bb0c806 Merge

Merge branch 'maint-1.6.3' into maint

* maint-1.6.3:
add -p: do not attempt to coalesce mode changes
git add -p: demonstrate failure when staging both mode and hunk

  • Participants
  • Parent commits d9b9784, 9e4a90b

Comments (0)

Files changed (2)

git-add--interactive.perl

 	my ($last_o_ctx, $last_was_dirty);
 
 	for (grep { $_->{USE} } @in) {
+		if ($_->{TYPE} ne 'hunk') {
+			push @out, $_;
+			next;
+		}
 		my $text = $_->{TEXT};
 		my ($o_ofs) = parse_hunk_header($text->[0]);
 		if (defined $last_o_ctx &&

t/t3701-add-interactive.sh

 	git diff          file | grep "+content"
 '
 
+
+test_expect_success FILEMODE 'stage mode and hunk' '
+	git reset --hard &&
+	echo content >>file &&
+	chmod +x file &&
+	printf "y\\ny\\n" | git add -p &&
+	git diff --cached file | grep "new mode" &&
+	git diff --cached file | grep "+content" &&
+	test -z "$(git diff file)"
+'
+
 # end of tests disabled when filemode is not usable
 
 test_expect_success 'setup again' '