]> Pileus Git - ~andy/git/commitdiff
builtin/replace: unset read_replace_refs
authorChristian Couder <chriscool@tuxfamily.org>
Wed, 11 Dec 2013 07:46:12 +0000 (08:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Dec 2013 19:53:49 +0000 (11:53 -0800)
When checking to see if some objects are of the same type
and when displaying the type of objects, git replace uses
the sha1_object_info() function.

Unfortunately this function by default respects replace
refs, so instead of the type of a replaced object, it
gives the type of the replacement object which might
be different.

To fix this bug, and because git replace should work at a
level before replacement takes place, let's unset the
read_replace_refs global variable at the beginning of
cmd_replace().

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/replace.c
t/t6050-replace.sh

index 9f3619a1bfdcd05494d531acad516720868f9e4f..1672870e8107aef416d75a31a93753b6ff9a6b93 100644 (file)
@@ -174,6 +174,8 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
+       read_replace_refs = 0;
+
        argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
 
        if (list && delete)
index e1cc3b89dadf3577fa97cfda04925c8e63d56f6d..d0c62f7539f4c1d7e8c3ac39938d287b03ad4c28 100755 (executable)
@@ -306,7 +306,7 @@ test_expect_success 'test --format medium' '
        test_cmp expected actual
 '
 
-test_expect_failure 'test --format full' '
+test_expect_success 'test --format full' '
        {
                echo "$H1 (commit) -> $BLOB (blob)" &&
                echo "$BLOB (blob) -> $REPLACED (blob)" &&