From 894315aa1b1d3ad73495b962fe9f808d9ad39caa Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 16 Sep 2024 22:04:25 +0200 Subject: [PATCH] Include wlroots checkout helper for bisecting --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f043f7a7..72a8fd110 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -243,3 +243,29 @@ error_session: return NULL; } ``` + +## Bisecting + +When bisecting, it is often necessary to build older commits with their +contemporary version of wlroots: + +```python +#!/usr/bin/env python3 +# +# Check out the wlroots commit that was the current master at the time that the current +# sway HEAD was committed. Requires pygit2. E.g.: apk add py3-pygit2 + +import pygit2 + +sway = pygit2.Repository(".") +head = sway.revparse_single("HEAD") +sway_time = head.commit_time + +wlroots = pygit2.Repository("subprojects/wlroots") +master = wlroots.revparse_single("master") +for commit in wlroots.walk(master.id, pygit2.enums.SortMode.TIME): + if commit.commit_time < sway_time: + break + +wlroots.checkout_tree(commit) +```