# git-annotate dies when a patch is missing trailing newline

7 messages from 2006-03-02 to 2006-03-02. Participants: Martin Langhoff, Ryan Anderson, Junio C Hamano.
Thread: https://gitlist.dev/t/3510

## Martin Langhoff, 2006-03-02 00:53

Subject: git-annotate dies when a patch is missing trailing newline
Message-ID: <46a038f90603011653l7956d5dat99d88a7da98d21b6@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90603011653l7956d5dat99d88a7da98d21b6%40mail.gmail.com

```
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, 2006-03-02 01:53

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <20060302015303.GA27871@mythryan2.michonline.com>
URL: https://gitlist.dev/e/20060302015303.GA27871%40mythryan2.michonline.com
In-Reply-To: <46a038f90603011653l7956d5dat99d88a7da98d21b6@mail.gmail.com>

```
On Thu, Mar 02, 2006 at 01:53:21PM +1300, Martin Langhoff wrote:
> 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, 2006-03-02 02:07

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <7vwtfdd2fu.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vwtfdd2fu.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060302015303.GA27871@mythryan2.michonline.com>

```
Ryan Anderson <ryan@michonline.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.
>
> 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, 2006-03-02 02:23

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <7vslq1d1pr.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vslq1d1pr.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <46a038f90603011653l7956d5dat99d88a7da98d21b6@mail.gmail.com>

```
"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, 2006-03-02 03:07

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <46a038f90603011907h6d0d4450w426afb9ada33ddb0@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90603011907h6d0d4450w426afb9ada33ddb0%40mail.gmail.com
In-Reply-To: <7vslq1d1pr.fsf@assigned-by-dhcp.cox.net>

```
On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
> "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, 2006-03-02 03:37

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <7voe0pcy9c.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7voe0pcy9c.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <46a038f90603011907h6d0d4450w426afb9ada33ddb0@mail.gmail.com>

```
"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, 2006-03-02 04:10

Subject: Re: git-annotate dies when a patch is missing trailing newline
Message-ID: <46a038f90603012010u2efaee26lef6cd95412fb47cb@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90603012010u2efaee26lef6cd95412fb47cb%40mail.gmail.com
In-Reply-To: <7voe0pcy9c.fsf@assigned-by-dhcp.cox.net>

```
On 3/2/06, Junio C Hamano <junkio@cox.net> wrote:
> "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

```
