builtin-replace: teach "git replace" to actually replace

Teach the syntax: "git replace <object> <replacement>", so that
"git replace" can now create replace refs. These replace refs
will be used by read_sha1_file to substitute <object> with
<replacement> for most of the commands.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder
2009-02-02 06:12:53 +01:00
committed by Junio C Hamano
parent 54b0c1e041
commit bebdd271ff
2 changed files with 59 additions and 1 deletions

View File

@ -114,9 +114,19 @@ test_expect_success '"git replace" listing and deleting' '
test_must_fail git replace -d &&
test_must_fail git replace -l -d $HASH2 &&
git replace -d $HASH2 &&
git show $HASH2 | grep "A U Thor" &&
test -z "$(git replace -l)"
'
test_expect_success '"git replace" replacing' '
git replace $HASH2 $R &&
git show $HASH2 | grep "O Thor" &&
test_must_fail git replace $HASH2 $R &&
git replace -f $HASH2 $R &&
test_must_fail git replace -f &&
test "$HASH2" = "$(git replace)"
'
#
#
test_done