-
Notifications
You must be signed in to change notification settings - Fork 893
Description
In gittuf, we store additional metadata in custom refs. We noticed that when we constructed a refspec without a leading + (eg: refs/gittuf/reference-state-log:refs/gittuf/reference-state-log) the destination still gets overwritten after a call to remote.FetchContext when the local and remote versions of the ref have diverged.
I'm not 100% sure this is the reason but I wonder if this is the issue: https://github.com/go-git/go-git/blob/master/remote.go#L1203. In this line, our refspecs never trigger the IsBranch condition because our ref isn't a typical branch in refs/heads. This means that forceNeeded doesn't get set, and the destination ref in the local repository gets overwritten.
If there's some clarity on why that condition exists, I'm happy to work on a patch to enable our use. Is the idea to dismiss tags? If so, can that check be explicitly for refs/tags?