diff options
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1102,12 +1102,18 @@ def _SetDefaultsTo(gitdir): | |||
1102 | global REPO_REV | 1102 | global REPO_REV |
1103 | 1103 | ||
1104 | REPO_URL = gitdir | 1104 | REPO_URL = gitdir |
1105 | try: | 1105 | ret = run_git('--git-dir=%s' % gitdir, 'symbolic-ref', 'HEAD', check=False) |
1106 | ret = run_git('--git-dir=%s' % gitdir, 'symbolic-ref', 'HEAD') | 1106 | if ret.returncode: |
1107 | REPO_REV = ret.stdout.strip() | 1107 | # If we're not tracking a branch (bisect/etc...), then fall back to commit. |
1108 | except CloneFailure: | 1108 | print('repo: warning: %s has no current branch; using HEAD' % gitdir, |
1109 | print('fatal: %s has no current branch' % gitdir, file=sys.stderr) | 1109 | file=sys.stderr) |
1110 | sys.exit(1) | 1110 | try: |
1111 | ret = run_git('rev-parse', 'HEAD', cwd=gitdir) | ||
1112 | except CloneFailure: | ||
1113 | print('fatal: %s has invalid HEAD' % gitdir, file=sys.stderr) | ||
1114 | sys.exit(1) | ||
1115 | |||
1116 | REPO_REV = ret.stdout.strip() | ||
1111 | 1117 | ||
1112 | 1118 | ||
1113 | def main(orig_args): | 1119 | def main(orig_args): |