Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hook: Ignore updates to remote branches in reference-transaction #913

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion git-branchless-hook/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,14 @@ fn hook_reference_transaction(effects: &Effects, transaction_state: &str) -> eyr
ref_name,
old_oid: _,
new_oid: _,
}| !should_ignore_ref_updates(ref_name),
}| {
!should_ignore_ref_updates(ref_name)
arxanas marked this conversation as resolved.
Show resolved Hide resolved
&& match CategorizedReferenceName::new(ref_name) {
CategorizedReferenceName::RemoteBranch { .. } => false,
CategorizedReferenceName::OtherRef { .. } => false,
CategorizedReferenceName::LocalBranch { .. } => true,
}
},
)
.map(|parsed_line| fix_packed_reference_oid(&repo, &packed_references, parsed_line))
.collect();
Expand Down
4 changes: 0 additions & 4 deletions git-branchless-submit/tests/test_submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ fn test_submit() -> eyre::Result<()> {
To: file://<remote>
* [new branch] bar -> bar
* [new branch] qux -> qux
branchless: processing 1 update: remote branch origin/bar
branchless: processing 1 update: remote branch origin/qux
"###);
insta::assert_snapshot!(stdout, @r###"
branchless: running command: <git-executable> push --set-upstream origin bar qux
Expand Down Expand Up @@ -104,7 +102,6 @@ fn test_submit() -> eyre::Result<()> {
branchless: processing 1 update: branch qux
To: file://<remote>
+ 20230db...bae8307 qux -> qux (forced update)
branchless: processing 1 update: remote branch origin/qux
"###);
insta::assert_snapshot!(stdout, @r###"
branchless: running command: <git-executable> fetch origin refs/heads/bar refs/heads/qux
Expand Down Expand Up @@ -281,7 +278,6 @@ fn test_submit_up_to_date_branch() -> eyre::Result<()> {
branchless: processing 1 update: branch feature
To: file://<remote>
* [new branch] feature -> feature
branchless: processing 1 update: remote branch origin/feature
"###);
insta::assert_snapshot!(stdout, @r###"
branchless: running command: <git-executable> push --set-upstream origin feature
Expand Down