Skip to content

Commit

Permalink
tag -d: print sha1 of deleted tag
Browse files Browse the repository at this point in the history
Print the sha1 of the deleted tag (in addition to the tag name) so that
one can easily recreate a mistakenly deleted tag:

git tag -d tagname
Deleted tag 'tagname' (was DEADBEEF)
git tag 'tagname' DEADBEEF

We output the previous ref also in the case of forcefully overwriting
tags.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Suggested-by: Jari Aalto <jari.aalto@cante.net>
Helped-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Zoltán Füzesi <zfuzesi@eaglet.hu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and gitster committed Dec 11, 2009
1 parent 80d9361 commit 0a043b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin-tag.c
Expand Up @@ -140,7 +140,7 @@ static int delete_tag(const char *name, const char *ref,
{
if (delete_ref(ref, sha1, 0))
return 1;
printf("Deleted tag '%s'\n", name);
printf("Deleted tag '%s' (was %s)\n", name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
return 0;
}

Expand Down Expand Up @@ -479,6 +479,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
die("%s: cannot lock the ref", ref);
if (write_ref_sha1(lock, object, NULL) < 0)
die("%s: cannot update the ref", ref);
if (force && hashcmp(prev, object))
printf("Updated tag '%s' (was %s)\n", tag, find_unique_abbrev(prev, DEFAULT_ABBREV));

strbuf_release(&buf);
return 0;
Expand Down

0 comments on commit 0a043b1

Please sign in to comment.