diff options
| author | Ben Straub <bs@github.com> | 2013-10-10 14:30:05 -0700 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2013-10-10 14:30:05 -0700 |
| commit | c1ca2b67e1747ff4d2ba5a10ee300497d1d28dbe (patch) | |
| tree | 087214293b80bb557b1ed74c69a336791a581a59 /examples | |
| parent | ebd67243d5152e2c38811ba42fcdf99eecd8ef60 (diff) | |
| download | libgit2-c1ca2b67e1747ff4d2ba5a10ee300497d1d28dbe.tar.gz | |
Include signatures in blame hunks
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/blame.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/blame.c b/examples/blame.c index df687a71a..8ecf2970e 100644 --- a/examples/blame.c +++ b/examples/blame.c @@ -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; |
