Re: how to track the history of a line in a file

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: david
Date: Friday, January 2, 2009 - 4:01 pm

On Fri, 2 Jan 2009, Jeff King wrote:


Ok, I hacked togeather a quick bash script to try this

#!/bin/bash
line=`git blame -L /$1/,+1 -M $2`
COMMIT=`echo $line |cut -f 1 -d " "`
foundline=`echo $line |cut -f 6 -d " "|sed s/")"//`
echo "$foundline $COMMIT"
echo "$line"
while [ "$COMMIT" != "" ] ;do
echo "git blame -L $foundline,+1 -M $2 $COMMIT^"
line=`git blame -L $foundline,+1 -M $2 $COMMIT^`
COMMIT=`echo $line |cut -f 1 -d " "`
foundline=`echo $line |cut -f 6 -d " "|sed s/")"//`
echo "$line"
done


the problem that this has is that line 3 of $COMMIT may not be line 3 of 
$COMMIT^, and if they aren't it ends up hunting down the wrong data

either that or I am not understanding the output of git blame properly 
(also very possible)

David Lang
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: how to track the history of a line in a file, Jeff King, (Fri Jan 2, 2:26 pm)
Re: how to track the history of a line in a file, Jeff Whiteside, (Fri Jan 2, 2:49 pm)
Re: how to track the history of a line in a file, Junio C Hamano, (Fri Jan 2, 3:54 pm)
Re: how to track the history of a line in a file, david, (Fri Jan 2, 4:01 pm)
Re: how to track the history of a line in a file, Thomas Rast, (Fri Jan 2, 5:07 pm)
Re: how to track the history of a line in a file, Bernt Hansen, (Tue Jan 6, 8:48 am)
Re: how to track the history of a line in a file, Miklos Vajna, (Tue Jan 6, 9:08 am)
Re: how to track the history of a line in a file, Bernt Hansen, (Tue Jan 6, 9:21 am)
Re: how to track the history of a line in a file, Bernt Hansen, (Tue Jan 6, 9:28 am)