git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git web--browse error handling URL with & in it (Was Re: [RFC/PATCH] Configurable hyperlinking in gitk)

From
Chris Packham <judge.packham@gmail.com>
Date
Sep 18, 2011, 00:32 UTC
Message-ID
<4E753C04.1070202@gmail.com>
In-Reply-To
<4E753BB9.7030804@gmail.com>
On 18/09/11 12:30, Chris Packham wrote:
Show 76 quoted lines
> On 18/09/11 11:33, Chris Packham wrote:
>> On 18/09/11 01:45, Jeff Epler wrote:
>>>>> There are probably better names for the configuration options, too.
>>>>
>>>> It'd be nice if the config variables weren't gitk specific. .re and .sub
>>>> could be applied to gitweb and maybe other git viewers outside of
>>>> gig.git might decide to use them. My bikeshedding suggestion would be to
>>>> just drop the gitk prefix and have linkify.re and linkify.sub.
>>>
>>> This seems like a reasonable idea, though since the implementation
>>> languages of gitk and gitweb are different it means some REs might get
>>> different interpretations in the different programs.
>>>
>>>> Sometimes when a commit fixes multiple bugs we put all the bug numbers
>>>> in separated by commas. I don't know Tcl well enough to tell if your
>>>> code supports that or not.
>>>
>>> Multiple matches per line are OK, but they must be non-overlapping.
>>>
>>> Looking at the actual practice in Debian changelogs, I see that they do
>>> this:
>>>     evince/changelog.Debian.gz:        (Closes: #388368, #396467, #405130)
>>> so my original example would only linkify "Closes: #388638".  But a
>>> revised pattern of #(\d+) would linkify "#388368", "#396467" and "#405130".
>>> (but risk a few more "false positive" links).  I should revise my
>>> example accordingly.
>>>
>>> As for the problems with your substitutions, "&" is special in a tcl
>>> regsub (it stands for the whole matched string, like \0), so you'd want
>>> to use a substitution like
>>>     git config gitk.linkify.debian-bts.sub \
>>>         'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\1\&foo=bar'
>>
>> Hmm no joy with \&. Seems to upset the invocation of git web-browse
>>
>>   git config gitk.linkify.bugtracker.sub \
>>        'https://internalhost/code\&stuff/bugs.php?id=\1'
>>
>>   gitk
>>   /home/chrisp/libexec/git-core/git-web--browse: line 167:
>> stuff/bugs.php?id=bug123: No such file or directory
>>   fatal: 'web--browse' appears to be a git command, but we were not
>>   able to execute it. Maybe git-web--browse is broken?
> 
> This is probably a issue with git web--browse and nothing to do with
> your changes.
> 
> Sure enough this works fine
> 
>   git web--browse --browser=firefox \
>       https://internalhost/code\&stuff/bugs.php?id=foo
> 
> While this doesn't
> 
>   git web--browse https://internalhost/code\&stuff/bugs.php?id=foo
> 
> /home/chrisp/libexec/git-core/git-web--browse: line 167:
> stuff/bugs.php?id=foo: No such file or directory
> fatal: 'web--browse' appears to be a git command, but we were not
> able to execute it. Maybe git-web--browse is broken?
> 
> Neither does this
> 
>   git web--browse --browser=konqueror \
>      https://internalhost/code\&stuff/bugs.php?id=foo
> 
> A little bit more info that might help diagnose the issue - I'm running
> openSUSE 11.4 (kde 4.6) which ships with firefox set as the default web
> browser so 'kfmclient newTab http://www.example.com' actually opens firefox.
> 
> However trying kfmclient with my funny URL still works
> 
>   kfmclient newTab https://internalhost/code\&stuff/bugs.php?id=foo
> 
> I'm a little stumped as to what is going wrong in git web--browse.
> 
Update: it's the call to eval that causes the problem
  eval kfmclient newTab https://internalhost/code\&stuff/bugs.php?id=foo
  [1] 14728
  bash: stuff/bugs.php?id=foo: No such file or directory
Previous: Chris PackhamNext: Jeff King
Message 7 of 33 in “Configurable hyperlinking in gitk”
  1. Configurable hyperlinking in gitkJeff Epler, Sep 17, 2011
  2. Chris PackhamSep 17, 2011
  3. Chris PackhamSep 17, 2011
  4. Jeff EplerSep 17, 2011
  5. Chris PackhamSep 17, 2011
  6. git web--browse error handling URL with & in it (Was Re: [RFC/PATCH] Configurable hyperlinking in gitk)Chris Packham, Sep 18, 2011
  7. Chris PackhamSep 18, 2011
  8. Jeff KingSep 18, 2011
  9. git-web--browse: invoke kfmclient directlyChris Packham, Sep 18, 2011
  10. Jeff KingSep 18, 2011
  11. [RFC/PATCHv2] git-web--browse: avoid the use of evalChris Packham, Sep 19, 2011
  12. Jeff KingSep 19, 2011
  13. Chris PackhamSep 20, 2011
  14. Jeff KingSep 20, 2011
  15. Junio C HamanoSep 20, 2011
  16. Junio C HamanoSep 19, 2011
  17. Jeff KingSep 19, 2011
  18. Junio C HamanoSep 19, 2011
  19. Jeff KingSep 19, 2011
  20. Junio C HamanoSep 19, 2011
  21. Andreas SchwabSep 19, 2011
  22. Jeff KingSep 19, 2011
  23. Junio C HamanoSep 19, 2011
  24. Andreas SchwabSep 19, 2011
  25. Jakub NarebskiSep 19, 2011
  26. Christian CouderSep 18, 2011
  27. Marc BranchaudSep 19, 2011
  28. Jakub NarebskiSep 18, 2011
  29. Jeff EplerSep 22, 2011
  30. Configurable hyperlinking in gitkJeff Epler, Sep 22, 2011
  31. Configurable hyperlinking in gitkJeff Epler, Oct 11, 2011
  32. Junio C HamanoOct 11, 2011
  33. Chris PackhamOct 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.