run git from proper directory
This commit is contained in:
@@ -55,10 +55,6 @@ def known_commit_or_tag(ref):
|
|||||||
|
|
||||||
|
|
||||||
def checkout(parser, args):
|
def checkout(parser, args):
|
||||||
deployment_required_args = {'remote': 'origin'}
|
|
||||||
deployment.setup_deployment_args('checkout', args,
|
|
||||||
deployment_required_args)
|
|
||||||
|
|
||||||
remote = args.remote or 'origin'
|
remote = args.remote or 'origin'
|
||||||
url = args.url
|
url = args.url
|
||||||
ref = args.ref
|
ref = args.ref
|
||||||
@@ -66,12 +62,13 @@ def checkout(parser, args):
|
|||||||
global git # make git available to called methods
|
global git # make git available to called methods
|
||||||
git = which('git', required=True)
|
git = which('git', required=True)
|
||||||
|
|
||||||
# Always fetch branches
|
with working_dir(spack.paths.prefix):
|
||||||
branches = map(lambda b: b.strip('* '),
|
# Always fetch branches
|
||||||
git('branch', output=str, error=str).split('\n'))
|
branches = map(lambda b: b.strip('* '),
|
||||||
if ref in branches or not known_commit_or_tag(ref):
|
git('branch', output=str, error=str).split('\n'))
|
||||||
fetch_remote(remote, url)
|
if ref in branches or not known_commit_or_tag(ref):
|
||||||
|
fetch_remote(remote, url)
|
||||||
|
|
||||||
# For branches, ensure we're getting the version from the correct remote
|
# For branches, ensure we're getting the version from the correct remote
|
||||||
full_ref = '%s/%s' % (remote, ref) if ref in branches else ref
|
full_ref = '%s/%s' % (remote, ref) if ref in branches else ref
|
||||||
git('checkout', full_ref)
|
git('checkout', full_ref)
|
||||||
|
|||||||
Reference in New Issue
Block a user