Skip to content

Commit fe33fc4

Browse files
committed
filter-repo: avoid dying with --analyze on commits with unseen parents
analyze_commit() calls add_commit_and_parents() which does a sanity check that we have seen all parents previously. --refs breaks that assumption, so we need to workaround that check when ref limiting is in effect. Signed-off-by: Elijah Newren <[email protected]>
1 parent 46549e7 commit fe33fc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

git-filter-repo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,12 @@ class RepoAnalyze(object):
23392339
filenames = [PathQuoting.dequote(x) for x in splits[1:]]
23402340
file_changes.append([modes, shas, change_types, filenames])
23412341

2342+
# If someone is trying to analyze a subset of the history, make sure
2343+
# to avoid dying on commits with parents that we haven't seen before
2344+
if args.refs:
2345+
graph.record_external_commits([p for p in parents
2346+
if not p in graph.value])
2347+
23422348
# Analyze this commit and update progress
23432349
RepoAnalyze.analyze_commit(stats, graph, commit, parents, date,
23442350
file_changes)

0 commit comments

Comments
 (0)