{"thread":{"id":"25251","subject":"[PATCH] builtin/fetch: print hash of deleted tag when updating","startedAt":"2010-09-26T16:10:47Z","lastAt":"2010-10-10T13:17:01Z","messageCount":6,"participants":["Knittl","Junio C Hamano","Peter Kjellerstedt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"151726","messageId":"AANLkTi=KVDRzE3-NW+GTO_CL-KtNZ+BjkErgNKMPPtGf@mail.gmail.com","threadId":"25251","inReplyTo":null,"subject":"[PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2010-09-26T16:10:47Z","receivedAt":"2010-09-26T16:10:47Z","isPatch":true,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":">From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001\nFrom: Daniel Knittl-Frank <knittl89+git@googlemail.com>\nDate: Sun, 26 Sep 2010 11:29:16 +0200\nSubject: [PATCH] builtin/fetch: print hash of deleted tag when updating\n\n`git fetch --tags` will unconditionally update (and thus overwrite)\nexisting tags, which is especially annoying for annotated and signed\ntags.\n\nPrint the hash of the deleted tag so users can manually\nrecover their tags from such an update.\n\nSigned-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>\n---\n builtin/fetch.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 6fc5047..3c2eac4 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -253,9 +253,10 @@ static int update_local_ref(struct ref *ref,\n \t    !prefixcmp(ref->name, \"refs/tags/\")) {\n \t\tint r;\n \t\tr = s_update_ref(\"updating tag\", ref, 0);\n-\t\tsprintf(display, \"%c %-*s %-*s -> %s%s\", r ? '!' : '-',\n+\t\tsprintf(display, \"%c %-*s %-*s -> %s%s (was %s)\", r ? '!' : '-',\n \t\t\tTRANSPORT_SUMMARY_WIDTH, \"[tag update]\", REFCOL_WIDTH, remote,\n-\t\t\tpretty_ref, r ? \"  (unable to update local ref)\" : \"\");\n+\t\t\tpretty_ref, r ? \"  (unable to update local ref)\" : \"\",\n+\t\t\tfind_unique_abbrev(ref->old_sha1, DEFAULT_ABBREV));\n \t\treturn r;\n \t}\n\n-- \n1.7.3.68.gb1c2b\n\n\n-- \ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"},{"id":"151750","messageId":"7vsk0wmbcd.fsf@alter.siamese.dyndns.org","threadId":"25251","inReplyTo":"AANLkTi=KVDRzE3-NW+GTO_CL-KtNZ+BjkErgNKMPPtGf@mail.gmail.com","subject":"Re: [PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-26T21:41:38Z","receivedAt":"2010-09-26T21:41:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Knittl <knittl89@googlemail.com> writes:\n\n> From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001\n> From: Daniel Knittl-Frank <knittl89+git@googlemail.com>\n> Date: Sun, 26 Sep 2010 11:29:16 +0200\n> Subject: [PATCH] builtin/fetch: print hash of deleted tag when updating\n>\n> `git fetch --tags` will unconditionally update (and thus overwrite)\n> existing tags, which is especially annoying for annotated and signed\n> tags.\n\nThe first question is why s/he is running fetch with --tags if overwriting\nis unwelcome/annoying.  \"--tags\" is meant to be used when the auto-follow\nbehaviour of normal fetch is not sufficient and the user actively wants to\nget the latest (potentially updated) ones; would it be possible that you\nare solving a wrong problem?\n"},{"id":"151798","messageId":"AANLkTinrx-S-6FpLAOnAVWk4gRH8sHStqDf973TZkseG@mail.gmail.com","threadId":"25251","inReplyTo":"7vsk0wmbcd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2010-09-27T07:09:19Z","receivedAt":"2010-09-27T07:09:19Z","isPatch":true,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":"On Sun, Sep 26, 2010 at 11:41 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Knittl <knittl89@googlemail.com> writes:\n>\n>> From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001\n>> From: Daniel Knittl-Frank <knittl89+git@googlemail.com>\n>> Date: Sun, 26 Sep 2010 11:29:16 +0200\n>> Subject: [PATCH] builtin/fetch: print hash of deleted tag when updating\n>>\n>> `git fetch --tags` will unconditionally update (and thus overwrite)\n>> existing tags, which is especially annoying for annotated and signed\n>> tags.\n>\n> The first question is why s/he is running fetch with --tags if overwriting\n> is unwelcome/annoying.  \"--tags\" is meant to be used when the auto-follow\n> behaviour of normal fetch is not sufficient and the user actively wants to\n> get the latest (potentially updated) ones; would it be possible that you\n> are solving a wrong problem?\n\nyes, i know that tags are only overwritten with `git fetch --tags` and\nnot during normal fetch operations. nevertheless, manually looking at\ntags and find the ones which would be overwritten is cumbersome and\nerrorprone.\n\nimho this patch doesn't hurt, only adding \"(was $HASH)\" -- and in case\na user decides, that he suddenly wants to keep one of his (updated)\ntags, he can recover them quickly by echoing the hash into\n.git/refs/tags/new-name-for-my-tag. otherwise the use would have to\nrun git fsck and find dangling hashes.\n\nagain, i'm not changing behavior of `git fetch --tags`, i'm simply\nproviding additional output to help you recover your own tags. case:\npossibly conflicting tags and you want to 'merge' your tags with\nupstream tags.\n\nif you deem it unnecessary, ok, nothing i can do about that ;)\n\n-- \ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"},{"id":"151813","messageId":"A612847CFE53224C91B23E3A5B48BAC749BFD33D90@xmail3.se.axis.com","threadId":"25251","inReplyTo":"7vsk0wmbcd.fsf@alter.siamese.dyndns.org","subject":"RE: [PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Peter Kjellerstedt","fromEmail":"peter.kjellerstedt@axis.com","sentAt":"2010-09-27T11:37:08Z","receivedAt":"2010-09-27T11:37:08Z","isPatch":true,"sender":{"key":"peter.kjellerstedt@axis.com","avatar":"https://gravatar.com/avatar/6d5a0182283c8eccd7b134a54dbfd5f30038f3ad4d38b96f424884b614a61ca2?d=mp&s=160"},"body":"> -----Original Message-----\n> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n> Behalf Of Junio C Hamano\n> Sent: den 26 september 2010 23:42\n> To: Knittl\n> Cc: git@vger.kernel.org\n> Subject: Re: [PATCH] builtin/fetch: print hash of deleted tag when\n> updating\n> \n> Knittl <knittl89@googlemail.com> writes:\n> \n> > From b1c2b07aa1f5db25ebdf190aa12ccb66a17f131a Mon Sep 17 00:00:00 2001\n> > From: Daniel Knittl-Frank <knittl89+git@googlemail.com>\n> > Date: Sun, 26 Sep 2010 11:29:16 +0200\n> > Subject: [PATCH] builtin/fetch: print hash of deleted tag when updating\n> >\n> > `git fetch --tags` will unconditionally update (and thus overwrite)\n> > existing tags, which is especially annoying for annotated and signed\n> > tags.\n> \n> The first question is why s/he is running fetch with --tags if overwriting\n> is unwelcome/annoying.\n\nMaybe because the user is a git newbie who has just started to \nlearn her first git commands and found --tags in the manual page, \nthinking \"oh, nice, this will make sure I get all tags\". Or because \nshe added it to remote.<name>.tagopt without knowing that it would \noverwrite tags in this way.\n\n> \"--tags\" is meant to be used when the auto-follow\n> behaviour of normal fetch is not sufficient and the user actively wants to\n> get the latest (potentially updated) ones;\n\nIf that (i.e., potentially updated) is the intention, it is not \nmentioned in the manual page for fetch. Further, reading \"On \nRe-tagging\" in the manual page for git tag, it says \"Git does not \n(and it should not) change tags behind users back\" (which I agree\nwith) but it seems contrary to what --tags does...\n\nShouldn't this behavior of --tags require --force to keep in line \nwith what is described in git tag's manual page? If not, a big\nwarning sign is needed in the manual page description of --tags.\n\n> would it be possible that you are solving a wrong problem?\n\nSince git reflog does not support showing how a tag has changed, \nI think something like Daniel's patch is a good idea, as the \nalternative is to use git fsck and start digging...\n\n//Peter\n"},{"id":"151842","messageId":"7vfwwv2lb4.fsf@alter.siamese.dyndns.org","threadId":"25251","inReplyTo":"A612847CFE53224C91B23E3A5B48BAC749BFD33D90@xmail3.se.axis.com","subject":"Re: [PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-27T16:38:55Z","receivedAt":"2010-09-27T16:38:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Peter Kjellerstedt <peter.kjellerstedt@axis.com> writes:\n\n> Shouldn't this behavior of --tags require --force to keep in line \n> with what is described in git tag's manual page?\n\nSounds sensible, if nobody is already relying on this behaviour.\n"},{"id":"153130","messageId":"AANLkTi=VX4gF1jOb_NbzFqwxX4vJaSrmJ29GjnQpUicO@mail.gmail.com","threadId":"25251","inReplyTo":"7vfwwv2lb4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] builtin/fetch: print hash of deleted tag when updating","fromName":"Knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2010-10-10T13:17:01Z","receivedAt":"2010-10-10T13:17:01Z","isPatch":true,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":"On Mon, Sep 27, 2010 at 6:38 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Peter Kjellerstedt <peter.kjellerstedt@axis.com> writes:\n>\n>> Shouldn't this behavior of --tags require --force to keep in line\n>> with what is described in git tag's manual page?\n>\n> Sounds sensible, if nobody is already relying on this behaviour.\n\nany updates on this one?\n\neven if we require the --force option it wouldn't hurt if we displayed\nthe old hash, does it?\n\n\n-- \ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"}]}