wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.72k stars 262 forks source link

fix: force Git fetch during updates #1101

Closed antoineco closed 1 year ago

antoineco commented 1 year ago

Fixes #1100

I believe --force is a sensible default in the context of packer updates. In most cases, users don't care about things such as force-pushed tags, and simply want packer to pull whatever Git ref was indicated in their config.

overhacked commented 1 year ago

Due to the condition: https://github.com/wbthomason/packer.nvim/blob/64ae65fea395d8dc461e3884688f340dd43950ba/lua/packer/plugin_types/git.lua#L221-L223

The fetch command also needs to be --force, like:

      fetch = 'fetch --depth 999999 --progress --force',
antoineco commented 1 year ago

@overhacked ~in what context have you been running into issues with the fetch command?~

Edit: I just saw your comment on the original issue. Good point.

wbthomason commented 1 year ago

@antoineco @overhacked Thanks, and sorry for the delay here. If we're to merge this, we should add @overhacked's suggested change.

Also, are there cases where --force might not do what we want? I don't know of any (as you say, users typically just want "get the latest" or "get the thing I specified", and afaik --force will do the right thing in these cases), but I don't entirely trust my knowledge of git to be exhaustive enough here.

antoineco commented 1 year ago

@wbthomason absolutely 👍 Done in e1979615..3a4fff64

overhacked commented 11 months ago

@wbthomason @antoineco Not sure why this got closed? #1100 is still open; I posted my enthusiastic agreement (https://github.com/wbthomason/packer.nvim/issues/1100#issuecomment-1657036413) with this PR's approach there. I'm closing #1171; it would over-complicate the matter.

antoineco commented 11 months ago

@overhacked it was closed because you disagreed with the approach in the original issue and opened #1171 instead.

I have since deleted my fork and no longer use packer, but by any mean feel free to re-submit.

overhacked commented 11 months ago

Understood. I was wrong about the approach being harmful. I'll resubmit.