List for cgit developers and users
 help / color / mirror / Atom feed
* Integration with Bugzilla?
@ 2014-09-29 17:49 joeyisdamanya
  2014-09-29 18:07 ` cgit
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: joeyisdamanya @ 2014-09-29 17:49 UTC (permalink / raw)


I often run into situations where the git commit log references a bugzilla
report. Such as this one

http://cgit
.freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae

Where fdo#60123 Refers to
https://bugs.freedesktop.org/show_bug.cgi?id=60123

or this one where the bug is #i125581#
https://github.com/apache/openoffice/commit/8cb619bd314a80fe7f7094b16f25d362979f0c69

Is it possible to have cgit parse the subject for fdo#<number> or
#i<number>#  and replace the plain text with a hyperlink containing
<number>?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140929/b362abca/attachment.html>


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

* Integration with Bugzilla?
  2014-09-29 17:49 Integration with Bugzilla? joeyisdamanya
@ 2014-09-29 18:07 ` cgit
  2014-09-29 18:09 ` mailings
  2014-10-22  1:22 ` joeyisdamanya
  2 siblings, 0 replies; 10+ messages in thread
From: cgit @ 2014-09-29 18:07 UTC (permalink / raw)


On Mon, 29 Sep 2014 at 19:49:09, Joey Reid wrote:
> [...]
> Is it possible to have cgit parse the subject for fdo#<number> or
> #i<number>#  and replace the plain text with a hyperlink containing
> <number>?
> [...]

Yes, you can use the commit-filter option [1, 2]. There also is a very
basic commit filter in the cgit source tree [3].

[1] http://git.zx2c4.com/cgit/tree/cgitrc.5.txt#n114
[2] http://git.zx2c4.com/cgit/tree/cgitrc.5.txt#n582
[3] http://git.zx2c4.com/cgit/tree/filters/commit-links.sh


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

* Integration with Bugzilla?
  2014-09-29 17:49 Integration with Bugzilla? joeyisdamanya
  2014-09-29 18:07 ` cgit
@ 2014-09-29 18:09 ` mailings
  2014-09-29 18:30   ` cgit
  2014-10-22  1:22 ` joeyisdamanya
  2 siblings, 1 reply; 10+ messages in thread
From: mailings @ 2014-09-29 18:09 UTC (permalink / raw)




On 29/09/14 19:49, Joey Reid wrote:
> I often run into situations where the git commit log references a
> bugzilla report. Such as this one
>
> http://cgit.freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae
> <http://cgit.freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae>
>
> Where fdo#60123 Refers to
> https://bugs.freedesktop.org/show_bug.cgi?id=60123
>
> or this one where the bug is #i125581#
> https://github.com/apache/openoffice/commit/8cb619bd314a80fe7f7094b16f25d362979f0c69
>
> Is it possible to have cgit parse the subject for fdo#<number> or
> #i<number>#  and replace the plain text with a hyperlink containing
> <number>?
>
>



Sure.

The below script is what I use on my server to refer to a trac ticket.

---
#!/bin/bash

#
# This script can be used to generate links in commit messages.
#
# To use this script, refer to this file with either the commit-filter 
or the
# repo.commit-filter options in cgitrc.
#
# The following environment variables can be used to retrieve the 
configuration
# of the repository for which this script is called:
# CGIT_REPO_URL        ( = repo.url       setting )
# CGIT_REPO_NAME       ( = repo.name      setting )
# CGIT_REPO_PATH       ( = repo.path      setting )
# CGIT_REPO_OWNER      ( = repo.owner     setting )
# CGIT_REPO_DEFBRANCH  ( = repo.defbranch setting )
# CGIT_REPO_SECTION    ( = section        setting )
# CGIT_REPO_CLONE_URL  ( = repo.clone-url setting )
#

declare regex=""

#
# Commit SHA1
#
regex="s|\b([0-9a-fA-F]{7,40})\b|<a href=\"./?id=\1\">\1</a>|g"

#
# Trac
#
# We have a trac instance for every repository,
# located under /reposerf/trac/repoName
#
if [[ -n "${CGIT_REPO_PATH:-}" ]]; then
   regex="$regex
s|#([0-9]+)\b|<a href=\"/reposerf/trac/$(basename 
"${CGIT_REPO_PATH}")/ticket/\1\">#\1</a>|g"
fi

sed -re "$regex"


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

* Integration with Bugzilla?
  2014-09-29 18:09 ` mailings
@ 2014-09-29 18:30   ` cgit
  2014-09-29 18:33     ` mailings
  0 siblings, 1 reply; 10+ messages in thread
From: cgit @ 2014-09-29 18:30 UTC (permalink / raw)


On Mon, 29 Sep 2014 at 20:09:48, Ferry Huberts wrote:
> [...]
> #!/bin/bash
> [...]

This is a bit off topic but the script doesn't seem to rely on any
bashisms (apart from the double brackets which can be ported easily), so
it might be a good idea to use a "/bin/sh" shebang (and use a shell
other than bash as "default shell") here?


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

* Integration with Bugzilla?
  2014-09-29 18:30   ` cgit
@ 2014-09-29 18:33     ` mailings
  2014-09-29 20:32       ` cgit
  0 siblings, 1 reply; 10+ messages in thread
From: mailings @ 2014-09-29 18:33 UTC (permalink / raw)




On 29/09/14 20:30, Lukas Fleischer wrote:
> On Mon, 29 Sep 2014 at 20:09:48, Ferry Huberts wrote:
>> [...]
>> #!/bin/bash
>> [...]
>
> This is a bit off topic but the script doesn't seem to rely on any
> bashisms (apart from the double brackets which can be ported easily), so
> it might be a good idea to use a "/bin/sh" shebang (and use a shell
> other than bash as "default shell") here?
>


