git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: using git-blame with patches as input

From
DZDon Zickus <dzickus@redhat.com>
Date
Jun 17, 2008, 14:15 UTC
Message-ID
<20080617141519.GK16941@redhat.com>
In-Reply-To
<7vej6x9hpk.fsf@gitster.siamese.dyndns.org>
On Mon, Jun 16, 2008 at 02:45:59PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> Don Zickus <dzickus@redhat.com> writes:
> 
> > I deal with a lot of backported patches that are a combination of multiple
> > commits.  I was looking to develop a tool that would help me determine
> > which chunks of the patch are upstream (not necessarily currently in HEAD
> > but at some point in the file's history).
> >
> > For example, if I took the top three commits from HEAD and appended them
> > into one patch file and then ran this tool with the patch as input, I
> > would hope that it gave as output the three original commits.
> 
> A quick and dirty hack would be to:
> 
> 	rm .git/index
> 	sed -ne 's/^[+ ]//p' -e '/^@@/p' patches... >file
>         git add file
>         git commit -m 'only "a file" remains'
>         git blame -C -C -w file
> 
> which would try blaming all the postimage concatenated together ;-)
Heh.  Interesting.  I'll try that today.  Thanks.

Cheers, Don

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “using git-blame with patches as input”
  1. Don ZickusJun 16, 2008
  2. Junio C HamanoJun 16, 2008
  3. Don ZickusJun 17, 2008
  4. Junio C HamanoJun 16, 2008
  5. Junio C HamanoJun 16, 2008
  6. Don ZickusJun 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.