git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Why doesn't gitk highlight commit references from git-describe?
@ 2016-04-13 20:36 Stephen Kelly
  2016-04-13 21:27 ` Stefan Beller
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Kelly @ 2016-04-13 20:36 UTC (permalink / raw)
  To: git

Hi,

If I look at git commit 89ea90351dd32fbe384d0cf844640a9c55606f3b in gitk, it 
does not linkify the v1.6.0-rc0~120^2 in the commit message. 

Is there any reason for that, or can gitk be changed?

Thanks,

Steve.

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 20:36 Why doesn't gitk highlight commit references from git-describe? Stephen Kelly
@ 2016-04-13 21:27 ` Stefan Beller
  2016-04-13 21:32   ` Junio C Hamano
  2016-04-13 21:41   ` Stephen Kelly
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Beller @ 2016-04-13 21:27 UTC (permalink / raw)
  To: Stephen Kelly; +Cc: git@vger.kernel.org

On Wed, Apr 13, 2016 at 1:36 PM, Stephen Kelly <steveire@gmail.com> wrote:
> Hi,
>
> If I look at git commit 89ea90351dd32fbe384d0cf844640a9c55606f3b in gitk, it
> does not linkify the v1.6.0-rc0~120^2 in the commit message.
>
> Is there any reason for that, or can gitk be changed?

Sure it can be changed. Go for it.

I think it is hard though. So for example it is easy to spot sha1s
and link them (see a6ee883b8e as an example picking up ebef7e5
as a link.)

How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?
"v1.6.0-rc0" is a custom string as that is how we name tags in this project.
It can follow any convention in other projects.

Maybe a first approximation is if there is a `~` followed by numbers
or a ^ character, inspect the whole thing if it is a reference into the history?

(Special case for git.git: Sometimes in a discussion you want to explain stuff
and may use HEAD^ or such to demonstrate the use case. Other projects would
not use that as much in descriptive text I would assume. So we'd need
to make sure
changing refs (i.e. branches, symbolic refs such as HEAD, FETCH_HEAD) are not
considered worth linkifying.)

Thanks,
Stefan

>
> Thanks,
>
> Steve.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:27 ` Stefan Beller
@ 2016-04-13 21:32   ` Junio C Hamano
  2016-04-13 21:45     ` Stefan Beller
  2016-04-13 21:41   ` Stephen Kelly
  1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2016-04-13 21:32 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Stephen Kelly, git@vger.kernel.org

Stefan Beller <sbeller@google.com> writes:

> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?
> "v1.6.0-rc0" is a custom string as that is how we name tags in this project.
> It can follow any convention in other projects.
>
> Maybe a first approximation is if there is a `~` followed by numbers
> or a ^ character, inspect the whole thing if it is a reference into the history?

You (as a gitk process running in a repository) know what tags are
in your repository, so you can find the above pattern and see if the
prefix matches any of the known tag.  That way, you do not have to
worry about having to special case HEAD etc.

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:27 ` Stefan Beller
  2016-04-13 21:32   ` Junio C Hamano
@ 2016-04-13 21:41   ` Stephen Kelly
  1 sibling, 0 replies; 8+ messages in thread
From: Stephen Kelly @ 2016-04-13 21:41 UTC (permalink / raw)
  To: git

Stefan Beller wrote:

> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?
> "v1.6.0-rc0" is a custom string as that is how we name tags in this
> project. It can follow any convention in other projects.
> 
> Maybe a first approximation is if there is a `~` followed by numbers
> or a ^ character, inspect the whole thing if it is a reference into the
> history?

Would it be possible to implement linking for <tagname> optionally followed 
by something like that? Just tags should be links too, right?

> (Special case for git.git: Sometimes in a discussion you want to explain
> stuff and may use HEAD^ or such to demonstrate the use case. Other
> projects would not use that as much in descriptive text I would assume. So
> we'd need to make sure
> changing refs (i.e. branches, symbolic refs such as HEAD, FETCH_HEAD) are
> not considered worth linkifying.)

What does 'HEAD^' mean? If it is 'the commit before this one', then why not 
link it?

Thanks,

Steve.

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:32   ` Junio C Hamano
@ 2016-04-13 21:45     ` Stefan Beller
  2016-04-13 21:50       ` Junio C Hamano
  2016-04-13 21:55       ` Stephen Kelly
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Beller @ 2016-04-13 21:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Stephen Kelly, git@vger.kernel.org

On Wed, Apr 13, 2016 at 2:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> How would you know(/code) that v1.6.0-rc0~120^2 is a text worth linking?
>> "v1.6.0-rc0" is a custom string as that is how we name tags in this project.
>> It can follow any convention in other projects.
>>
>> Maybe a first approximation is if there is a `~` followed by numbers
>> or a ^ character, inspect the whole thing if it is a reference into the history?
>
> You (as a gitk process running in a repository) know what tags are
> in your repository, so you can find the above pattern and see if the
> prefix matches any of the known tag.  That way, you do not have to
> worry about having to special case HEAD etc.

Sorry for shooting from the hip here[1], that thought was

But it should not be just tags?

We also want to have 4b9ab0ee0130~1^2 to work `right`, in the sense
that not just the hexadecimals are highlighted and linking to 4b9ab0ee0130,
but the whole expression should link to 49e863b02ae177.

[1] My thinking was just like in https://xkcd.com/761/

Stephen Kelly:
> Would it be possible to implement linking for <tagname> optionally followed
> by something like that? Just tags should be links too, right?

right, just tags should work I'd expect.

> What does 'HEAD^' mean? If it is 'the commit before this one', then why not
> link it?

As said I was thinking about the git development, so see 5f3c3a4e6f11deda
for an example:

    files_log_ref_write: new function

    Because HEAD and stash are per-worktree, every refs backend needs to
    go through the files backend to write these refs.

    So create a new function, files_log_ref_write, and add it to
    refs/refs-internal.h. Later, we will use this to handle reflog updates
    for per-worktree symbolic refs (HEAD).

I do not think we would want to link HEAD to anything in that example.
(I'd have no idea what it would link to here, so just not link it?)

Thanks,
Stefan

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:45     ` Stefan Beller
@ 2016-04-13 21:50       ` Junio C Hamano
  2016-04-13 21:55       ` Stephen Kelly
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2016-04-13 21:50 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Stephen Kelly, git@vger.kernel.org

