git-add: Add support for --refresh option.

This allows to refresh only a subset of the project files, based on
the specified pathspecs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Alexandre Julliard
2007-08-11 23:59:01 +02:00
committed by Junio C Hamano
parent 77b258f436
commit d616813d75
5 changed files with 51 additions and 5 deletions

View File

@ -143,4 +143,16 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st
git ls-files --stage | grep "^120000 .* 0 symlink$"
'
test_expect_success 'git add --refresh' '
>foo && git add foo && git commit -a -m "commit all" &&
test -z "`git diff-index HEAD -- foo`" &&
git read-tree HEAD &&
case "`git diff-index HEAD -- foo`" in
:100644" "*"M foo") echo ok;;
*) echo fail; (exit 1);;
esac &&
git add --refresh -- foo &&
test -z "`git diff-index HEAD -- foo`"
'
test_done