Skip to content

Negative fetch refspec causes NegativeGlobPattern parsing error #2210

@Frederick888

Description

@Frederick888

Current behavior 😯

https://github.com/o2sh/onefetch switched from libgit2 to gitoxide a while back

Now when I use onefetch in a repo where .git/config has

[remote "origin"]
	url = [email protected]:.../...
	fetch = +refs/heads/*:refs/remotes/origin/*
	fetch = ^refs/heads/*-deploy
	fetch = ^refs/tags/*-deploy

It prints

Error: Failed to determine repository URL

Caused by:
    0: fetch ref-spec under `remote.origin` was invalid
    1: The refspec at "remote.<name>.fetch=^refs/heads/*-deploy" could not be parsed
    2: Negative glob patterns are not allowed

This seems to be from 4c4f821#diff-6d0a30d3d2eca6be3076f24e2cc5580c2862905660b5a68a47e6f545c112a579

I'm not familiar this library. The error message seems to say that negative fetch glob refspecs are simply not supported by this library, while the commit itself was trying to bar invalid negative glob refspecs only?

Expected behavior 🤔

Those two negative refspecs work in Git correctly. I'd expected they are treated as valid ones here too.

Git behavior

I usually run git fetch --all --prune --tags --jobs=10, which does not fetch those branches / tags with the negative refspecs.

Steps to reproduce 🕹

  1. Add those refspecs in a repo
  2. Install and run onefetch

Metadata

Metadata

Assignees

Labels

acknowledgedan issue is accepted as shortcoming to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions