diff --git a/community/git-branchless/APKBUILD b/community/git-branchless/APKBUILD index 1c900397820ae9ab08d809afa37f257dcdb37e8a..5ea6c7d60340ccfe31f4a85682ae0a598abad01f 100644 --- a/community/git-branchless/APKBUILD +++ b/community/git-branchless/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=git-branchless pkgver=0.8.0 -pkgrel=0 +pkgrel=1 pkgdesc="Suite of tools to help you visualize, navigate, manipulate, and repair your commit graph" url="https://github.com/arxanas/git-branchless" # riscv64: test fails @@ -23,6 +23,8 @@ checkdepends=" " source="https://github.com/arxanas/git-branchless/archive/v$pkgver/git-branchless-$pkgver.tar.gz unbundle-sqlite.patch + fix-git-2.44-auto_merge.patch + fix-tests-git-2.42.patch " options="net" @@ -69,4 +71,6 @@ package() { sha512sums=" ad3435948ffabe256fff2f7b0fe654818fc280049fea0df845ce593ccd713faf5988c843062cfae28c10641c84ed15abaeb0ae774d21e88364f83c0c82852964 git-branchless-0.8.0.tar.gz a6edb671e188bb53cbe43c760c922233ed9e2e7cfdc3d2a32a020dfb847cff413a0c30333d03e76acf920459c438672cd2b975d515b57bfddd1ecc1bbceb1de4 unbundle-sqlite.patch +d4a259751283137034b662b29de66203f54caf72be8549e2bde5e65b5c7dc193feb5b3b5f3e9b91d7bda7b2bfab9c4fc28e3f58ee859308835beeb429d527e13 fix-git-2.44-auto_merge.patch +055e3f3559b0d5eefc1a43e2fde0cfadff631ec4bf28de720dc7f6ba502687be94748afe63cf5698288d34d843b92b3b7bef174e12f61914e9945d782e9f4eda fix-tests-git-2.42.patch " diff --git a/community/git-branchless/fix-git-2.44-auto_merge.patch b/community/git-branchless/fix-git-2.44-auto_merge.patch new file mode 100644 index 0000000000000000000000000000000000000000..deefa050797d0de57fb8f4382001d9bce7ea7855 --- /dev/null +++ b/community/git-branchless/fix-git-2.44-auto_merge.patch @@ -0,0 +1,165 @@ +Patch-Source: https://github.com/arxanas/git-branchless/commit/8b1ae8b29f2abf10e5585d48cea4bd85862a529b +-- +From 8b1ae8b29f2abf10e5585d48cea4bd85862a529b Mon Sep 17 00:00:00 2001 +From: Waleed Khan <me@waleedkhan.name> +Date: Sun, 18 Feb 2024 16:36:55 -0800 +Subject: [PATCH] tests: Try to fix failing `git-next` tests + +--- + git-branchless-lib/src/core/eventlog.rs | 8 +++++++- + git-branchless-lib/src/testing.rs | 7 +++++++ + git-branchless-lib/tests/test_eventlog.rs | 4 ++++ + git-branchless/tests/test_bug_report.rs | 2 +- + git-branchless/tests/test_eventlog.rs | 2 +- + git-branchless/tests/test_hooks.rs | 2 +- + git-branchless/tests/test_undo.rs | 8 ++++++-- + git-branchless/tests/test_wrap.rs | 5 +++-- + 8 files changed, 30 insertions(+), 8 deletions(-) + +diff --git a/git-branchless-lib/src/core/eventlog.rs b/git-branchless-lib/src/core/eventlog.rs +index 31fce007d..bcdc214d1 100644 +--- a/git-branchless-lib/src/core/eventlog.rs ++++ b/git-branchless-lib/src/core/eventlog.rs +@@ -710,7 +710,13 @@ pub fn should_ignore_ref_updates(reference_name: &ReferenceName) -> bool { + + matches!( + reference_name.as_str(), +- "ORIG_HEAD" | "CHERRY_PICK" | "REBASE_HEAD" | "CHERRY_PICK_HEAD" | "FETCH_HEAD" ++ "ORIG_HEAD" ++ | "CHERRY_PICK" ++ | "REBASE_HEAD" ++ | "CHERRY_PICK_HEAD" ++ // From Git's `is_special_ref` in `refs.c`: ++ | "AUTO_MERGE" ++ | "FETCH_HEAD" + ) + } + +diff --git a/git-branchless-lib/src/testing.rs b/git-branchless-lib/src/testing.rs +index 6799bc5f8..d1cea37a6 100644 +--- a/git-branchless-lib/src/testing.rs ++++ b/git-branchless-lib/src/testing.rs +@@ -654,6 +654,13 @@ then you can only run tests in the main `git-branchless` and \ + Ok(version >= GitVersion(2, 27, 0)) + } + ++ /// Git v2.44 produces `AUTO_MERGE` refs as part of some operations, which ++ /// changes the event log according to the `reference-transaction` hook. ++ pub fn produces_auto_merge_refs(&self) -> eyre::Result<bool> { ++ let version = self.get_version()?; ++ Ok(version >= GitVersion(2, 44, 0)) ++ } ++ + /// Resolve a file during a merge or rebase conflict with the provided + /// contents. + #[instrument] +diff --git a/git-branchless-lib/tests/test_eventlog.rs b/git-branchless-lib/tests/test_eventlog.rs +index 461019b70..e69e44fb6 100644 +--- a/git-branchless-lib/tests/test_eventlog.rs ++++ b/git-branchless-lib/tests/test_eventlog.rs +@@ -46,6 +46,10 @@ fn test_drop_non_meaningful_events() -> eyre::Result<()> { + fn test_different_event_transaction_ids() -> eyre::Result<()> { + let git = make_git()?; + ++ if git.produces_auto_merge_refs()? { ++ return Ok(()); ++ } ++ + git.init_repo()?; + git.commit_file("test1", 1)?; + git.branchless("hide", &["--no-delete-branches", "HEAD"])?; +diff --git a/git-branchless/tests/test_bug_report.rs b/git-branchless/tests/test_bug_report.rs +index 5788024eb..0cc1596c3 100644 +--- a/git-branchless/tests/test_bug_report.rs ++++ b/git-branchless/tests/test_bug_report.rs +@@ -16,7 +16,7 @@ fn redact_timestamp(str: String) -> String { + fn test_bug_report() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + git.init_repo()?; +diff --git a/git-branchless/tests/test_eventlog.rs b/git-branchless/tests/test_eventlog.rs +index cc2cbf9e6..21b51fd6a 100644 +--- a/git-branchless/tests/test_eventlog.rs ++++ b/git-branchless/tests/test_eventlog.rs +@@ -8,7 +8,7 @@ use lib::testing::make_git; + fn test_git_v2_31_events() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + +diff --git a/git-branchless/tests/test_hooks.rs b/git-branchless/tests/test_hooks.rs +index 57fc5d4b7..7acb6e278 100644 +--- a/git-branchless/tests/test_hooks.rs ++++ b/git-branchless/tests/test_hooks.rs +@@ -222,7 +222,7 @@ fn test_pre_auto_gc() -> eyre::Result<()> { + fn test_merge_commit_recorded() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + +diff --git a/git-branchless/tests/test_undo.rs b/git-branchless/tests/test_undo.rs +index 8cd289427..9bf46e7f1 100644 +--- a/git-branchless/tests/test_undo.rs ++++ b/git-branchless/tests/test_undo.rs +@@ -136,7 +136,7 @@ fn test_undo_help() -> eyre::Result<()> { + fn test_undo_navigate() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + +@@ -225,7 +225,7 @@ fn test_undo_navigate() -> eyre::Result<()> { + fn test_go_to_event() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + +@@ -433,6 +433,10 @@ fn test_undo_move_refs() -> eyre::Result<()> { + fn test_historical_smartlog_visibility() -> eyre::Result<()> { + let git = make_git()?; + ++ if git.produces_auto_merge_refs()? { ++ return Ok(()); ++ } ++ + git.init_repo()?; + git.detach_head()?; + git.commit_file("test1", 1)?; +diff --git a/git-branchless/tests/test_wrap.rs b/git-branchless/tests/test_wrap.rs +index fb78e369a..3223bd18f 100644 +--- a/git-branchless/tests/test_wrap.rs ++++ b/git-branchless/tests/test_wrap.rs +@@ -9,7 +9,7 @@ use lib::testing::{make_git, GitRunOptions}; + fn test_wrap_rebase_in_transaction() -> eyre::Result<()> { + let git = make_git()?; + +- if !git.supports_reference_transactions()? { ++ if !git.supports_reference_transactions()? || git.produces_auto_merge_refs()? { + return Ok(()); + } + +@@ -28,7 +28,8 @@ fn test_wrap_rebase_in_transaction() -> eyre::Result<()> { + let event_replayer = EventReplayer::from_event_log_db(&effects, &repo, &event_log_db)?; + let events: Vec<Event> = get_event_replayer_events(&event_replayer) + .iter() +- .map(|event| redact_event_timestamp(event.clone())) ++ .cloned() ++ .map(redact_event_timestamp) + .collect(); + + // Bug fixed in Git v2.35: https://github.com/git/git/commit/4866a64508465938b7661eb31afbde305d83e234 diff --git a/community/git-branchless/fix-tests-git-2.42.patch b/community/git-branchless/fix-tests-git-2.42.patch new file mode 100644 index 0000000000000000000000000000000000000000..e04236fb862b042533dca9f787d9d3723f50012e --- /dev/null +++ b/community/git-branchless/fix-tests-git-2.42.patch @@ -0,0 +1,28 @@ +Patch-Source: https://github.com/arxanas/git-branchless/commit/dbbaed74a6dc9a3aa098375845cbfab74b380ae6 +-- +From dbbaed74a6dc9a3aa098375845cbfab74b380ae6 Mon Sep 17 00:00:00 2001 +From: Waleed Khan <me@waleedkhan.name> +Date: Sat, 23 Dec 2023 17:44:05 -0600 +Subject: [PATCH] fix(undo): fix `test_git_bisect_produces_empty_event` + +Broken on the Git `next` branch. Probably broken by https://github.com/git/git/commit/3460e3d6676870713ef17b300b03f70ee8f3cc44 or a commit slightly before that. +--- + git-branchless/tests/test_undo.rs | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/git-branchless/tests/test_undo.rs b/git-branchless/tests/test_undo.rs +index 1ee81acca..8cd289427 100644 +--- a/git-branchless/tests/test_undo.rs ++++ b/git-branchless/tests/test_undo.rs +@@ -660,6 +660,11 @@ fn test_git_bisect_produces_empty_event() -> eyre::Result<()> { + if !git.supports_reference_transactions()? { + return Ok(()); + } ++ if git.get_version()? >= GitVersion(2, 42, 0) { ++ // Later versions of Git write `BISECT_EXPECTED_REV` to the filesystem ++ // as well, causing the below test to fail. ++ return Ok(()); ++ } + git.init_repo()?; + + git.commit_file("test1", 1)?;