threads / discuss / 1058

how about this as a basis for git-annotate?

Subject: how about this as a basis for git-annotate?

## tl;dr

One message between Jun 30, 2005 and Jun 30, 2005.

replies: 0people: 1as markdown or json

lode leroy· Jun 30, 2005, 12:20 UTC · lore
#!/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"

← back to recent threads