Skip to content

Commit 10cbbe5

Browse files
committed
hook: Ignore updates to remote branches in reference-transaction
1 parent b549f72 commit 10cbbe5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

git-branchless-hook/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,12 @@ fn hook_reference_transaction(effects: &Effects, transaction_state: &str) -> eyr
456456
ref_name,
457457
old_oid: _,
458458
new_oid: _,
459-
}| !should_ignore_ref_updates(ref_name),
459+
}| {
460+
!should_ignore_ref_updates(ref_name)
461+
&& !CategorizedReferenceName::new(ref_name)
462+
.friendly_describe()
463+
.starts_with("remote")
464+
},
460465
)
461466
.map(|parsed_line| fix_packed_reference_oid(&repo, &packed_references, parsed_line))
462467
.collect();

git-branchless-submit/tests/test_submit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ fn test_submit() -> eyre::Result<()> {
7272
To: file://<remote>
7373
* [new branch] bar -> bar
7474
* [new branch] qux -> qux
75-
branchless: processing 1 update: remote branch origin/bar
76-
branchless: processing 1 update: remote branch origin/qux
7775
"###);
7876
insta::assert_snapshot!(stdout, @r###"
7977
branchless: running command: <git-executable> push --set-upstream origin bar qux
@@ -104,7 +102,6 @@ fn test_submit() -> eyre::Result<()> {
104102
branchless: processing 1 update: branch qux
105103
To: file://<remote>
106104
+ 20230db...bae8307 qux -> qux (forced update)
107-
branchless: processing 1 update: remote branch origin/qux
108105
"###);
109106
insta::assert_snapshot!(stdout, @r###"
110107
branchless: running command: <git-executable> fetch origin refs/heads/bar refs/heads/qux
@@ -281,7 +278,6 @@ fn test_submit_up_to_date_branch() -> eyre::Result<()> {
281278
branchless: processing 1 update: branch feature
282279
To: file://<remote>
283280
* [new branch] feature -> feature
284-
branchless: processing 1 update: remote branch origin/feature
285281
"###);
286282
insta::assert_snapshot!(stdout, @r###"
287283
branchless: running command: <git-executable> push --set-upstream origin feature

0 commit comments

Comments
 (0)