git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Provide RSS feeds for file history
@ 2007-08-03  2:05 Steven Walter
  2007-08-03  9:10 ` Jakub Narebski
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Walter @ 2007-08-03  2:05 UTC (permalink / raw)
  To: git; +Cc: jnareb

If git_feed is provided a file name, it ought to show only the history
affecting that file.  The title was already being set correctly, but all
commits from history were being shown anyway.
---
 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 498b936..26932a4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -611,6 +611,7 @@ sub href(%) {
 	my %mapping = @mapping;
 
 	$params{'project'} = $project unless exists $params{'project'};
+	$params{'file_name'} = $file_name unless exists $params{'file_name'};
 
 	my ($use_pathinfo) = gitweb_check_feature('pathinfo');
 	if ($use_pathinfo) {
@@ -5365,7 +5366,7 @@ sub git_feed {
 
 	# log/feed of current (HEAD) branch, log of given branch, history of file/directory
 	my $head = $hash || 'HEAD';
-	my @commitlist = parse_commits($head, 150);
+	my @commitlist = parse_commits($head, 150, 0, "--full-history", $file_name);
 
 	my %latest_commit;
 	my %latest_date;
-- 
1.5.2.3


-- 
-Steven Walter <swalter@lexmark.com>

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

* Re: [PATCH] gitweb: Provide RSS feeds for file history
  2007-08-03  2:05 [PATCH] gitweb: Provide RSS feeds for file history Steven Walter
@ 2007-08-03  9:10 ` Jakub Narebski
  2007-08-03 17:50   ` [PATCH] gitweb: Fix handling of $file_name in feed generation Jakub Narebski
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Narebski @ 2007-08-03  9:10 UTC (permalink / raw)
  To: Steven Walter; +Cc: git, Robert Fitzsimons

Steven Walter wrote:

Nak. Explanation below. Corrected patch will follow.

> If git_feed is provided a file name, it ought to show only the history
> affecting that file.  The title was already being set correctly, but all
> commits from history were being shown anyway.

This is a bug introduced while changing gitweb (among others git_feed
subroutine) to use parse_commits, in commit b6093a5c. Earlier it worked.
So the explanation (in commit message) is not full.

By the way it affects not only RSS but also Atom feeds.

Documentation/SubmittingPatches:

  Checklist (and a short version for the impatient):

        Commits:

  [...]

        - if you want your work included in git.git, add a
          "Signed-off-by: Your Name <your@email.com>" line to the
          commit message (or just use the option "-s" when
          committing) to confirm that you agree to the Developer's
          Certificate of Origin

> ---
>  gitweb/gitweb.perl |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 498b936..26932a4 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -611,6 +611,7 @@ sub href(%) {
>  	my %mapping = @mapping;
>  
>  	$params{'project'} = $project unless exists $params{'project'};
> +	$params{'file_name'} = $file_name unless exists $params{'file_name'};
>  
>  	my ($use_pathinfo) = gitweb_check_feature('pathinfo');
>  	if ($use_pathinfo) {

This is a big, intrusive change. It makes 'file_name' default argument,
unless overriden. While it made sense for 'project' parameter, as almost
all URLs in gitweb needed it, more than half URLs does not need 'file_name'
parameter. And some of those URLs are present in a views which do use
'file_name'.

If you wanted alternative URLs for a feed preserve 'file_name' parameter,
do it explicitely.

> @@ -5365,7 +5366,7 @@ sub git_feed {
>  
>  	# log/feed of current (HEAD) branch, log of given branch, history of file/directory
>  	my $head = $hash || 'HEAD';
> -	my @commitlist = parse_commits($head, 150);
> +	my @commitlist = parse_commits($head, 150, 0, "--full-history", $file_name);
>  
>  	my %latest_commit;
>  	my %latest_date;

I'd rather not use "--full-history" for feeds. We use it in the 'history'
view for backward compatibility reasons; I'd rather leave it for extra
options in the feed.

-- 
Jakub Narebski
Poland

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

* [PATCH] gitweb: Fix handling of $file_name in feed generation
  2007-08-03  9:10 ` Jakub Narebski
