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

Recent force-push to master may have omitted changes #1906

Closed
gotgenes opened this issue Jan 9, 2023 · 22 comments
Closed

Recent force-push to master may have omitted changes #1906

gotgenes opened this issue Jan 9, 2023 · 22 comments
Labels
bug Something isn't working

Comments

@gotgenes
Copy link

gotgenes commented Jan 9, 2023

Description

Hi,

master has recently diverged from its previous history. I noticed this when Packer failed to updated the plugin, saying it could not fast-forward to the latest changes. Here's a look at the recent history locally vs. in GitHub.

* 87961d3 - (origin/master, origin/HEAD) fix(#1822): test directory capable of watching before presenting it (#1901) (16 hours ago) <Alexander Courtis>
| * bac962c - (HEAD -> master) feat(api): add api.config.mappings.active, api.config.mappings.default (#1876) (7 days ago) <Alexander Courtis>
| * cdbd7da - fix(#1878): nvim frozen on no name buffer when modified.enable (#1879) (7 days ago) <Richard Li>
|/
* 951b6e7 - fix(#1836): add view.debounce_delay (#1871) (8 days ago) <Richard Li>
* e322fbb - chore: remove diagnostic suppressions after tidying nits (9 days ago) <Alexander Courtis>
* 9d27c9e - doc: add recipes and tips links to API (9 days ago) <Alexander Courtis>
* 013b498 - doc: add recipes and tips links to API (9 days ago) <Alexander Courtis>

It is possible that the changes in #1876 and #1879 have been omitted. You might want to verify the changes in those PRs are still present in the codebase.

Neovim version

N/A

Operating system and version

N/A

nvim-tree version

master

Minimal config

N/A

Steps to reproduce

N/A

Expected behavior

No response

Actual behavior

No response

@gotgenes gotgenes added the bug Something isn't working label Jan 9, 2023
@alex-courtis
Copy link
Member

alex-courtis commented Jan 9, 2023

Thank you @gotgenes for digging into this and finding these.

Force pushing is always a bad idea.

Users experiencing problems: please reinstall or delete/install nvim-tree.

@alex-courtis
Copy link
Member

Packer didn't pick up anything for me as I'm using the default depth of 1. Have you configured packer to get full history?

Should be fixed now, thanks again.

@chomosuke
Copy link
Collaborator

chomosuke commented Jan 9, 2023

@alex-courtis Packer complained because for people who have done git config --global pull.ff only git will complain unable to fastward which will then cause packer to fail. Interestingly Lazy.nvim by default is actually fine as they just check out origin/master.

While the current state of master is okay, I'd actually recommend @alex-courtis to force push again so that 5a3a7f5ba47f7e976462bc8431e34252fbd08888 come back and be present in master again (Edit: i mean to force push to bring master back to the state it was 20 hours ago before any force push happened). In this way only people who have updated in the last 19 hours will be unable to fast forward instead of all the people who've updated in the last week. This would also allow people who had simply ignored the packer error to have the update working again :).

@alex-courtis
Copy link
Member

I've manually merged all the missing commits:

* cc3c5e7 (HEAD -> master, origin/master, origin/HEAD) ci: fix release-please workflow (#1899)  Alexander Courtis  36 seconds ago
* 37eda63 chore(deps): bump JohnnyMorganz/stylua-action from 1 to 2 (#1897)  Alexander Courtis  73 seconds ago
* 4b74990 chore(deps): bump actions/checkout from 2 to 3 (#1898)  dependabot[bot]  Alexander Courtis  2 minutes ago
* 907adac ci: add release-please workflow (#1892)  Alexander Courtis  4 minutes ago
* 5417557 feat(event): add TreeAttachedPost (#1877)  Alexander Courtis  5 minutes ago
* 3c51d1f feat: add ui.confirm.remove and ui.confirm.trash, deprecate trash.require_confirm (#1887)  Alexander Courtis  22 minutes ago
* 16a0e3c (tag: nightly) feat(api): add api.config.mappings.active, api.config.mappings.default (#1876)  Alexander Courtis  65 minutes ago
* 54b850a fix(#1878): nvim frozen on no name buffer when modified.enable (#1879)  Alexander Courtis  66 minutes ago
* 87961d3 fix(#1822): test directory capable of watching before presenting it (#1901)  Alexander Courtis  Mon 13:59

@alex-courtis
Copy link
Member

While the current state of master is okay, I'd actually recommend @alex-courtis to force push again so that 5a3a7f5ba47f7e976462bc8431e34252fbd08888 come back and be present in master again

That would have been much smarter. My acting fast has caused a lot of problems. There will be no further such repository forces.

@chomosuke
Copy link
Collaborator

That would have been much smarter. My acting fast has caused a lot of problems. There will be no further such repository forces.

You can still do that now. It's only been 20 hours.

@alex-courtis
Copy link
Member

That would have been much smarter. My acting fast has caused a lot of problems. There will be no further such repository forces.

You can still do that now. It's only been 20 hours.

I am not confident in my ability to do that.

Could you execute that?

The only commit after that point has been 87961d3 and I can reapply that afterwards.

@alex-courtis alex-courtis reopened this Jan 9, 2023
@alex-courtis alex-courtis unpinned this issue Jan 9, 2023
@chomosuke
Copy link
Collaborator

Ahh sure, I didn't know I had premission to force push to master haha.

@alex-courtis
Copy link
Member

alex-courtis commented Jan 9, 2023

Ahh sure, I didn't know I had premission to force push to master haha.

Please try and see what happens.

There is something very strange going on with the master branch protection rules.

I will be turning on "Require a pull request before merging" afterwards, which I incorrectly thought was set.

20230110_101319 969x1870

@chomosuke
Copy link
Collaborator

image
Whoop, looks like I can't ;-;.

But, I can write down the command that you can use to force push to master:

git switch master
git reset ccb6d8a518d32e22bf5874f90e6c22661a5d8b46
git push -f

@chomosuke
Copy link
Collaborator

I hope this works, but even if it doesn't it won't break master any further and we should be able to fix it eventually.

Force pushing is a pretty bad habit that I also have and do almost daily. I'm just lucky enough to not have it mess anything up yet.

Or I just don't maintain anything with enough users for anyone to notice haha.

@gegoune
Copy link
Collaborator

gegoune commented Jan 9, 2023

Restoring as @chomosuke suggests will bring original authors back. :)

@alex-courtis
Copy link
Member

git switch master
git reset ccb6d8a518d32e22bf5874f90e6c22661a5d8b46
git push -f

I'm not able to see that commit in my dev repo or a freshly cloned repo. It is a valid commit and can be seen in the web UI.

Could you push a tag or branch for that commit?

@chomosuke
Copy link
Collaborator

That is a perhaps a real issue, I've found a solution here https://medium.com/git-tips/githubs-reflog-a9ff21ff765f but github tells me not found
image
The next best thing to do might be to go back a few commits, such as 5b554a9e2d910407a8822a321cb909d0babb1c2f or 3a42468a581796495d883550872484853bc7d538. I'd image 5b554a9e2d910407a8822a321cb909d0babb1c2f would be on @gegoune's machine

@chomosuke
Copy link
Collaborator

bac962caf472a4404ed3ce1ba2fcaf32f8002951 is the latest commit on old master that's still in this repository. It's also the latest commit I have unfortunately

@chomosuke
Copy link
Collaborator

Update, f2ee30998eb4e191ed9931719a4e3b28be35494b has been brought back by restoring gegoune-patch-1.

@alex-courtis
Copy link
Member

f2ee309 checked out, thank you.

Forking the repo for a dry run.

@chomosuke
Copy link
Collaborator

Update again: ccb6d8a is now in the repos!!

@chomosuke
Copy link
Collaborator

ccb6d8a is under branch old-master2

@alex-courtis
Copy link
Member

alex-courtis commented Jan 10, 2023

Tested at https://github.com/nvim-tree/nvim-tree.lua-fix-master with same master branch protections except "Allow force pushes"

Diff for two fresh clones:

:; diff -r nvim-tree.lua nvim-tree.lua-fix-master
diff '--color=auto' -r nvim-tree.lua/.git/config nvim-tree.lua-fix-master/.git/config
7c7
<       url = [email protected]:nvim-tree/nvim-tree.lua.git
---
>       url = [email protected]:nvim-tree/nvim-tree.lua-fix-master.git
Binary files nvim-tree.lua/.git/index and nvim-tree.lua-fix-master/.git/index differ
diff '--color=auto' -r nvim-tree.lua/.git/logs/HEAD nvim-tree.lua-fix-master/.git/logs/HEAD
1c1
< 0000000000000000000000000000000000000000 677d54afee1dfa7a30eb9e16ab7d9d1affc6484b Alexander Courtis <alex@xxxx> 1673311145 +1100       clone: from github.com:nvim-tree/nvim-tree.lua.git
---
> 0000000000000000000000000000000000000000 ccb6d8a518d32e22bf5874f90e6c22661a5d8b46 Alexander Courtis <alex@xxxx> 1673311308 +1100       clone: from github.com:nvim-tree/nvim-tree.lua-fix-master.git
diff '--color=auto' -r nvim-tree.lua/.git/logs/refs/heads/master nvim-tree.lua-fix-master/.git/logs/refs/heads/master
1c1
< 0000000000000000000000000000000000000000 677d54afee1dfa7a30eb9e16ab7d9d1affc6484b Alexander Courtis <alex@xxxx> 1673311145 +1100       clone: from github.com:nvim-tree/nvim-tree.lua.git
---
> 0000000000000000000000000000000000000000 ccb6d8a518d32e22bf5874f90e6c22661a5d8b46 Alexander Courtis <alex@xxxx> 1673311308 +1100       clone: from github.com:nvim-tree/nvim-tree.lua-fix-master.git
diff '--color=auto' -r nvim-tree.lua/.git/logs/refs/remotes/origin/HEAD nvim-tree.lua-fix-master/.git/logs/refs/remotes/origin/HEAD
1c1
< 0000000000000000000000000000000000000000 677d54afee1dfa7a30eb9e16ab7d9d1affc6484b Alexander Courtis <alex@xxxx> 1673311145 +1100       clone: from github.com:nvim-tree/nvim-tree.lua.git
---
> 0000000000000000000000000000000000000000 ccb6d8a518d32e22bf5874f90e6c22661a5d8b46 Alexander Courtis <alex@xxxx> 1673311308 +1100       clone: from github.com:nvim-tree/nvim-tree.lua-fix-master.git
Only in nvim-tree.lua-fix-master/.git/objects/pack: pack-6901b20d9c2d2e72642cb6c0bc016de9dd185bca.idx
Only in nvim-tree.lua-fix-master/.git/objects/pack: pack-6901b20d9c2d2e72642cb6c0bc016de9dd185bca.pack
Only in nvim-tree.lua/.git/objects/pack: pack-7c1c69bd1ea6831ac772d6c29ac28905b3b9a1a9.idx
Only in nvim-tree.lua/.git/objects/pack: pack-7c1c69bd1ea6831ac772d6c29ac28905b3b9a1a9.pack
diff '--color=auto' -r nvim-tree.lua/.git/packed-refs nvim-tree.lua-fix-master/.git/packed-refs
6c6,8
< 677d54afee1dfa7a30eb9e16ab7d9d1affc6484b refs/remotes/origin/master
---
> 62ea3f6ced2d9366759cf00afe68e61cbacbbbba refs/remotes/origin/gegoune-patch-1
> ccb6d8a518d32e22bf5874f90e6c22661a5d8b46 refs/remotes/origin/master
> f2ee30998eb4e191ed9931719a4e3b28be35494b refs/remotes/origin/old-master
diff '--color=auto' -r nvim-tree.lua/.git/refs/heads/master nvim-tree.lua-fix-master/.git/refs/heads/master
1c1
< 677d54afee1dfa7a30eb9e16ab7d9d1affc6484b
---
> ccb6d8a518d32e22bf5874f90e6c22661a5d8b46
diff '--color=auto' -r nvim-tree.lua/lua/nvim-tree/explorer/explore.lua nvim-tree.lua-fix-master/lua/nvim-tree/explorer/explore.lua
9,10d8
< local Watcher = require "nvim-tree.watcher"
<
33,37c31
<     if
<       not filters.should_filter(abs, filter_status)
<       and not nodes_by_path[abs]
<       and Watcher.is_fs_event_capable(abs)
<     then
---
>     if not filters.should_filter(abs, filter_status) and not nodes_by_path[abs] then
diff '--color=auto' -r nvim-tree.lua/lua/nvim-tree/explorer/reload.lua nvim-tree.lua-fix-master/lua/nvim-tree/explorer/reload.lua
11d10
< local Watcher = require "nvim-tree.watcher"
90c89
<         if t == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then
---
>         if t == "directory" and vim.loop.fs_access(abs, "R") then
diff '--color=auto' -r nvim-tree.lua/lua/nvim-tree/watcher.lua nvim-tree.lua-fix-master/lua/nvim-tree/watcher.lua
162,186d161
< --- Windows NT will present directories that cannot be enumerated.
< --- Detect these by attempting to start an event monitor.
< --- @param path string
< --- @return boolean
< function M.is_fs_event_capable(path)
<   if not utils.is_windows then
<     return true
<   end
<
<   local fs_event = vim.loop.new_fs_event()
<   if not fs_event then
<     return false
<   end
<
<   if fs_event:start(path, FS_EVENT_FLAGS, function() end) ~= 0 then
<     return false
<   end
<
<   if fs_event:stop() ~= 0 then
<     return false
<   end
<
<   return true
< end
<
diff '--color=auto' -r nvim-tree.lua/README.md nvim-tree.lua-fix-master/README.md
1,10d0
< # Broken master 2023/01/10
<
< An incorrectly executed force push to master resulted in lost changes and conflicting commit history. The changes have been manually restored: https://github.com/nvim-tree/nvim-tree.lua/issues/1906
<
< If your plugin manager experiences issues updating delete/reinstall nvim-tree.
<
< Please accept my apologies for the inconvenience.
<
< Alex
<

@alex-courtis
Copy link
Member

Fixed. Many, many thanks for your help @chomosuke

That is my last force push.

Updated branch protection rules and disallowed force pushes.

@chomosuke
Copy link
Collaborator

No worries man! Thank you for your hard work and responsiveness!

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

4 participants