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

A new idea to extend git-blame

From
Chen Bin <chenbin.sh@gmail.com>
Date
Nov 25, 2019, 12:41 UTC
Message-ID
<87o8x06sbw.fsf@sydneypc>
I already implemented the idea in Emacs Lisp. See,
http://blog.binchen.org/posts/effective-git-blame-in-emacs.html
I tested at https://github.com/redguardtoo/test-git-blame
Looks it works.
The only issue is Lisp is slow in big code base.
So I'm thinking I could re-implement it in C instead.
My question is, *who can I contact to understand git-blame?
I'm experienced at C but need some expert's guide.
The key algorithm is simple,

The algorithm only works for one line blame and the user must select text inside the line first.

Step 1, `git blame -L6,1 --porcelain -- hello.js` output,
    4f87408612e0dacfd89a1cd2515944e21cf68561 6 6 1
    skip...
    filename hello.js
     doit({bad: 'destroy world', good: 'hello world', ...});

I got the commit id (1st column), the line number (2nd column), file name (hello.js) and the code line (last line).

Step 2, if the code line does not contain the selected text, the
  recursive search stops
Step 3, or else use commit id, line number and file name to build
  new git blame cli, like,
`git blame -L line-num,1 --porcelain 4f8740^ file-name`
Step 4, execute new git blame command and start from Step 1
Here is my first commit (added some debug code),
https://github.com/redguardtoo/git/commit/d01d26f2df
-- 
Best Regards,
Chen Bin

--
Help me, help you
Next: Jeff King
Message 1 of 8 in “A new idea to extend git-blame”
  1. Chen BinNov 25, 2019
  2. Jeff KingNov 25, 2019
  3. chen binNov 26, 2019
  4. chen binNov 26, 2019
  5. chen binNov 27, 2019
  6. Jeff KingNov 27, 2019
  7. chen binNov 27, 2019
  8. chen binNov 27, 2019

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.