# how about this as a basis for git-annotate?

1 messages from 2005-06-30 to 2005-06-30. Participants: lode leroy.
Thread: https://gitlist.dev/t/1058

## lode leroy, 2005-06-30 12:20

Subject: how about this as a basis for git-annotate?
Message-ID: <BAY22-F23ACB8E1D2F394F9318069FFE30@phx.gbl>
URL: https://gitlist.dev/e/BAY22-F23ACB8E1D2F394F9318069FFE30%40phx.gbl

```
#!/bin/bash

file="$1"
anno="$file.anno"
prev=""
export GIT_DIFF_OPTS=-u0

rm $anno
touch $anno

revs=`git-rev-list HEAD | tac`

for rev in $revs; do
	if [ ! -z "$prev" ]; then
		git-diff-tree -p $prev $rev $file \
		| sed 	-e "/^--- /p" \
			-e "/^+++ /p" \
			-e "/^--- /d" \
			-e "/^+++ /d" \
			-e "s/^-/-$prev /g" \
			-e "s/^+/+$rev /g" | patch $anno
	fi
	prev=$rev
done



* gives a warning when the diff is empty
* has a problem with "\ No newline at end of file"

```
