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

sync subcommand with --pull does not support negative refspecs #1444

Open
ryan-ph opened this issue Nov 12, 2024 · 1 comment
Open

sync subcommand with --pull does not support negative refspecs #1444

ryan-ph opened this issue Nov 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ryan-ph
Copy link

ryan-ph commented Nov 12, 2024

Description of the bug

Git v2.29.0 supports negative refspecs to allow filtering which refspecs to ignore.

It seems like git branchless sync --pull does not currently respect this and will cause panics if a negative refspec is specified in the git config.

Example git config specifying a negative refspec for any branches with an underscore prefix

[remote "origin"]
    fetch = ^refs/heads/_*

Expected behavior

When running git branchless sync --pull, I expect all refs to be fetched from the remote following all git refspec rules (i.e. all refs which match postive refspecs and do not match any negative refspecs), and all local refs to be updated.

Actual behavior

A panic:

$ git sync --pull
branchless: running command: git fetch --all
branchless: processing 1 update: remote branch origin/master
From github.com:**********
   1cbda20c5530..7aebefa5462d  master        -> origin/master
branchless: processing 1 update: remote branch origin/fix-inventory
 * [new branch]                fix-inventory -> origin/fix-inventory
The application panicked (crashed).
Message:  A fatal error occurred:
   0: could not find upstream branch for branch with name 'master': '^refs/heads/_*' is not a valid refspec.; class=Invalid (3)
   1: '^refs/heads/_*' is not a valid refspec.; class=Invalid (3)

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

git-branchless-opts 0.10.0

Version of git

git version 2.44.0

@ryan-ph ryan-ph added the bug Something isn't working label Nov 12, 2024
@ryan-ph ryan-ph changed the title sync subcommand does not support negative refspecs sync subcommand with --pull does not support negative refspecs Nov 12, 2024
@ryan-ph
Copy link
Author

ryan-ph commented Nov 12, 2024

Seems like this is an upstream issue: libgit2/libgit2#6741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant