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

Unified Diff: git_cl.py

Issue 792933003: Add checks to GitSanityChecks (upstream branch or current branch can be None) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years 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 | git_common.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index d9b80aa7000ccc98bcc1cd57d6a733c9a2eddc57..39b54d2f5e62b058b9a38f32f5f10a55c84c22a1 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -641,6 +641,15 @@ or verify this branch is set up to track another (via the --track argument to
def GitSanityChecks(self, upstream_git_obj):
"""Checks git repo status and ensures diff is from local commits."""
+ if upstream_git_obj is None:
+ if self.GetBranch() is None:
+ print >> sys.stderr, (
+ 'ERROR: unable to dertermine current branch (detached HEAD?)')
+ else:
+ print >> sys.stderr, (
+ 'ERROR: no upstream branch')
+ return False
+
# Verify the commit we're diffing against is in our current branch.
upstream_sha = RunGit(['rev-parse', '--verify', upstream_git_obj]).strip()
common_ancestor = RunGit(['merge-base', upstream_sha, 'HEAD']).strip()
« no previous file with comments | « no previous file | git_common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698