Skip to content

Commit f7c84a6

Browse files
committed
git-review-rebase: unambiguously interpret refspec as a commit.
This avoids an annoying and sometimes cryptic error when passing ranges with a tag, as they'd internally to pygit2 resolve to the tag object as opposed to the commit object. Tested that it still works with sha1s, refs, tags. Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
1 parent 6b38140 commit f7c84a6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • scripts/git-review-rebase/src/git_review_rebase

scripts/git-review-rebase/src/git_review_rebase/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,23 @@ def on_mount(self) -> None:
127127
async def load_ranges(self) -> None:
128128
assert self.rebase_table is not None
129129
merge_base = self.repo.merge_base(
130-
oid(self.repo, self.args.left_range.split("..")[1]),
131-
oid(self.repo, self.args.right_range.split("..")[1]),
130+
oid(self.repo, self.args.left_range.split("..")[1] + "^{commit}"),
131+
oid(self.repo, self.args.right_range.split("..")[1] + "^{commit}"),
132132
)
133133
self.left_range = await asyncio.to_thread(
134134
BranchRange,
135135
self.args,
136136
self.repo,
137-
self.args.left_range.split("..")[0],
138-
self.args.left_range.split("..")[1],
137+
self.args.left_range.split("..")[0] + "^{commit}",
138+
self.args.left_range.split("..")[1] + "^{commit}",
139139
self.args.cache_flags,
140140
)
141141
self.right_range = await asyncio.to_thread(
142142
BranchRange,
143143
self.args,
144144
self.repo,
145-
self.args.right_range.split("..")[0],
146-
self.args.right_range.split("..")[1],
145+
self.args.right_range.split("..")[0] + "^{commit}",
146+
self.args.right_range.split("..")[1] + "^{commit}",
147147
self.args.cache_flags,
148148
merge_base=merge_base,
149149
)

0 commit comments

Comments
 (0)