git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin/fetch: print hash of deleted tag when updating
@ 2010-09-26 16:10 Knittl
  2010-09-26 21:41 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Knittl @ 2010-09-26 16:10 UTC (permalink / raw)
  To: git

>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!

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-10 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 16:10 [PATCH] builtin/fetch: print hash of deleted tag when updating Knittl
2010-09-26 21:41 ` Junio C Hamano
2010-09-27  7:09   ` Knittl
2010-09-27 11:37   ` Peter Kjellerstedt
2010-09-27 16:38     ` Junio C Hamano
2010-10-10 13:17       ` Knittl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).