@ 2007-08-03 17:50   ` Jakub Narebski
  2007-08-04  0:25     ` Junio C Hamano
  2007-08-04  0:27     ` Robert Fitzsimons
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Narebski @ 2007-08-03 17:50 UTC (permalink / raw)
  To: Steven Walter, git; +Cc: Robert Fitzsimons, Junio Hamano

>From 6ef05672bb1dd1fe1ded15707164eaac36772c21 Mon Sep 17 00:00:00 2001
From: Steven Walter <stevenrwalter@gmail.com>
From: Jakub Narebski <jnareb@gmail.com>
Date: Fri, 3 Aug 2007 19:35:00 +0200
Subject: [PATCH] gitweb: Fix handling of $file_name in feed generation

The commit b6093a5c, by Robert Fitzsimons:
  "gitweb: Change atom, rss actions to use parse_commits."
forgot to pass $file_name parameter to parse_commits subroutine.

If git_feed is provided a file name, it ought to show only the history
affecting that file or a directory.  The title was being set
correctly, but all commits from history were being shown.

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Three comments. First, authorship. Steven Walter didn't signoff his patch,
and the contents differs a bit from second chunk of his patch (see
comment below) and I have added infor about which commit introduced this
bug to the commit message. I have added my signoff, you can take this
patch as either mine or Steven authorship.


Second, I have discarded first chunk in Steven patch because it was too
intrusive. As I have said, it makes 'file_name' default argument,
unless overriden. While it made sense for 'project' parameter to be made
default parameter in href(), as almost all URLs in gitweb needed it,
more than half URLs does not need 'file_name' parameter. And some of
those URLs are present in a views which do use 'file_name'.

So if we want alternative URLs for a feed preserve 'file_name' parameter,
or we want RSS/Atom links for "file_name" kind of views, like 'tree',
'blob' or 'history' views, we should add 'file_name' parameter
explicitely, and not change href() to do it implicitely.

But as we are in stabilization (freeze) stage, I'd rather not add any new
features. This one just fixes a bug in gitweb.


Third, I'd rather not use "--full-history" for feeds. We use it in the
'history' view for backward compatibility reasons; I'd rather leave it
for extra options in the feed. But this is also for after the release.

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 498b936..4733728 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5365,7 +5365,7 @@ sub git_feed {
 
 	# log/feed of current (HEAD) branch, log of given branch, history of file/directory
 	my $head = $hash || 'HEAD';
-	my @commitlist = parse_commits($head, 150);
+	my @commitlist = parse_commits($head, 150, 0, undef, $file_name);
 
 	my %latest_commit;
 	my %latest_date;
-- 
1.5.2.4

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

* Re: [PATCH] gitweb: Fix handling of $file_name in feed generation
  2007-08-03 17:50   ` [PATCH] gitweb: Fix handling of $file_name in feed generation Jakub Narebski
@ 2007-08-04  0:25     ` Junio C Hamano
  2007-08-04  0:27     ` Robert Fitzsimons
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-08-04  0:25 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Steven Walter, git, Robert Fitzsimons

Thanks.  This came in while I already tagged -rc4 and was doing
the final round of tests and packaging, so has to become the
first thing post -rc4, unfortunately.

The format of the e-mail message you sent out could use much
improvements but I'll let it pass this time.

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

* Re: [PATCH] gitweb: Fix handling of $file_name in feed generation
  2007-08-03 17:50   ` [PATCH] gitweb: Fix handling of $file_name in feed generation Jakub Narebski
  2007-08-04  0:25     ` Junio C Hamano
@ 2007-08-04  0:27     ` Robert Fitzsimons
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Fitzsimons @ 2007-08-04  0:27 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Steven Walter, git, Robert Fitzsimons, Junio Hamano

> Subject: [PATCH] gitweb: Fix handling of $file_name in feed generation
> 
> The commit b6093a5c, by Robert Fitzsimons:
>   "gitweb: Change atom, rss actions to use parse_commits."
> forgot to pass $file_name parameter to parse_commits subroutine.
> 
> If git_feed is provided a file name, it ought to show only the history
> affecting that file or a directory.  The title was being set
> correctly, but all commits from history were being shown.
> 
> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>

Silly me.  Jakub's change is the correct fix for the bug.

Robert

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

end of thread, other threads:[~2007-08-04  0:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-03  2:05 [PATCH] gitweb: Provide RSS feeds for file history Steven Walter
2007-08-03  9:10 ` Jakub Narebski
2007-08-03 17:50   ` [PATCH] gitweb: Fix handling of $file_name in feed generation Jakub Narebski
2007-08-04  0:25     ` Junio C Hamano
2007-08-04  0:27     ` Robert Fitzsimons

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).