git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH] tag: display original sha1 of deleted/overwritten tag

From
ZFZoltán Füzesi <zfuzesi@eaglet.hu>
Date
Dec 10, 2009, 12:34 UTC
Message-ID
<1260448496-527-1-git-send-email-zfuzesi@eaglet.hu>
It makes possible to undo accidental tag deletion and overwriting.
Signed-off-by: Zoltán Füzesi <zfuzesi@eaglet.hu>
---
This patch was created in response to this feature request:
http://article.gmane.org/gmane.comp.version-control.git/135016
I named it "RFC" because of the overwriting part.
 builtin-tag.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index c479018..8dca364 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -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' %s\n", name, sha1_to_hex(sha1));
 	return 0;
 }
 
@@ -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);
+	else if (force && hashcmp(object, prev))
+		printf("Overwritten tag '%s' (%s)\n", ref, sha1_to_hex(prev));
 
 	strbuf_release(&buf);
 	return 0;
-- 
1.6.6.rc2
Next: Zoltán Füzesi
Message 1 of 4 in “tag: display original sha1 of deleted/overwritten tag”
  1. tag: display original sha1 of deleted/overwritten tagZoltán Füzesi, Dec 10, 2009
  2. tag: display original sha1 of deleted/overwritten tagZoltán Füzesi, Dec 10, 2009
  3. tag: display original sha1 of deleted/overwritten tagZoltán Füzesi, Dec 10, 2009
  4. Zoltán FüzesiDec 10, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.