From: Eric Wong Date: Mon, 26 Jul 2010 19:09:45 GMT Subject: Re: [PATCH 2/1] git svn: remove extraneous newline from log output Message-ID: <20100726190945.GA2727@dcvr.yhbt.net> In-Reply-To: <20100725173549.GA7930@merkur.sol.de> Jens Seidel wrote: > 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