diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-04-19 11:34:23 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-04-19 11:34:23 +0200 |
commit | 6960ee929dcf95c24e0db761fd4bc46c3749abb2 (patch) | |
tree | 02b85e567301effc3511b45bad2cf05e637ddc84 /src/libutil | |
parent | 46cb15df9b3501ca631779fa7d5c6299c1c17b53 (diff) |
Clean up exportGit argument handling
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/hash.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/hash.hh b/src/libutil/hash.hh index 2dbc3b630..edede8ace 100644 --- a/src/libutil/hash.hh +++ b/src/libutil/hash.hh @@ -80,6 +80,18 @@ struct Hash or base-64. By default, this is prefixed by the hash type (e.g. "sha256:"). */ std::string to_string(Base base = Base32, bool includeType = true) const; + + std::string gitRev() const + { + assert(type == htSHA1); + return to_string(Base16, false); + } + + std::string gitShortRev() const + { + assert(type == htSHA1); + return std::string(to_string(Base16, false), 0, 7); + } }; |