From 3439e3797389ff34d6437249d431e54720682bbf Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Mon, 27 Oct 2008 00:44:34 -0400 Subject: Patch for substitution of sha1 in diffurl --- doc/todo/provide_sha1_for_git_diffurl.mdwn | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 doc/todo/provide_sha1_for_git_diffurl.mdwn (limited to 'doc/todo/provide_sha1_for_git_diffurl.mdwn') diff --git a/doc/todo/provide_sha1_for_git_diffurl.mdwn b/doc/todo/provide_sha1_for_git_diffurl.mdwn new file mode 100644 index 000000000..aac3c6307 --- /dev/null +++ b/doc/todo/provide_sha1_for_git_diffurl.mdwn @@ -0,0 +1,21 @@ +This [[patch]] allows for `\[[sha1]]` substitution in the `diffurl` +for git repositories. This is useful for use with [cgit][] which has +diffurls of the following form: + + /project.git/diff/[[file]]?id=\[[sha1]] + + [cgit]: http://hjemli.net/git/cgit/ + + diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm + index 5bef928..164210d 100644 + --- a/IkiWiki/Plugin/git.pm + +++ b/IkiWiki/Plugin/git.pm + @@ -518,6 +518,7 @@ sub rcs_recentchanges ($) { #{{{ + + my $diffurl = defined $config{'diffurl'} ? $config{'diffurl'} : ""; + $diffurl =~ s/\[\[file\]\]/$file/go; + + $diffurl =~ s/\[\[sha1\]\]/$sha1/go; + $diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go; + $diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go; + $diffurl =~ s/\[\[sha1_to\]\]/$detail->{'sha1_to'}/go; + -- cgit v1.2.3 From 065cae4670d32f7293ab06ea10ac18e59acc0bc8 Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Mon, 27 Oct 2008 00:45:54 -0400 Subject: Fix escaping --- doc/todo/provide_sha1_for_git_diffurl.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/todo/provide_sha1_for_git_diffurl.mdwn') diff --git a/doc/todo/provide_sha1_for_git_diffurl.mdwn b/doc/todo/provide_sha1_for_git_diffurl.mdwn index aac3c6307..af785c3e6 100644 --- a/doc/todo/provide_sha1_for_git_diffurl.mdwn +++ b/doc/todo/provide_sha1_for_git_diffurl.mdwn @@ -2,7 +2,7 @@ This [[patch]] allows for `\[[sha1]]` substitution in the `diffurl` for git repositories. This is useful for use with [cgit][] which has diffurls of the following form: - /project.git/diff/[[file]]?id=\[[sha1]] + /project.git/diff/\[[file]]?id=\[[sha1]] [cgit]: http://hjemli.net/git/cgit/ -- cgit v1.2.3 From 8530e827b01a6eed8b8c933e758e152a1dc32035 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 27 Oct 2008 14:45:54 -0400 Subject: git: Allow [[sha1_commit]] to be used in the diffurl, to support cgit. --- IkiWiki/Plugin/git.pm | 3 ++- debian/changelog | 1 + doc/todo/provide_sha1_for_git_diffurl.mdwn | 4 +++- po/ikiwiki.pot | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'doc/todo/provide_sha1_for_git_diffurl.mdwn') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 5bef92856..1a39d87e5 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -95,7 +95,7 @@ sub getsetup () { #{{{ diffurl => { type => "string", example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_parent]];f=[[file]]", - description => "gitweb url to show a diff ([[sha1_to]], [[sha1_from]], [[sha1_parent]], and [[file]] substituted)", + description => "gitweb url to show a diff ([[sha1_to]], [[sha1_from]], [[sha1_parent]], [[sha1_commit]] and [[file]] substituted)", safe => 1, rebuild => 1, }, @@ -521,6 +521,7 @@ sub rcs_recentchanges ($) { #{{{ $diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go; $diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go; $diffurl =~ s/\[\[sha1_to\]\]/$detail->{'sha1_to'}/go; + $diffurl =~ s/\[\[sha1_commit\]\]/$sha1/go; push @pages, { page => pagename($file), diff --git a/debian/changelog b/debian/changelog index 63556c941..299cf1af2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,7 @@ ikiwiki (2.68) UNRELEASED; urgency=low of a second. * Add support for checking pushes from untrusted git committers. This can be used to set up anonymous git pushes, and other similar things. + * git: Allow [[sha1_commit]] to be used in the diffurl, to support cgit. -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/todo/provide_sha1_for_git_diffurl.mdwn b/doc/todo/provide_sha1_for_git_diffurl.mdwn index af785c3e6..dfd848058 100644 --- a/doc/todo/provide_sha1_for_git_diffurl.mdwn +++ b/doc/todo/provide_sha1_for_git_diffurl.mdwn @@ -18,4 +18,6 @@ diffurls of the following form: $diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go; $diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go; $diffurl =~ s/\[\[sha1_to\]\]/$detail->{'sha1_to'}/go; - + +> [[done]], but I called it `sha1_commit` since I think that's what it's +> actually a sha1 of. --[[Joey]] diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index cbae46752..7a2891ea5 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-26 20:44-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- cgit v1.2.3 From a6412a374e42c4c6f37ba4954e5fc50a1d9837a0 Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Mon, 27 Oct 2008 20:20:50 -0400 Subject: Response re sha1_commit --- doc/todo/provide_sha1_for_git_diffurl.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/todo/provide_sha1_for_git_diffurl.mdwn') diff --git a/doc/todo/provide_sha1_for_git_diffurl.mdwn b/doc/todo/provide_sha1_for_git_diffurl.mdwn index dfd848058..9c8b340de 100644 --- a/doc/todo/provide_sha1_for_git_diffurl.mdwn +++ b/doc/todo/provide_sha1_for_git_diffurl.mdwn @@ -2,7 +2,7 @@ This [[patch]] allows for `\[[sha1]]` substitution in the `diffurl` for git repositories. This is useful for use with [cgit][] which has diffurls of the following form: - /project.git/diff/\[[file]]?id=\[[sha1]] + /project.git/diff/\[[file]]?id=\[[sha1_commit]] [cgit]: http://hjemli.net/git/cgit/ @@ -21,3 +21,6 @@ diffurls of the following form: > [[done]], but I called it `sha1_commit` since I think that's what it's > actually a sha1 of. --[[Joey]] + +>> I was at a loss for something more descriptive...I like that much +>> better :) Thanks! --[[JasonBlevins]] -- cgit v1.2.3