git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* how about this as a basis for git-annotate?
@ 2005-06-30 13:55 lode leroy
  2005-06-30 20:20 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: lode leroy @ 2005-06-30 13:55 UTC (permalink / raw)
  To: git

#!/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"

What I tried to do is to reconstruct the file from the diffs,
and prefixing each line with the sha1 of the revision.

After further testing, I see that the implementation I provided does not 
work,
because the context is not necessarily from the previous version, but from 
/a/ previous version.
Still the idea should work.
So patch needs to ignore the sha1 of the revision.
Maybe git-apply can be modified to do this...?

^ permalink raw reply	[flat|nested] 3+ messages in thread
* how about this as a basis for git-annotate?
@ 2005-06-30 12:20 lode leroy
  0 siblings, 0 replies; 3+ messages in thread
From: lode leroy @ 2005-06-30 12:20 UTC (permalink / raw)
  To: git

#!/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"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-30 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-30 13:55 how about this as a basis for git-annotate? lode leroy
2005-06-30 20:20 ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2005-06-30 12:20 lode leroy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).