Stefan Beller <sbeller@google.com> writes:

> But it should not be just tags?
>
> We also want to have 4b9ab0ee0130~1^2 to work `right`,

I'd consider that just "crazy", though.  I'd be just happy to see
4b9ab0ee0130 highlighted and lead to the named commit, i.e. as long
as ~1^2 is not part of the link, it is sufficient.

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:45     ` Stefan Beller
  2016-04-13 21:50       ` Junio C Hamano
@ 2016-04-13 21:55       ` Stephen Kelly
  2016-04-13 21:57         ` Stephen Kelly
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Kelly @ 2016-04-13 21:55 UTC (permalink / raw)
  To: git

Stefan Beller wrote:

> We also want to have 4b9ab0ee0130~1^2 to work `right`, in the sense
> that not just the hexadecimals are highlighted and linking to
> 4b9ab0ee0130, but the whole expression should link to 49e863b02ae177.

Presumably the same logic which finds 4b9ab0ee0130 to link it can also see 
if it is suffixed with '~1^2' ?

Is a ref like 4b9ab0ee0130~1^2 commonly useful? In cmake we use the output 
of cmake describe --contains (when there is a following tag) to refer to 
commits, in a pattern which I've also seen in git.git occasionally:

 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23f3798c

I think the only reason for using the output of cmake describe --contains is 
that it shows the reader the 'era' of the commit (and release it appears in) 
without having to look it up. I'm not really aware of another good reason to 
use it, but I think that's enough to make sense.

However I'm not sure I understand why anyone would refer to 4b9ab0ee0130~1^2 
instead of 49e863b0 (or perhaps v2.6.5~12, depending on whether the tag is 
there).

>> What does 'HEAD^' mean? If it is 'the commit before this one', then why
>> not link it?
> 
> As said I was thinking about the git development

> I do not think we would want to link HEAD to anything in that example.
> (I'd have no idea what it would link to here, so just not link it?)

Right, so if a commit message contains something like 

 Make git rebase -i HEAD^^^^ ten times better

then HEAD^^^^ shouldn't become a link. Makes sense to me.

Thanks,

Steve.

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

* Re: Why doesn't gitk highlight commit references from git-describe?
  2016-04-13 21:55       ` Stephen Kelly
@ 2016-04-13 21:57         ` Stephen Kelly
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Kelly @ 2016-04-13 21:57 UTC (permalink / raw)
  To: git

Stephen Kelly wrote:

>  cmake describe --contains


Oops, I mean git describe --contains of course.

Thanks,

Steve.

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

end of thread, other threads:[~2016-04-13 22:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 20:36 Why doesn't gitk highlight commit references from git-describe? Stephen Kelly
2016-04-13 21:27 ` Stefan Beller
2016-04-13 21:32   ` Junio C Hamano
2016-04-13 21:45     ` Stefan Beller
2016-04-13 21:50       ` Junio C Hamano
2016-04-13 21:55       ` Stephen Kelly
2016-04-13 21:57         ` Stephen Kelly
2016-04-13 21:41   ` Stephen Kelly

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).