From d9eaa16eea0ac90271b5bd92db6e9e1604a5248d Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 4 Feb 2019 11:20:09 -0700 Subject: [PATCH] bootstrapper: don't use git -C dir Older versions of git don't support this. Since subprocess.check_call() supports a cwd kwarg which provides equivalent functionality, use that instead. Signed-off-by: Marti Bolivar --- src/west/_bootstrap/main.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/west/_bootstrap/main.py b/src/west/_bootstrap/main.py index 87a51d5..d869f00 100644 --- a/src/west/_bootstrap/main.py +++ b/src/west/_bootstrap/main.py @@ -112,32 +112,33 @@ def clone(desc, url, rev, dest, exist_ok=False): dest)) local_rev = False subprocess.check_call(('git', 'init', dest)) - subprocess.check_call(('git', '-C', dest, 'remote', 'add', 'origin', - '--', url)) + subprocess.check_call(('git', 'remote', 'add', 'origin', '--', url), + cwd=dest) is_sha = _is_sha(rev) if is_sha: # Fetch the ref-space and hope the SHA is contained in that ref-space - subprocess.check_call(('git', '-C', dest, 'fetch', 'origin', '--tags', - '--', 'refs/heads/*:refs/remotes/origin/*')) + subprocess.check_call(('git', 'fetch', 'origin', '--tags', + '--', 'refs/heads/*:refs/remotes/origin/*'), + cwd=dest) else: # Fetch the ref-space similar to git clone plus the ref given by user. # Redundancy is ok, as example if user specify 'heads/master'. # This allows users to specify: pull//head for pull requests - subprocess.check_call(('git', '-C', dest, 'fetch', 'origin', '--tags', - '--', rev, - 'refs/heads/*:refs/remotes/origin/*')) + subprocess.check_call(('git', 'fetch', 'origin', '--tags', '--', rev, + 'refs/heads/*:refs/remotes/origin/*'), + cwd=dest) try: # Using show-ref to determine if rev is available in local repo. - subprocess.check_call(('git', '-C', dest, 'show-ref', '--', rev)) + subprocess.check_call(('git', 'show-ref', '--', rev), cwd=dest) local_rev = True except subprocess.CalledProcessError: pass if local_rev or is_sha: - subprocess.check_call(('git', '-C', dest, 'checkout', rev)) + subprocess.check_call(('git', 'checkout', rev), cwd=dest) else: - subprocess.check_call(('git', '-C', dest, 'checkout', 'FETCH_HEAD')) + subprocess.check_call(('git', 'checkout', 'FETCH_HEAD'), cwd=dest) #