summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-12-13 12:36:07 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-12-13 15:37:53 +0000
commitde50cec19b4f7e4c5a6da5ecc5cddd7a52ac3725 (patch)
tree552fdae98cd0cc15d0b8a23ee225751b1d8ae374 /morphlib/plugins
parentd63c97a0bef1cd2f03ca266acda67cad065632df (diff)
downloadmorph-de50cec19b4f7e4c5a6da5ecc5cddd7a52ac3725.tar.gz
Always use `git rev-parse --verify` to resolve refs
Previously some code used `git show-ref`, which is wrong -- given two refs named 'alpha/master' and 'master', `git show-ref master` will return both, sorted alphabetically. This can lead to build failures, etc. due to refs resolving to the wrong SHAs. We should also use `git rev-parse --verify` to verify SHA1s, which we previously did with `git rev-list`. Finally, `git rev-parse --verify` is more than twice as fast as `git show-ref`.
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index efaa8dfe..31b661b6 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -194,8 +194,8 @@ class BranchAndMergePlugin(cliapp.Plugin):
def resolve_ref(self, repodir, ref):
try:
- return self.app.runcmd(['git', 'show-ref', ref],
- cwd=repodir).split()[0]
+ return self.app.runcmd(['git', 'rev-parse', '--verify', ref],
+ cwd=repodir)[0:40]
except:
return None