summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a3e8267)
raw | patch | inline | side by side (parent: a3e8267)
author | Christian Couder <chriscool@tuxfamily.org> | |
Fri, 23 Jan 2009 09:07:26 +0000 (10:07 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 1 Jun 2009 00:02:59 +0000 (17:02 -0700) |
Otherwise we get a "sha1 mismatch" error for replaced objects.
Note that I am not sure at all that this is a good change.
It may be that we should just refuse to tag a replaced object. But
in this case we should probably give a meaningfull error message
instead of "sha1 mismatch".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Note that I am not sure at all that this is a good change.
It may be that we should just refuse to tag a replaced object. But
in this case we should probably give a meaningfull error message
instead of "sha1 mismatch".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mktag.c | patch | blob | history | |
t/t6050-replace.sh | patch | blob | history |
index 99a356e9ee75cb247d80ed6dc0b251ceb0bd9e46..6e0b5feaeef8db05fa1dcc2d54be8f1b0a9dac73 100644 (file)
--- a/mktag.c
+++ b/mktag.c
/*
* We refuse to tag something we can't verify. Just because.
*/
-static int verify_object(unsigned char *sha1, const char *expected_type)
+static int verify_object(const unsigned char *sha1, const char *expected_type)
{
int ret = -1;
enum object_type type;
unsigned long size;
- void *buffer = read_sha1_file(sha1, &type, &size);
+ const unsigned char *repl;
+ void *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);
if (buffer) {
if (type == type_from_string(expected_type))
- ret = check_sha1_signature(sha1, buffer, size, expected_type);
+ ret = check_sha1_signature(repl, buffer, size, expected_type);
free(buffer);
}
return ret;
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index 0a585ecda72487ab2917bfdee7e1004223ef6cdb..334aed621681365725650c9b8e47034fe4e5feb7 100755 (executable)
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
git show $HASH2 | grep "O Thor"
'
+cat >tag.sig <<EOF
+object $HASH2
+type commit
+tag mytag
+tagger T A Gger <> 0 +0000
+
+EOF
+
+test_expect_success 'tag replaced commit' '
+ git mktag <tag.sig >.git/refs/tags/mytag 2>message
+'
+
#
#
test_done