{"thread":{"id":"42021","subject":"Why doesn't gitk highlight commit references from git-describe?","startedAt":"2016-04-13T20:36:53Z","lastAt":"2016-04-13T21:57:09Z","messageCount":8,"participants":["Stephen Kelly","Stefan Beller","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"283405","messageId":"nemal5$mb$1@ger.gmane.org","threadId":"42021","inReplyTo":null,"subject":"Why doesn't gitk highlight commit references from git-describe?","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2016-04-13T20:36:53Z","receivedAt":"2016-04-13T20:36:53Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Hi,\n\nIf I look at git commit 89ea90351dd32fbe384d0cf844640a9c55606f3b in gitk, it \ndoes not linkify the v1.6.0-rc0~120^2 in the commit message. \n\nIs there any reason for that, or can gitk be changed?\n\nThanks,\n\nSteve.\n"},{"id":"283409","messageId":"CAGZ79kZVC0FxUN45KgLh-2tEK2=j2-yyTajYOc=s-LECgx+yqQ@mail.gmail.com","threadId":"42021","inReplyTo":"nemal5$mb$1@ger.gmane.org","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-04-13T21:27:12Z","receivedAt":"2016-04-13T21:27:12Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Apr 13, 2016 at 1:36 PM, Stephen Kelly <steveire@gmail.com> wrote:\n> Hi,\n>\n> If I look at git commit 89ea90351dd32fbe384d0cf844640a9c55606f3b in gitk, it\n> does not linkify the v1.6.0-rc0~120^2 in the commit message.\n>\n> Is there any reason for that, or can gitk be changed?\n\nSure it can be changed. Go for it.\n\nI think it is hard though. So for example it is easy to spot sha1s\nand link them (see a6ee883b8e as an example picking up ebef7e5\nas a link.)\n\nHow would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?\n\"v1.6.0-rc0\" is a custom string as that is how we name tags in this project.\nIt can follow any convention in other projects.\n\nMaybe a first approximation is if there is a `~` followed by numbers\nor a ^ character, inspect the whole thing if it is a reference into the history?\n\n(Special case for git.git: Sometimes in a discussion you want to explain stuff\nand may use HEAD^ or such to demonstrate the use case. Other projects would\nnot use that as much in descriptive text I would assume. So we'd need\nto make sure\nchanging refs (i.e. branches, symbolic refs such as HEAD, FETCH_HEAD) are not\nconsidered worth linkifying.)\n\nThanks,\nStefan\n\n>\n> Thanks,\n>\n> Steve.\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"283410","messageId":"xmqqk2k1jita.fsf@gitster.mtv.corp.google.com","threadId":"42021","inReplyTo":"CAGZ79kZVC0FxUN45KgLh-2tEK2=j2-yyTajYOc=s-LECgx+yqQ@mail.gmail.com","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-13T21:32:49Z","receivedAt":"2016-04-13T21:32:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?\n> \"v1.6.0-rc0\" is a custom string as that is how we name tags in this project.\n> It can follow any convention in other projects.\n>\n> Maybe a first approximation is if there is a `~` followed by numbers\n> or a ^ character, inspect the whole thing if it is a reference into the history?\n\nYou (as a gitk process running in a repository) know what tags are\nin your repository, so you can find the above pattern and see if the\nprefix matches any of the known tag.  That way, you do not have to\nworry about having to special case HEAD etc.\n"},{"id":"283412","messageId":"nemedq$rh4$1@ger.gmane.org","threadId":"42021","inReplyTo":"CAGZ79kZVC0FxUN45KgLh-2tEK2=j2-yyTajYOc=s-LECgx+yqQ@mail.gmail.com","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2016-04-13T21:41:14Z","receivedAt":"2016-04-13T21:41:14Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Stefan Beller wrote:\n\n> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?\n> \"v1.6.0-rc0\" is a custom string as that is how we name tags in this\n> project. It can follow any convention in other projects.\n> \n> Maybe a first approximation is if there is a `~` followed by numbers\n> or a ^ character, inspect the whole thing if it is a reference into the\n> history?\n\nWould it be possible to implement linking for <tagname> optionally followed \nby something like that? Just tags should be links too, right?\n\n> (Special case for git.git: Sometimes in a discussion you want to explain\n> stuff and may use HEAD^ or such to demonstrate the use case. Other\n> projects would not use that as much in descriptive text I would assume. So\n> we'd need to make sure\n> changing refs (i.e. branches, symbolic refs such as HEAD, FETCH_HEAD) are\n> not considered worth linkifying.)\n\nWhat does 'HEAD^' mean? If it is 'the commit before this one', then why not \nlink it?\n\nThanks,\n\nSteve.\n"},{"id":"283413","messageId":"CAGZ79kY_C9wSS+z7XwPEWiM+8vhYuZzs_SPZ0mQR=LB+MPzTJg@mail.gmail.com","threadId":"42021","inReplyTo":"xmqqk2k1jita.fsf@gitster.mtv.corp.google.com","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-04-13T21:45:07Z","receivedAt":"2016-04-13T21:45:07Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Apr 13, 2016 at 2:32 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?\n>> \"v1.6.0-rc0\" is a custom string as that is how we name tags in this project.\n>> It can follow any convention in other projects.\n>>\n>> Maybe a first approximation is if there is a `~` followed by numbers\n>> or a ^ character, inspect the whole thing if it is a reference into the history?\n>\n> You (as a gitk process running in a repository) know what tags are\n> in your repository, so you can find the above pattern and see if the\n> prefix matches any of the known tag.  That way, you do not have to\n> worry about having to special case HEAD etc.\n\nSorry for shooting from the hip here[1], that thought was\n\nBut it should not be just tags?\n\nWe also want to have 4b9ab0ee0130~1^2 to work `right`, in the sense\nthat not just the hexadecimals are highlighted and linking to 4b9ab0ee0130,\nbut the whole expression should link to 49e863b02ae177.\n\n[1] My thinking was just like in https://xkcd.com/761/\n\nStephen Kelly:\n> Would it be possible to implement linking for <tagname> optionally followed\n> by something like that? Just tags should be links too, right?\n\nright, just tags should work I'd expect.\n\n> What does 'HEAD^' mean? If it is 'the commit before this one', then why not\n> link it?\n\nAs said I was thinking about the git development, so see 5f3c3a4e6f11deda\nfor an example:\n\n    files_log_ref_write: new function\n\n    Because HEAD and stash are per-worktree, every refs backend needs to\n    go through the files backend to write these refs.\n\n    So create a new function, files_log_ref_write, and add it to\n    refs/refs-internal.h. Later, we will use this to handle reflog updates\n    for per-worktree symbolic refs (HEAD).\n\nI do not think we would want to link HEAD to anything in that example.\n(I'd have no idea what it would link to here, so just not link it?)\n\nThanks,\nStefan\n"},{"id":"283415","messageId":"xmqqbn5djhz7.fsf@gitster.mtv.corp.google.com","threadId":"42021","inReplyTo":"CAGZ79kY_C9wSS+z7XwPEWiM+8vhYuZzs_SPZ0mQR=LB+MPzTJg@mail.gmail.com","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-13T21:50:52Z","receivedAt":"2016-04-13T21:50:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> But it should not be just tags?\n>\n> We also want to have 4b9ab0ee0130~1^2 to work `right`,\n\nI'd consider that just \"crazy\", though.  I'd be just happy to see\n4b9ab0ee0130 highlighted and lead to the named commit, i.e. as long\nas ~1^2 is not part of the link, it is sufficient.\n"},{"id":"283416","messageId":"nemf95$e1u$1@ger.gmane.org","threadId":"42021","inReplyTo":"CAGZ79kY_C9wSS+z7XwPEWiM+8vhYuZzs_SPZ0mQR=LB+MPzTJg@mail.gmail.com","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2016-04-13T21:55:49Z","receivedAt":"2016-04-13T21:55:49Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Stefan Beller wrote:\n\n> We also want to have 4b9ab0ee0130~1^2 to work `right`, in the sense\n> that not just the hexadecimals are highlighted and linking to\n> 4b9ab0ee0130, but the whole expression should link to 49e863b02ae177.\n\nPresumably the same logic which finds 4b9ab0ee0130 to link it can also see \nif it is suffixed with '~1^2' ?\n\nIs a ref like 4b9ab0ee0130~1^2 commonly useful? In cmake we use the output \nof cmake describe --contains (when there is a following tag) to refer to \ncommits, in a pattern which I've also seen in git.git occasionally:\n\n https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23f3798c\n\nI think the only reason for using the output of cmake describe --contains is \nthat it shows the reader the 'era' of the commit (and release it appears in) \nwithout having to look it up. I'm not really aware of another good reason to \nuse it, but I think that's enough to make sense.\n\nHowever I'm not sure I understand why anyone would refer to 4b9ab0ee0130~1^2 \ninstead of 49e863b0 (or perhaps v2.6.5~12, depending on whether the tag is \nthere).\n\n>> What does 'HEAD^' mean? If it is 'the commit before this one', then why\n>> not link it?\n> \n> As said I was thinking about the git development\n\n> I do not think we would want to link HEAD to anything in that example.\n> (I'd have no idea what it would link to here, so just not link it?)\n\nRight, so if a commit message contains something like \n\n Make git rebase -i HEAD^^^^ ten times better\n\nthen HEAD^^^^ shouldn't become a link. Makes sense to me.\n\nThanks,\n\nSteve.\n"},{"id":"283418","messageId":"nemfbl$e1u$2@ger.gmane.org","threadId":"42021","inReplyTo":"nemf95$e1u$1@ger.gmane.org","subject":"Re: Why doesn't gitk highlight commit references from git-describe?","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2016-04-13T21:57:09Z","receivedAt":"2016-04-13T21:57:09Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Stephen Kelly wrote:\n\n>  cmake describe --contains\n\n\nOops, I mean git describe --contains of course.\n\nThanks,\n\nSteve.\n"}]}