Skip to content

Commit 71478ed

Browse files
committed
Fix graphql history issue
When a workspace is created, it includes commits of history of the mapped modules. Since find_original is unable to trace them back to their original commit we need to skip them, like we skip commits from the right side of the merges Change-Id: history_fix
1 parent caa1588 commit 71478ed

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/graphql.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,21 @@ impl Revision {
205205
{
206206
rs_tracing::trace_scoped!("walk");
207207
for i in 0..ids.len() {
208-
ids[i] =
208+
let orig =
209209
history::find_original(&transaction, self.filter, contained_in, ids[i], true)?;
210-
contained_in = transaction
211-
.repo()
212-
.find_commit(ids[i])?
213-
.parent_ids()
214-
.next()
215-
.unwrap_or(ids[i]);
210+
211+
if orig != git2::Oid::zero() {
212+
ids[i] = orig;
213+
contained_in = transaction
214+
.repo()
215+
.find_commit(ids[i])?
216+
.parent_ids()
217+
.next()
218+
.unwrap_or(ids[i]);
219+
} else {
220+
ids.truncate(i);
221+
break;
222+
}
216223
}
217224
}
218225

tests/filter/graphql_history.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
> EOF
4242

4343
$ josh-filter -g "$(cat query2)"
44-
null
44+
{"rev":{"history":[{"summary":"add ws"}]}}

0 commit comments

Comments
 (0)