{"thread":{"id":"31461","subject":"gitk does not reload tag messages","startedAt":"2012-09-06T18:17:52Z","lastAt":"2012-09-12T12:37:56Z","messageCount":8,"participants":["Tim McCormack","David Aguilar","Junio C Hamano","Paul Mackerras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"198471","messageId":"MTAwMDAxMC50aW1tYw.1346955478@quikprotect","threadId":"31461","inReplyTo":null,"subject":"gitk does not reload tag messages","fromName":"Tim McCormack","fromEmail":"cortex@brainonfire.net","sentAt":"2012-09-06T18:17:52Z","receivedAt":"2012-09-06T18:17:52Z","isPatch":false,"sender":{"key":"cortex@brainonfire.net","avatar":null},"body":"If a tag that gitk knows about is deleted and recreated with a\ndifferent message, gitk still shows the old message after any\ncombination of refresh, reload, and reread refs.\n\ngit-gui version 0.13.0.8.g8f85\n\nReproduce:\n1. git tag -a test -m \"foo\" HEAD\n2. Open gitk, see that correct message (\"foo\") is present for tag \"test\"\n3. git tag -d test\n4. Reload/refresh gitk [optional, it won't make a difference]\n5. git tag -a test -m \"bar\" HEAD\n6. Reload/refresh gitk\n7. See that the message on tag \"test\" is still \"foo\"\n8. $ git show test # shows correct message \"bar\"\n\nApologies if this is an old version or a known bug; I could not find an\nissue tracker to search, although I did check the gmane archives.\n\n - Tim McCormack\n"},{"id":"198501","messageId":"CAJDDKr7AJ4Mrw8_wsB9WSqPT8sBca8FmBGHoq2Ay_ivLyUyAGg@mail.gmail.com","threadId":"31461","inReplyTo":"MTAwMDAxMC50aW1tYw.1346955478@quikprotect","subject":"Re: gitk does not reload tag messages","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-09-07T03:08:26Z","receivedAt":"2012-09-07T03:08:26Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Sep 6, 2012 at 11:17 AM, Tim McCormack <cortex@brainonfire.net> wrote:\n> If a tag that gitk knows about is deleted and recreated with a\n> different message, gitk still shows the old message after any\n> combination of refresh, reload, and reread refs.\n>\n> git-gui version 0.13.0.8.g8f85\n>\n> Reproduce:\n> 1. git tag -a test -m \"foo\" HEAD\n> 2. Open gitk, see that correct message (\"foo\") is present for tag \"test\"\n> 3. git tag -d test\n> 4. Reload/refresh gitk [optional, it won't make a difference]\n> 5. git tag -a test -m \"bar\" HEAD\n> 6. Reload/refresh gitk\n> 7. See that the message on tag \"test\" is still \"foo\"\n> 8. $ git show test # shows correct message \"bar\"\n>\n> Apologies if this is an old version or a known bug; I could not find an\n> issue tracker to search, although I did check the gmane archives.\n\nTags in git are meant to be immutable.  You can delete them, but you shouldn't.\nThat's not really how they are intended to be used.\n\ngitk avoids re-reading that information because the normal,\ntypical use case is that the tag messages do not change.\n\nIt would probably be a performance regression to \"fix\" this.\nIn which case, IMO it's not a bug.\n-- \nDavid\n"},{"id":"198502","messageId":"7vligmz9zc.fsf@alter.siamese.dyndns.org","threadId":"31461","inReplyTo":"CAJDDKr7AJ4Mrw8_wsB9WSqPT8sBca8FmBGHoq2Ay_ivLyUyAGg@mail.gmail.com","subject":"Re: gitk does not reload tag messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-07T05:18:47Z","receivedAt":"2012-09-07T05:18:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> Tags in git are meant to be immutable.  You can delete them, but\n> you shouldn't.  That's not really how they are intended to be\n> used.\n>\n> gitk avoids re-reading that information because the normal,\n> typical use case is that the tag messages do not change.\n>\n> It would probably be a performance regression to \"fix\" this.\n\nThe reasoning behind your argument, i.e. the first paragraph, is\ncorrect, and I agree that it certainly easier to implement a \"read\nonce and assume it won't change.\"\n\nBut wouldn't it be OK for an explicit user action to cause reload of\nthe contents?\n\nI just did this in my git.git tree:\n\n    1. Start \"gitk\". The branch checked out is 'master', and it\n       shows the v1.7.12 tag somewhere in the recent past.\n\n    2. Click on v1.7.12; its contents and my signature is visible.\n\n    3. \"git tag -f -m 'Fake v1.7.12' v1.7.12 master\". Don't worry, I\n       have backups everywhere ;-)\n\n    4. Of course, nothing changes in \"gitk\".  I wouldn't expect a\n       magic.\n\n    5. File -> Reread references.  This correctly moves the flag\n       labelled as v1.7.12 in the history graph.\n\n    6. After clicking on some random commit (to view its message)\n       click v1.7.12 tag.  The original contents, not the \"Fake\" one\n       is shown.\n\n       Would it really be too much work to run \"cat-file\" at this\n       point?  I think the earlier \"File -> Reread references\" is a\n       strong enough clue the user gave \"gitk\" that something have\n       changed, and I think it currently uses this clue to purge the\n       cached mapping between refname and commit.\n\n       Perhaps it can and should purge the cached tag object\n       contents as well? The worst that can happen is when the user\n       clicks a tag, we would need to read the tag object.\n\n    7. File -> Reload.  Even this does not seem to purge the cached\n       tag contents, even though it seems to redraw the whole\n       history.\n\nNote that if I swap the order of step #2 and step #3, I see the\n\"Fake\" message; I think we are reading the contents of the tag on\ndemand.  I think the problem is just the contents, once read, seem\nto be forever cached.\n\nIt may just be the matter of something like this.\n\n gitk | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git i/gitk w/gitk\nindex 22270ce..6abe240 100755\n--- i/gitk\n+++ w/gitk\n@@ -10599,7 +10599,7 @@ proc movedhead {hid head} {\n }\n \n proc changedrefs {} {\n-    global cached_dheads cached_dtags cached_atags\n+    global cached_dheads cached_dtags cached_atags tagcontents\n     global arctags archeads arcnos arcout idheads idtags\n \n     foreach id [concat [array names idheads] [array names idtags]] {\n@@ -10611,6 +10611,7 @@ proc changedrefs {} {\n \t    }\n \t}\n     }\n+    catch {unset tagcontents}\n     catch {unset cached_dtags}\n     catch {unset cached_atags}\n     catch {unset cached_dheads}\n"},{"id":"198579","messageId":"1347130993-69863-1-git-send-email-davvid@gmail.com","threadId":"31461","inReplyTo":"7vligmz9zc.fsf@alter.siamese.dyndns.org","subject":"[PATCH] gitk: Teach \"Reread references\" to reload tags","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-09-08T19:03:13Z","receivedAt":"2012-09-08T19:03:13Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Tag contents, once read, are forever cached in memory.\nThis makes gitk unable to notice when tag contents change.\n\nAllow users to cause a reload of the tag contents by using\nthe \"File->Reread references\" action.\n\nReported-by: Tim McCormack <cortex@brainonfire.net>\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 9bba9aa..a124822 100755\n--- a/gitk\n+++ b/gitk\n@@ -10599,7 +10599,7 @@ proc movedhead {hid head} {\n }\n \n proc changedrefs {} {\n-    global cached_dheads cached_dtags cached_atags\n+    global cached_dheads cached_dtags cached_atags tagcontents\n     global arctags archeads arcnos arcout idheads idtags\n \n     foreach id [concat [array names idheads] [array names idtags]] {\n@@ -10611,6 +10611,7 @@ proc changedrefs {} {\n \t    }\n \t}\n     }\n+    catch {unset tagcontents}\n     catch {unset cached_dtags}\n     catch {unset cached_atags}\n     catch {unset cached_dheads}\n-- \n1.7.7.2.448.gee6df\n"},{"id":"198584","messageId":"1347133996-70908-1-git-send-email-davvid@gmail.com","threadId":"31461","inReplyTo":"1347130993-69863-1-git-send-email-davvid@gmail.com","subject":"[PATCH] gitk: Rename 'tagcontents' to 'cached_tagcontent'","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-09-08T19:53:16Z","receivedAt":"2012-09-08T19:53:16Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Name the 'tagcontents' variable similarly to the rest of the\nvariables cleared in the changedrefs() function.\n\nThis makes the naming consistent and provides a hint that it\nshould be cleared when reloading gitk's cache.\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n\nFollow-up to 'gitk: Teach \"Reread references\" to reload tags'\n\n gitk |   14 +++++++-------\n 1 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex a124822..6f24f53 100755\n--- a/gitk\n+++ b/gitk\n@@ -10599,7 +10599,7 @@ proc movedhead {hid head} {\n }\n \n proc changedrefs {} {\n-    global cached_dheads cached_dtags cached_atags tagcontents\n+    global cached_dheads cached_dtags cached_atags cached_tagcontent\n     global arctags archeads arcnos arcout idheads idtags\n \n     foreach id [concat [array names idheads] [array names idtags]] {\n@@ -10611,7 +10611,7 @@ proc changedrefs {} {\n \t    }\n \t}\n     }\n-    catch {unset tagcontents}\n+    catch {unset cached_tagcontent}\n     catch {unset cached_dtags}\n     catch {unset cached_atags}\n     catch {unset cached_dheads}\n@@ -10664,7 +10664,7 @@ proc listrefs {id} {\n }\n \n proc showtag {tag isnew} {\n-    global ctext tagcontents tagids linknum tagobjid\n+    global ctext cached_tagcontent tagids linknum tagobjid\n \n     if {$isnew} {\n \taddtohistory [list showtag $tag 0] savectextpos\n@@ -10673,13 +10673,13 @@ proc showtag {tag isnew} {\n     clear_ctext\n     settabs 0\n     set linknum 0\n-    if {![info exists tagcontents($tag)]} {\n+    if {![info exists cached_tagcontent($tag)]} {\n \tcatch {\n-           set tagcontents($tag) [exec git cat-file tag $tag]\n+           set cached_tagcontent($tag) [exec git cat-file tag $tag]\n \t}\n     }\n-    if {[info exists tagcontents($tag)]} {\n-\tset text $tagcontents($tag)\n+    if {[info exists cached_tagcontent($tag)]} {\n+\tset text $cached_tagcontent($tag)\n     } else {\n \tset text \"[mc \"Tag\"]: $tag\\n[mc \"Id\"]:  $tagids($tag)\"\n     }\n-- \n1.7.7.2.448.gee6df\n"},{"id":"198595","messageId":"7v392ru6ex.fsf@alter.siamese.dyndns.org","threadId":"31461","inReplyTo":"1347133996-70908-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH] gitk: Rename 'tagcontents' to 'cached_tagcontent'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-09T05:11:34Z","receivedAt":"2012-09-09T05:11:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've applied these two, on top of Paul's master branch at\n\n    git://ozlabs.org/~paulus/gitk.git\n\nand tentatively queued in 'pu', but I would prefer to see it\neyeballed by and queued in his tree first.\n\nThanks.\n"},{"id":"198819","messageId":"7v8vcffv93.fsf@alter.siamese.dyndns.org","threadId":"31461","inReplyTo":"7v392ru6ex.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] gitk: Rename 'tagcontents' to 'cached_tagcontent'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-12T09:25:28Z","receivedAt":"2012-09-12T09:25:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I've applied these two, on top of Paul's master branch at\n>\n>     git://ozlabs.org/~paulus/gitk.git\n>\n> and tentatively queued in 'pu', but I would prefer to see it\n> eyeballed by and queued in his tree first.\n>\n> Thanks.\n\nPinging Paul...\n\nThe following changes since commit a135f214e371311f13807da637d492fd9642a2e3:\n\n  gitk: Avoid Meta1-F5 (2012-04-25 13:44:31 +1000)\n\nare available in the git repository at:\n\n  git://github.com/gitster/git da/gitk-reload-tag-contents\n\nfor you to fetch changes up to 587277fea3bf3bfc4302480178bd88a277a69f05:\n\n  gitk: Rename 'tagcontents' to 'cached_tagcontent' (2012-09-08 20:25:09 -0700)\n\n----------------------------------------------------------------\nDavid Aguilar (2):\n      gitk: Teach \"Reread references\" to reload tags\n      gitk: Rename 'tagcontents' to 'cached_tagcontent'\n\n gitk | 13 +++++++------\n 1 file changed, 7 insertions(+), 6 deletions(-)\n\nThanks.\n"},{"id":"198830","messageId":"20120912123756.GA26593@bloggs.ozlabs.ibm.com","threadId":"31461","inReplyTo":"7v8vcffv93.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] gitk: Rename 'tagcontents' to 'cached_tagcontent'","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2012-09-12T12:37:56Z","receivedAt":"2012-09-12T12:37:56Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Wed, Sep 12, 2012 at 02:25:28AM -0700, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > I've applied these two, on top of Paul's master branch at\n> >\n> >     git://ozlabs.org/~paulus/gitk.git\n> >\n> > and tentatively queued in 'pu', but I would prefer to see it\n> > eyeballed by and queued in his tree first.\n> >\n> > Thanks.\n> \n> Pinging Paul...\n> \n> The following changes since commit a135f214e371311f13807da637d492fd9642a2e3:\n> \n>   gitk: Avoid Meta1-F5 (2012-04-25 13:44:31 +1000)\n> \n> are available in the git repository at:\n> \n>   git://github.com/gitster/git da/gitk-reload-tag-contents\n> \n> for you to fetch changes up to 587277fea3bf3bfc4302480178bd88a277a69f05:\n> \n>   gitk: Rename 'tagcontents' to 'cached_tagcontent' (2012-09-08 20:25:09 -0700)\n\nThanks, pulled and pushed out.  I had one other commit queued up, so\nif you pull from git://ozlabs.org/~paulus/gitk.git you will get that\nplus a merge.\n\nPaul.\n"}]}