diff options
author | Eric Wong <e@80x24.org> | 2020-12-25 10:21:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-12-26 06:22:56 +0000 |
commit | 9a17bc230973405b0656bf05fb76902d46627ffa (patch) | |
tree | 73b6e4dfe1b751b924d9d46a9d6faa36a3447d4d | |
parent | 66518051763825d491d0c1df6837d4266edc180a (diff) | |
download | public-inbox-9a17bc230973405b0656bf05fb76902d46627ffa.tar.gz |
We only rely on git-rev-parse to resolve symbolic names ("HEAD") to a SHA-* git commit ID. We'll assume any git commit IDs we get from SQLite DBs are valid and let "git-log" fail if it isn't.
-rw-r--r-- | lib/PublicInbox/V2Writable.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index ca52874b..f20b5c7f 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -1104,12 +1104,14 @@ sub sync_prepare ($$) { -d $git_dir or next; # missing epochs are fine my $git = PublicInbox::Git->new($git_dir); my $unit = { git => $git, epoch => $i }; + my $tip; if ($reindex_heads) { - $head = $reindex_heads->[$i] or next; + $tip = $head = $reindex_heads->[$i] or next; + } else { + $tip = $git->qx(qw(rev-parse -q --verify), $head); + next if $?; # new repo + chomp $tip; } - chomp(my $tip = $git->qx(qw(rev-parse -q --verify), $head)); - next if $?; # new repo - my $range = log_range($sync, $unit, $tip) or next; # can't use 'rev-list --count' if we use --diff-filter $pr->("$pfx $i.git counting $range ... ") if $pr; |