-
-
Notifications
You must be signed in to change notification settings - Fork 263
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 fails when upstream force pushes Git tags #1100
Comments
Some projects force-push Git tags such as 'nightly' on a regular basis, which leads to failures during fetches. Ref. wbthomason/packer.nvim#1100
Turns out this isn't quite enough if packer.nvim/lua/packer/plugin_types/git.lua Lines 221 to 223 in 64ae65f
The workaround for me was: require'packer'.init{
git = {
subcommands = {
-- Fix for https://github.com/wbthomason/packer.nvim/issues/1100,
-- which blocks updating the nvim-tree nightly tag
update = 'pull --ff-only --progress --rebase=false --force',
fetch = 'fetch --depth 999999 --progress --force',
}
},
} |
@overhacked good point, sorry if I didn't understand your comment on the linked PR. |
Setting
I'm not sure why the negative refspec ( |
I think you're right that
This looks to me like packer should add a |
Resolves wbthomason#1100. Pull upstream tags even if they were force-pushed. Git version 2.20 changed the behavior of fetching tags so that non-fast-forward updates would fail. Some plugin authors, like `nvim-tree/nvim-tree.lua` use a tag named `nightly` that is force-pushed with latest updates to provide bleeding-edge changes. By adding an explicit refspec to the `git fetch` command line with a leading plus-sign ('+') Git will always update the tag to the new commit, regardless of whether it was force-pushed upstream. See https://www.git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt for details (paragraph beginning "Until Git version 2.20...").
@overhacked please note that the issue isn't only occurring when a branch or tag is specified (I have no such thing in my config). It occurs any time upstream force pushes a tag, even one that's not used in the Packer config. Regarding the suggestion to manually edit the Git config for the problematic repo, I don't think this really solves anything considering the main advantage of Packer's is to have a declarative configuration. I didn't know about the |
Some projects force-push Git tags such as 'nightly' on a regular basis, which leads to failures during fetches. Ref. wbthomason/packer.nvim#1100
Resolves wbthomason#1100. Pull upstream tags even if they were force-pushed. Git version 2.20 changed the behavior of fetching tags so that non-fast-forward updates would fail. Some plugin authors, like `nvim-tree/nvim-tree.lua` use a tag named `nightly` that is force-pushed with latest updates to provide bleeding-edge changes. By adding an explicit refspec to the `git fetch` command line with a leading plus-sign ('+') Git will always update the tag to the new commit, regardless of whether it was force-pushed upstream. See https://www.git-scm.com/docs/git-fetch#Documentation/git-fetch.txt-ltrefspecgt for details (paragraph beginning "Until Git version 2.20...").
I've done some more experimenting with
Because the only local refs affected by (1) and (2) are tl; dr:
I argue that Packer should change |
nvim --version
: v0.9.0-dev-1285-g760b399f6git --version
: 2.37.0Problem description
Some projects update certain Git tags by force pushing them on a regular basis. Typical example: a
nighly
tag may change every day.When this occurs anytime after packer has already been synced at least once, subsequent updates (sync) fail consistently with the message
[rejected] ... would clobber existing tag
. (see details below)Steps to reproduce
Force push any existing tag / wait until upstream does.
Actual behaviour
Expected behaviour
Additional notes
Fetching from Git with the
--force
flag is the easiest solution that comes to mind: https://stackoverflow.com/q/58031165/4716370My current workaround is to add this flag to config.git.subcommands.update while calling
init()
:packer files
Not relevant or already provided above.
The text was updated successfully, but these errors were encountered: