summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Mckay <kyle.mckay@codethink.co.uk>2021-11-15 09:44:42 +0000
committerKyle Mckay <kyle.mckay@codethink.co.uk>2021-11-15 09:49:27 +0000
commit6d47378ae269c504bccfc867b3fa00f43bed4601 (patch)
treea266eceb77a78866937505df30ec78a44fac537a
parentbef27f7d13b199bd219828ae9b069fada7535723 (diff)
downloadlorry-6d47378ae269c504bccfc867b3fa00f43bed4601.tar.gz
Use branch ref when getting last commit
- Ensures raw file importer doesn't fail when `init.defaultBranch` is not set to `master` on the machine where lorry is running. - Avoids use of `--initial-branch` on repository init which is only supported in git versions >=2.28.0
-rwxr-xr-xlorry.raw-file-importer6
1 files changed, 3 insertions, 3 deletions
diff --git a/lorry.raw-file-importer b/lorry.raw-file-importer
index 0a63003..bca46b5 100755
--- a/lorry.raw-file-importer
+++ b/lorry.raw-file-importer
@@ -86,13 +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', 'rev-parse', 'HEAD'], capture_output=True, text=True)
+ out = subprocess.run(['git', 'rev-parse', branch_ref], capture_output=True, text=True)
if out.returncode != 0:
return None
- # Will be HEAD when no commits exist yet
+ # Will be same string as input when no commits exist yet
out = out.stdout.strip()
- return None if out == 'HEAD' else out
+ return None if out == branch_ref else out
def main():