diff options
Diffstat (limited to 'morphlib/git.py')
-rw-r--r-- | morphlib/git.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/morphlib/git.py b/morphlib/git.py index 27f22351..b3dd2c45 100644 --- a/morphlib/git.py +++ b/morphlib/git.py @@ -221,13 +221,12 @@ def clone_into(runcmd, srcpath, targetpath, ref=None): else: runcmd(['git', 'clone', '-b', ref, srcpath, targetpath]) -def find_first_ref(runcmd, gitdir, ref): - '''Find the *first* ref match and returns its sha1.''' - return runcmd(['git', 'show-ref', ref], - cwd=gitdir).split("\n")[0].split(" ")[0] - def is_valid_sha1(ref): '''Checks whether a string is a valid SHA1.''' valid_chars = 'abcdefABCDEF0123456789' return len(ref) == 40 and all([x in valid_chars for x in ref]) + +def rev_parse(runcmd, gitdir, ref): + '''Find the sha1 for the given ref''' + return runcmd(['git', 'rev-parse', ref], cwd=gitdir)[0:40] |