Git development
 help / color / mirror / Atom feed
From: "lode leroy" <lode_leroy@hotmail.com>
To: git@vger.kernel.org
Subject: how about this as a basis for git-annotate?
Date: Thu, 30 Jun 2005 15:55:32 +0200	[thread overview]
Message-ID: <BAY22-F40C3079B41F242AEB407E1FFE30@phx.gbl> (raw)

#!/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...?

             reply	other threads:[~2005-06-30 13:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30 13:55 lode leroy [this message]
2005-06-30 20:20 ` how about this as a basis for git-annotate? Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2005-06-30 12:20 lode leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY22-F40C3079B41F242AEB407E1FFE30@phx.gbl \
    --to=lode_leroy@hotmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox