threads / discuss / 3510

git-annotate dies when a patch is missing trailing newline

Subject: git-annotate dies when a patch is missing trailing newline

## tl;dr

7 messages between Mar 2, 2006 and Mar 2, 2006.

replies: 6people: 3as markdown or json

Martin Langhoff· Mar 2, 2006, 00:53 UTC · lore
Ryan, (& list)

git-annotate is dying when a patch is missing trailing newline. There _are_ valid situations where code files are not expected to have trailing newlines. Just thing of that glorious programming language, PHP.

(Ducks).

Actually, 99% of my usage of git is tracking CVS projects so this is a bit of a problem.

I had fixed it in Johannes version, but I'm lost as to where to fix it in the current git-annotate. Help?

martin
Ryan Anderson· Mar 2, 2006, 01:53 UTC · re: Martin Langhoff · lore

Re: git-annotate dies when a patch is missing trailing newline

On Thu, Mar 02, 2006 at 01:53:21PM +1300, Martin Langhoff wrote:
Show 14 quoted lines
> Ryan, (& list)
> 
> git-annotate is dying when a patch is missing trailing newline. There
> _are_ valid situations where code files are not expected to have
> trailing newlines. Just thing of that glorious programming language,
> PHP.
> 
> (Ducks).
> 
> Actually, 99% of my usage of git is tracking CVS projects so this is a
> bit of a problem.
> 
> I had fixed it in Johannes version, but I'm lost as to where to fix it
> in the current git-annotate. Help?

Can you point me at a tree that has this problem? I'll see what I can do about fixing it tonight.

-- 
Ryan Anderson
  sometimes Pug Majere
Junio C Hamano· Mar 2, 2006, 02:07 UTC · re: Ryan Anderson · lore

Re: git-annotate dies when a patch is missing trailing newline

Ryan Anderson <ryan@michonline.com> writes:
Show 7 quoted lines
>> git-annotate is dying when a patch is missing trailing newline. There
>> _are_ valid situations where code files are not expected to have
>> trailing newlines. Just thing of that glorious programming language,
>> PHP.
>
> Can you point me at a tree that has this problem?  I'll see what I can
> do about fixing it tonight.

$ cat script #!/bin/sh

mkdir test-dir || exit cd test-dir git init-db echo 'A quick brown fox jumps over the' >file echo 'lazy dog' | tr -d '\012' >>file git add file git commit -a -m 'Initial.' echo 'A quick brown fox jumps over the' >file echo 'lazy dog' | tr -d '\012' >>file git commit -a -m 'Second.'

git annotate file
$ rm -fr test-dir
$ sh script
defaulting to local storage area
Committing initial tree 2850f9a320885b57bb410baffe972b19b17e9270
Use of uninitialized value in string ne at /home/junio/bin/Linux/git-annotate line 308, <$kid> line 10.
Use of uninitialized value in sprintf at /home/junio/bin/Linux/git-annotate line 309, <$kid> line 10.
Line 3 (3) does not match:
| No newline at end of file
|
1e698bcc5b142b542bf99a1a6f17864bc709dbf5 => 780bca516444e94219d4158b7fea97e763dcee6e
$ echo $?
9
$ exit
Junio C Hamano· Mar 2, 2006, 02:23 UTC · re: Martin Langhoff · lore

Re: git-annotate dies when a patch is missing trailing newline

"Martin Langhoff" <martin.langhoff@gmail.com> writes:
> git-annotate is dying when a patch is missing trailing newline. There
> _are_ valid situations where code files are not expected to have
> trailing newlines. Just thing of that glorious programming language,
> PHP.
Does this help?
---
diff --git a/git-annotate.perl b/git-annotate.perl
index f9c2c6c..d30eba7 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -304,6 +304,10 @@ sub _git_diff_parse {
 			}
 			$ri++;
 
+		} elsif (m/^\\/) {
+	
+			; # ignore for now...
+
 		} else {
 			if (substr($_,1) ne get_line($slines,$ri) ) {
 				die sprintf("Line %d (%d) does not match:\n|%s\n|%s\n%s => %s\n",
Martin Langhoff· Mar 2, 2006, 03:07 UTC · re: Junio C Hamano · lore

Re: git-annotate dies when a patch is missing trailing newline

On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
Show 8 quoted lines
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
>
> > git-annotate is dying when a patch is missing trailing newline. There
> > _are_ valid situations where code files are not expected to have
> > trailing newlines. Just thing of that glorious programming language,
> > PHP.
>
> Does this help?

Yes, excellent! BTW, I just realized that git-cvsserver is in master, but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is anything holding the patch back in next?

cheers,
martin
Junio C Hamano· Mar 2, 2006, 03:37 UTC · re: Martin Langhoff · lore

Re: git-annotate dies when a patch is missing trailing newline

"Martin Langhoff" <martin.langhoff@gmail.com> writes:
> Yes, excellent! BTW, I just realized that git-cvsserver is in master,
> but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is
> anything holding the patch back in next?
Is -S in next?
Martin Langhoff· Mar 2, 2006, 04:10 UTC · re: Junio C Hamano · lore

Re: git-annotate dies when a patch is missing trailing newline

On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
Show 7 quoted lines
> "Martin Langhoff" <martin.langhoff@gmail.com> writes:
>
> > Yes, excellent! BTW, I just realized that git-cvsserver is in master,
> > but the "git-annotate -S" patch isn't there, so cvs annotate dies. Is
> > anything holding the patch back in next?
>
> Is -S in next?

Yes, but broken since it switched to Getopt::Long (grumble...). Patch should be hitting the list now, you can also pull it from my repo.

cheers,
martin

← back to recent threads