Commit 3ffdd641 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Julien Muchembled

gitclone: Assume unclean on uninstall when git-executable cannot be found

parent 34fc3e01
...@@ -293,20 +293,26 @@ def uninstall(name, options): ...@@ -293,20 +293,26 @@ def uninstall(name, options):
return return
force_keep = False force_keep = False
if options.get('develop', 'yes').lower() in TRUE_VALUES: if options.get('develop', 'yes').lower() in TRUE_VALUES:
p = subprocess.Popen([options.get('git-executable', 'git'), 'status', '--short'], git_path = options.get('git-executable', 'git')
cwd=options['location'], if not os.path.isabs(git_path) or os.path.exists(git_path):
stdout=subprocess.PIPE) p = subprocess.Popen([git_path, 'status', '--short'],
if p.communicate()[0].strip(): cwd=options['location'],
print "You have uncommited changes in %s. "\ stdout=subprocess.PIPE)
"This folder will be left as is." % options['location'] if p.communicate()[0].strip():
force_keep = True print "You have uncommited changes in %s. "\
"This folder will be left as is." % options['location']
force_keep = True
p = subprocess.Popen([options.get('git-executable', 'git'), p = subprocess.Popen([git_path,
'log', '--branches', '--not', '--remotes'], 'log', '--branches', '--not', '--remotes'],
cwd=options['location'], cwd=options['location'],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
if p.communicate()[0].strip(): if p.communicate()[0].strip():
print "You have commits not pushed upstream in %s. "\ print "You have commits not pushed upstream in %s. "\
"This folder will be left as is." % options['location']
force_keep = True
else:
print "Cannot check if there are unpushed/uncommitted changes in %s. "\
"This folder will be left as is." % options['location'] "This folder will be left as is." % options['location']
force_keep = True force_keep = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment