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

Re: [PATCH 2/1] git svn: remove extraneous newline from log output

From
EWEric Wong <normalperson@yhbt.net>
Date
Jul 26, 2010, 19:09 UTC
Message-ID
<20100726190945.GA2727@dcvr.yhbt.net>
In-Reply-To
<20100725173549.GA7930@merkur.sol.de>
Jens Seidel <jensseidel@users.sf.net> wrote:
Show 23 quoted lines
> Hi Eric,
> 
> On Sun, Jul 25, 2010 at 08:13:44AM +0000, Eric Wong wrote:
> > This is to match the output of "svn log", which does not
> > add an extra newline before the next log entry.
> 
> thanks for the patch but it doesn't work in the general case.
> 
> I attached a sample Subversion repository dump where the output of
> git svn log and svn log still differs by empty lines.
> 
> I also noticed the following error:
> Can't use an undefined value as an ARRAY reference at                                                                                            
> /usr/lib/git-core/git-svn line 5717, <$fh> line 53.
> 
> I'm not sure whether I introduced this error once I patched
> git-svn ...
> The affected line is the second one in:
>            } elsif (/^${esc_color}    (git-svn-id:.+)$/o) {
>                         if (@{$c->{l}} && $c->{l}->[-1] eq "\n") {
>                                 pop @{$c->{l}};
>                         }
> (is -1 valid?)
Yes, -1 is valid but $c->{l} may not exist at that point..

But I had forgotten about a similar piece of code in the "show_commit_normal" subroutine which does a similar job:

		while ($l->[$#$l] eq "\n" && $#$l > 0
		                          && $l->[($#$l - 1)] eq "\n") {
			pop @$l;
		}

This is partially because SVN doesn't enforce a trailing "\n" in commit messages (unlike "git commit"), so we always append one when we fetch and add "\ngit-svn-id: ...\n". But then we also need to take noMetadata users into account, too.

I'll let you ponder issues with this since you appear to care more than I do about completely matching SVN output :)

For what it's worth, over the years, nobody ever "outed" me as a git-svn user in SVN projects when I shared log output. Some folks worked with for years in the same offices and never made indication to knowing I used git-svn (even after they started using it themselves).

-- 
Eric Wong
Previous: Jens SeidelNext: Jonathan Nieder
Message 5 of 9 in “git-svn: tweak log format to match "svn log" output”
  1. git-svn: tweak log format to match "svn log" outputJonathan Nieder, Jul 25, 2010
  2. Eric WongJul 25, 2010
  3. 2/1 git svn: remove extraneous newline from log outputEric Wong, Jul 25, 2010
  4. Jens SeidelJul 25, 2010
  5. Eric WongJul 26, 2010
  6. Jonathan NiederJul 25, 2010
  7. Eric WongJul 25, 2010
  8. Jens SeidelJul 25, 2010
  9. Jens SeidelJul 25, 2010

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.