my server is guaranteed to have bash, so no need to change it.
but thanks for the hint anyway :-)

also, this script is a very minor modification of the script that's in 
the source tree.

-- 
Ferry Huberts


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

* Integration with Bugzilla?
  2014-09-29 18:33     ` mailings
@ 2014-09-29 20:32       ` cgit
  0 siblings, 0 replies; 10+ messages in thread
From: cgit @ 2014-09-29 20:32 UTC (permalink / raw)


On Mon, 29 Sep 2014 at 20:33:28, Ferry Huberts wrote:
> [...]
> my server is guaranteed to have bash, so no need to change it.
> but thanks for the hint anyway :-)
> 

I am not (only) talking about portability here. My main concern is the
current spate of bash vulnerabilities. As John pointed out earlier [1],
these can be used to remotely exploit any cgit setup that uses a bash
filter. We currently have at least five CVEs, some of which are very
critical. So if you really want to use bash, you should at least closely
follow the developments and always update your bash binary when there's
a new security patch.

> also, this script is a very minor modification of the script that's in 
> the source tree.
> 
> -- 
> Ferry Huberts
> 

[1] http://lists.zx2c4.com/pipermail/cgit/2014-September/002236.html


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

* Integration with Bugzilla?
  2014-09-29 17:49 Integration with Bugzilla? joeyisdamanya
  2014-09-29 18:07 ` cgit
  2014-09-29 18:09 ` mailings
@ 2014-10-22  1:22 ` joeyisdamanya
  2014-10-22  6:29   ` hjemli
  2 siblings, 1 reply; 10+ messages in thread
From: joeyisdamanya @ 2014-10-22  1:22 UTC (permalink / raw)


Last month, I asked
I often run into situations where the git commit log references a bugzilla
report. Such as this one
http://cgit
.freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae

Where fdo#60123 Refers to
https://bugs.freedesktop.org/show_bug.cgi?id=60123

And was told to do this:
http://people.freedesktop.org/~jrayhawk/cgit-filter.txt

but after making the changes, cgit still does not link to bugzilla. Could
anyone help or provide a working example?

Thanks!


On Mon, Sep 29, 2014 at 1:49 PM, Joey Reid <joeyisdamanya at gmail.com> wrote:

> I often run into situations where the git commit log references a bugzilla
> report. Such as this one
>
> http://cgit
> .freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae
>
> Where fdo#60123 Refers to
> https://bugs.freedesktop.org/show_bug.cgi?id=60123
>
> or this one where the bug is #i125581#
>
> https://github.com/apache/openoffice/commit/8cb619bd314a80fe7f7094b16f25d362979f0c69
>
> Is it possible to have cgit parse the subject for fdo#<number> or
> #i<number>#  and replace the plain text with a hyperlink containing
> <number>?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20141021/246a1c66/attachment.html>


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

* Integration with Bugzilla?
  2014-10-22  1:22 ` joeyisdamanya
@ 2014-10-22  6:29   ` hjemli
  2014-10-24 20:25     ` joeyisdamanya
  0 siblings, 1 reply; 10+ messages in thread
From: hjemli @ 2014-10-22  6:29 UTC (permalink / raw)


On Wed, Oct 22, 2014 at 3:22 AM, Joey Reid <joeyisdamanya at gmail.com> wrote:
> http://people.freedesktop.org/~jrayhawk/cgit-filter.txt

In your config example, you specify the scan-path option before
specifying the filter option. This means that the filter-option is not
active when the scan-path option is processed. You need to specify all
options which should be in effect for repositories found by scan-path
before the actual scan-path directive is specified.

PS: We should probably reword the scan-path section of cgitrc.5 to
make this more obvious, and maybe also add an entry to the faq.

--
larsh


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

* Integration with Bugzilla?
  2014-10-22  6:29   ` hjemli
@ 2014-10-24 20:25     ` joeyisdamanya
  2014-10-26 10:41       ` cgit
  0 siblings, 1 reply; 10+ messages in thread
From: joeyisdamanya @ 2014-10-24 20:25 UTC (permalink / raw)


Yes,  rewording the scan-path section of cgitrc.5 and adding an entry to
the FAQ would be immensely helpful.

The commit-links.sh and the trac script appear to spawn extra process. With
servers like FreeDesktop's cgit  under a heavy load, is there a way
to minimize CPU usage?

Thanks for all your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20141024/b4c1986b/attachment.html>


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

* Integration with Bugzilla?
  2014-10-24 20:25     ` joeyisdamanya
@ 2014-10-26 10:41       ` cgit
  0 siblings, 0 replies; 10+ messages in thread
From: cgit @ 2014-10-26 10:41 UTC (permalink / raw)


On Fri, 24 Oct 2014 at 22:25:01, Joey Reid wrote:
> Yes,  rewording the scan-path section of cgitrc.5 and adding an entry to
> the FAQ would be immensely helpful.
> 
> The commit-links.sh and the trac script appear to spawn extra process. With
> servers like FreeDesktop's cgit  under a heavy load, is there a way
> to minimize CPU usage?
> [...]

You can use Lua filters, check [1] for details.

[1] http://git.zx2c4.com/cgit/tree/cgitrc.5.txt#n582


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

end of thread, other threads:[~2014-10-26 10:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 17:49 Integration with Bugzilla? joeyisdamanya
2014-09-29 18:07 ` cgit
2014-09-29 18:09 ` mailings
2014-09-29 18:30   ` cgit
2014-09-29 18:33     ` mailings
2014-09-29 20:32       ` cgit
2014-10-22  1:22 ` joeyisdamanya
2014-10-22  6:29   ` hjemli
2014-10-24 20:25     ` joeyisdamanya
2014-10-26 10:41       ` cgit

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 NNTP newsgroup(s).