launcher: make missing .repo/repo/repo an error

If the specified repo dir doesn't actually have a `repo` program,
we only show a warning before continuing on, and then we fail in
weird ways.  Since we really need the repo dir to contain repo,
have this be fatal and delete the results.

Bug: https://crbug.com/gerrit/13526
Change-Id: Icee4cba96136d470cbb459a81918c40205078f98
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343538
Reviewed-by: LaMont Jones <lamontjones@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2022-08-19 05:17:49 -04:00
parent a010a9f4a0
commit d75ca2eb9d

5
repo
View File

@ -624,8 +624,9 @@ def _Init(args, gitc_init=False):
_Checkout(dst, remote_ref, rev, opt.quiet) _Checkout(dst, remote_ref, rev, opt.quiet)
if not os.path.isfile(os.path.join(dst, 'repo')): if not os.path.isfile(os.path.join(dst, 'repo')):
print("warning: '%s' does not look like a git-repo repository, is " print("fatal: '%s' does not look like a git-repo repository, is "
"REPO_URL set correctly?" % url, file=sys.stderr) "--repo-url set correctly?" % url, file=sys.stderr)
raise CloneFailure()
os.rename(dst, dst_final) os.rename(dst, dst_final)