mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: allow importing into an empty repo
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
0ecfad479e
commit
e6731225f8
@ -1255,7 +1255,14 @@ def sanity_check(refs, is_bare):
|
|||||||
abort('{} does not match {}'.format(refname, origin_ref))
|
abort('{} does not match {}'.format(refname, origin_ref))
|
||||||
|
|
||||||
def get_refs():
|
def get_refs():
|
||||||
output = subprocess.check_output('git show-ref'.split())
|
try:
|
||||||
|
output = subprocess.check_output('git show-ref'.split())
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
# If error code is 1, there just isn't any refs; i.e. bare repo.
|
||||||
|
# If error code is other than 1, some other error (e.g. not a git repo)
|
||||||
|
if e.returncode != 1:
|
||||||
|
raise SystemExit('fatal: {}'.format(e))
|
||||||
|
output = ''
|
||||||
return dict(reversed(x.split()) for x in output.splitlines())
|
return dict(reversed(x.split()) for x in output.splitlines())
|
||||||
|
|
||||||
def tweak_commit(args, commit):
|
def tweak_commit(args, commit):
|
||||||
|
Loading…
Reference in New Issue
Block a user