tools/github-fetch: handle non-fast-forward merges

We don't particularly care if someone force-pushed master, just fetch
the latest repo.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-10-31 16:20:51 +13:00
parent f2daec4318
commit 17ced0ee38

View File

@ -60,7 +60,9 @@ def fetchall(args):
outpath = os.path.join(args.outdir, name) outpath = os.path.join(args.outdir, name)
if os.path.exists(outpath): if os.path.exists(outpath):
print('Update %s' % outpath) print('Update %s' % outpath)
ret = subprocess.call(['git', 'pull'], cwd=outpath) ret = subprocess.call(['git', 'fetch'], cwd=outpath)
if ret == 0:
ret = subprocess.call(['git', 'reset', '--hard', 'FETCH_HEAD'], cwd=outpath)
else: else:
print('Fetch %s' % clone_url) print('Fetch %s' % clone_url)
ret = subprocess.call(['git', 'clone', clone_url, name], cwd=args.outdir) ret = subprocess.call(['git', 'clone', clone_url, name], cwd=args.outdir)