Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: scm.py

Issue 10693008: Fix skipping update for git dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 0b617c62aaedb3ef8abdad11b86e19513336a4a1..35d11a4c4a3530e099abfd57f0a4977953747af1 100644
--- a/scm.py
+++ b/scm.py
@@ -405,6 +405,12 @@ class GIT(object):
@staticmethod
def IsValidRevision(cwd, rev):
"""Verifies the revision is a proper git revision."""
+ # 'git rev-parse foo' where foo is *any* 40 character hex string will return
+ # the string and return code 0. So strip one character to force 'git
+ # rev-parse' to do a hash table look-up and returns 128 if the hash is not
+ # present.
+ if re.match(r'^[0-9a-fA-F]{40}$', rev):
+ rev = rev[:-1]
try:
GIT.Capture(['rev-parse', rev], cwd=cwd)
return True
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698