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

[PATCH] builtin/fetch: print hash of deleted tag when updating

From
Knittl <knittl89@googlemail.com>
Date
Sep 26, 2010, 16:10 UTC
Message-ID
<AANLkTi=KVDRzE3-NW+GTO_CL-KtNZ+BjkErgNKMPPtGf@mail.gmail.com>
>From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Date: Sun, 26 Sep 2010 11:29:16 +0200
Subject: [PATCH] builtin/fetch: print hash of deleted tag when updating

`git fetch --tags` will unconditionally update (and thus overwrite) existing tags, which is especially annoying for annotated and signed tags.

Print the hash of the deleted tag so users can manually recover their tags from such an update.

Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
---
 builtin/fetch.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 6fc5047..3c2eac4 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -253,9 +253,10 @@ static int update_local_ref(struct ref *ref,
 	    !prefixcmp(ref->name, "refs/tags/")) {
 		int r;
 		r = s_update_ref("updating tag", ref, 0);
-		sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
+		sprintf(display, "%c %-*s %-*s -> %s%s (was %s)", r ? '!' : '-',
 			TRANSPORT_SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
-			pretty_ref, r ? "  (unable to update local ref)" : "");
+			pretty_ref, r ? "  (unable to update local ref)" : "",
+			find_unique_abbrev(ref->old_sha1, DEFAULT_ABBREV));
 		return r;
 	}
-- 
1.7.3.68.gb1c2b


-- 
typed with http://neo-layout.org
myFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!
Next: Junio C Hamano
Message 1 of 6 in “builtin/fetch: print hash of deleted tag when updating”
  1. builtin/fetch: print hash of deleted tag when updatingKnittl, Sep 26, 2010
  2. Junio C HamanoSep 26, 2010
  3. KnittlSep 27, 2010
  4. Peter KjellerstedtSep 27, 2010
  5. Junio C HamanoSep 27, 2010
  6. KnittlOct 10, 2010

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.