From: Chen Bin <chenbin.sh@gmail•com>
To: git@vger•kernel.org
Subject: A new idea to extend git-blame
Date: Mon, 25 Nov 2019 23:41:55 +1100 [thread overview]
Message-ID: <87o8x06sbw.fsf@sydneypc> (raw)
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 reply other threads:[~2019-11-25 12:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-25 12:41 Chen Bin [this message]
2019-11-25 14:16 ` A new idea to extend git-blame Jeff King
2019-11-26 4:55 ` chen bin
2019-11-26 5:36 ` chen bin
2019-11-27 7:32 ` chen bin
2019-11-27 11:30 ` Jeff King
2019-11-27 12:18 ` chen bin
2019-11-27 13:38 ` chen bin
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=87o8x06sbw.fsf@sydneypc \
--to=chenbin.sh@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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