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

[PATCH] gitweb: Fix handling of $file_name in feed generation

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 3, 2007, 17:50 UTC
Message-ID
<200708031950.43126.jnareb@gmail.com>
In-Reply-To
<200708031110.55969.jnareb@gmail.com>
>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
Previous: Jakub NarebskiNext: Junio C Hamano
Message 3 of 5 in “gitweb: Provide RSS feeds for file history”
  1. gitweb: Provide RSS feeds for file historySteven Walter, Aug 3, 2007
  2. Jakub NarebskiAug 3, 2007
  3. gitweb: Fix handling of $file_name in feed generationJakub Narebski, Aug 3, 2007
  4. Junio C HamanoAug 4, 2007
  5. Robert FitzsimonsAug 4, 2007

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.