diff options
-rwxr-xr-x | lorry.raw-file-importer | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lorry.raw-file-importer b/lorry.raw-file-importer index 1203e20..0a63003 100755 --- a/lorry.raw-file-importer +++ b/lorry.raw-file-importer @@ -86,10 +86,13 @@ def commit_lfs_file(raw_file, relative_path, last_commit, fast_import): def get_last_commit(): # show the full hash of the latest commit - out = subprocess.run(['git', 'log', '-n1', '--format=format:%H'], capture_output=True, text=True) + out = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True, text=True) if out.returncode != 0: return None - return out.stdout.strip() + + # Will be HEAD when no commits exist yet + out = out.stdout.strip() + return None if out == 'HEAD' else out def main(): |