1. If the remote origin url is incorrect , re-clone.
2. If the remote origin url does not exsits re-clone.
Change-Id: I35e6ff2081a96e5da84a3db7b8d6e05dd24f5676
print '\nUpdating local git: %s' % localdir
try:
localgit = Git(localdir)
- if gitpath and localgit.get_remote_repos().get('origin')[0] != gitpath:
- os.system('git --git-dir=%s remote set-url origin %s' % ([localdir,
- os.path.join(localdir, '.git')][localgit.bare], gitpath))
+
+ if gitpath and ((not localgit.get_remote_repos()) \
+ or localgit.get_remote_repos().get('origin')[0] != gitpath):
+ shutil.rmtree(localdir)
+ return False
+
if localgit.bare:
localgit.fetch(all_remotes=True)
else: