From 8fb867105c63b2c8af588333dadd69ebff3368aa Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 6 Aug 2016 01:18:43 -0300 Subject: [PATCH] eeshow/git-hist.c (vcs_git_get_rev), git-hist.h: revision string from history --- eeshow/git-hist.c | 9 +++++++++ eeshow/git-hist.h | 1 + 2 files changed, 10 insertions(+) diff --git a/eeshow/git-hist.c b/eeshow/git-hist.c index 1baca2f..441a15d 100644 --- a/eeshow/git-hist.c +++ b/eeshow/git-hist.c @@ -187,6 +187,15 @@ struct hist *vcs_git_hist(const char *path) } +char *vcs_git_get_rev(struct hist *h) +{ + const git_oid *oid = git_commit_id(h->commit); + char *s = alloc_size(GIT_OID_HEXSZ + 1); + + return git_oid_tostr(s, GIT_OID_HEXSZ + 1, oid); +} + + const char *vcs_git_summary(struct hist *h) { const char *summary; diff --git a/eeshow/git-hist.h b/eeshow/git-hist.h index 9c394ed..2f89ec5 100644 --- a/eeshow/git-hist.h +++ b/eeshow/git-hist.h @@ -33,6 +33,7 @@ struct hist { bool vcs_git_try(const char *path); struct hist *vcs_git_hist(const char *path); +char *vcs_git_get_rev(struct hist *h); const char *vcs_git_summary(struct hist *hist); void hist_iterate(struct hist *h, void (*fn)(void *user, struct hist *h), void *user);