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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001
From: Daniel Knittl-Frank <knittl89+git@xxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxx>
---
 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!
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]