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):
return
force_keep = False
if options.get('develop', 'yes').lower() in TRUE_VALUES:
p = subprocess.Popen([options.get('git-executable', 'git'), 'status', '--short'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
print "You have uncommited changes in %s. "\
"This folder will be left as is." % options['location']
force_keep = True
git_path = options.get('git-executable', 'git')
if not os.path.isabs(git_path) or os.path.exists(git_path):
p = subprocess.Popen([git_path, 'status', '--short'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
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'),
'log', '--branches', '--not', '--remotes'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
print "You have commits not pushed upstream in %s. "\
p = subprocess.Popen([git_path,
'log', '--branches', '--not', '--remotes'],
cwd=options['location'],
stdout=subprocess.PIPE)
if p.communicate()[0].strip():
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']
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