mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Include signatures in blame hunks
This commit is contained in:
@@ -128,22 +128,20 @@ int main(int argc, char *argv[])
|
||||
while (i < git_blob_rawsize(blob)) {
|
||||
const char *eol = strchr(rawdata+i, '\n');
|
||||
char oid[10] = {0};
|
||||
git_commit *hunkcommit;
|
||||
const git_signature *sig;
|
||||
const git_blame_hunk *hunk = git_blame_get_hunk_byline(blame, line);
|
||||
|
||||
if (hunk) {
|
||||
char sig[128] = {0};
|
||||
|
||||
git_oid_tostr(oid, 10, &hunk->final_commit_id);
|
||||
check(git_commit_lookup(&hunkcommit, repo, &hunk->final_commit_id), "Commit lookup error");
|
||||
sig = git_commit_author(hunkcommit);
|
||||
snprintf(sig, 30, "%s <%s>", hunk->final_signature->name, hunk->final_signature->email);
|
||||
|
||||
printf("%s ( %-30s %3d) %.*s\n",
|
||||
oid,
|
||||
sig->name,
|
||||
sig,
|
||||
line,
|
||||
(int)(eol-rawdata-i),
|
||||
rawdata+i);
|
||||
git_commit_free(hunkcommit);
|
||||
}
|
||||
|
||||
i = eol - rawdata + 1;
|
||||
|
||||
Reference in New Issue
Block a user