sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
272 stars 14 forks source link

smerge shows "staged files" that are not staged #1878

Open nagylzs opened 4 months ago

nagylzs commented 4 months ago

Version info

Description

A description of what the bug is.

Steps to reproduce

I have no idea how to reproduce, but I can show you some details. If I open the repo's directory and use command line git to show status then I see this:

 git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

If I open the same repo in sublime merge, then I see this:

image

Visible problems:

  1. It shows that there are 4087 staged files, but that is not true.
  2. It even lists these files under files/staged files
  3. if I click on a list item then it tells me <diff disabled couldn't load diff object>
  4. I already tried to restart smerge, but it did not help.

What finally helped is this:

Debug Information

=== App Version Information ===
Build: 2091

=== Git Version Information ===
Using Git: git (system)
git version 2.34.1
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/gandalf/bin:/home/gandalf/.local/bin:/usr/NX/bin

=== Browse Page Information ===
HEAD: d1cf1d90e36c07ff15db1d1e4835dfa64907af41
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===

=== Our Status Information ===
... <many more files here>
A  postgresql/sql_wipe/01.sql
A  postgresql/sql_wipe/02.sql
A  postgresql/sql_wipe/03.sql
A  postgresql/sql_wipe/04.sql
A  postgresql/sql_wipe/05.sql
A  postgresql/sql_wipe/06.sql
A  postgresql/versions/2023_02_21_01/README.txt
A  postgresql/versions/2023_02_21_01/sql_upgrade/40_create_inner/50_create_views/30_after/2990_view_meta_poi.sql
A  postgresql/versions/2023_02_21_02/README.txt
A  postgresql/versions/2023_02_21_02/sql_upgrade/40_create_inner/40_create_triggers/30_after/meta_copy_translation_from_resource_translations_to_meta_columns.sql
... <many more files here>
A  scriptutil/cfg_local.py.minimal_example
A  scriptutil/configloader.py

=== Git Config Information ===
alias.gbranch=log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h%C(white)%d %C(bold black)%ar %C(reset)%n' --all
alias.lg=!git lg1
alias.lg1=!git lg1-specific --all
alias.lg1-specific=log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
alias.lg2=!git lg2-specific --all
alias.lg2-specific=log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
alias.lg3=!git lg3-specific --all
alias.lg3-specific=log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n''          %C(white)%s%C(reset)%n''          %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
branch.kattan_stable.merge=refs/heads/kattan_stable
branch.kattan_stable.remote=origin
branch.kattan_uat.merge=refs/heads/kattan_uat
branch.kattan_uat.remote=origin
branch.lelle_stable.merge=refs/heads/lelle_stable
branch.lelle_stable.remote=origin
branch.master.merge=refs/heads/master
branch.master.remote=origin
branch.nkp_stable.merge=refs/heads/nkp_stable
branch.nkp_stable.remote=origin
branch.nkp_uat.merge=refs/heads/nkp_uat
branch.nkp_uat.remote=origin
branch.okt_stable.merge=refs/heads/okt_stable
branch.okt_stable.remote=origin
branch.okt_uat.merge=refs/heads/okt_uat
branch.okt_uat.remote=origin
branch.vitenoclimat_stable.merge=refs/heads/vitenoclimat_stable
branch.vitenoclimat_stable.remote=origin
core.autocrlf=input
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
diff.colormoved=zebra
fetch.prune=true
filesystem.Private Build|1.8.0_222|/dev/mapper/sdb5_crypt.minracythreshold=5054 microseconds
filesystem.Private Build|1.8.0_222|/dev/mapper/sdb5_crypt.timestampresolution=1001 microseconds
filesystem.Private Build|1.8.0_232|/dev/mapper/sdb5_crypt.minracythreshold=3539 microseconds
filesystem.Private Build|1.8.0_232|/dev/mapper/sdb5_crypt.timestampresolution=1001 microseconds
filesystem.Private Build|1.8.0_242|/dev/mapper/sdb5_crypt.minracythreshold=6131 microseconds
filesystem.Private Build|1.8.0_242|/dev/mapper/sdb5_crypt.timestampresolution=1001 microseconds
filesystem.Private Build|1.8.0_252|/dev/mapper/sdb5_crypt.minracythreshold=4712 microseconds
filesystem.Private Build|1.8.0_252|/dev/mapper/sdb5_crypt.timestampresolution=1001 microseconds
filesystem.Private Build|14.0.1|/dev/nvme1n1p5.minracythreshold=6517 microseconds
filesystem.Private Build|14.0.1|/dev/nvme1n1p5.timestampresolution=5000 nanoseconds
filesystem.Private Build|14.0.1|/home/gandalf/.Private.minracythreshold=0 nanoseconds
filesystem.Private Build|14.0.1|/home/gandalf/.Private.timestampresolution=467 milliseconds
filesystem.Private Build|14.0.2|/dev/nvme1n1p5.minracythreshold=4549 microseconds
filesystem.Private Build|14.0.2|/dev/nvme1n1p5.timestampresolution=6000 nanoseconds
log.excludedecoration=refs/prefetch/
maintenance.auto=false
maintenance.repo=/home/gandalf/projects/NOT_TELLING_THIS
maintenance.strategy=incremental
pull.rebase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@gitlab.itk.NOT_TELLING_THIS:NOT_TELLING_THIS/NOT_TELLING_THIS.git
taggrouping.groups=
taggrouping.singles=
user.email=nagylzs@gmail.com
user.name=Laszlo Nagy

=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/gandalf/.config/git/config
Using config path: /home/gandalf/.gitconfig
Using config path: /home/gandalf/projects/NOT_TELLING_THIS/.git/config

Our config output is identical to the Git config output

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

=== Our Modified Files Flag Information ===
Ignoring symlinks: 0
themilkman commented 4 months ago

Did you have git maintenance running at some point before? If so, I guess it's related to #1094.

nagylzs commented 4 months ago

Yes, git maintenance was enabled on this repo. But I'm not sure if it was running when I saw the problem.

thomashope commented 4 months ago

I believe I ran into the same issue.

What fixed it for me was at some point I opened the repo with Git GUI from the Git for WIndows installations and it popped up a message saying there were many 'loose objects' and asking me to allow it to 'compress the database' or something which I believe is essentially saying it want's to run git gc. I clicked OK and Git GUI did it's thing. On returning to Sublime Merge the issue was gone.

Some more debug info below:

Version info

Debug Information

=== Git Version Information ===
Using Git: C:\Program Files\Sublime Merge\Git\cmd\git.exe (bundled)
git version 2.39.1.windows.1

=== Git Config Information ===
branch.dev.merge=refs/heads/dev
branch.dev.remote=origin
color.interactive=true
color.ui=auto
core.autocrlf=false
core.bare=false
core.filemode=false
core.fscache=true
core.ignorecase=true
core.logallrefupdates=true
core.repositoryformatversion=0
core.symlinks=false
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.smudge=git-lfs smudge -- %f
gui.geometry=1305x725+590+249 305 265
gui.recentrepo=C:/repos/REDACTED
gui.wmstate=normal
help.format=html
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
include.path=C:/Program Files/Git/etc/gitconfig
init.defaultbranch=main
lfs.https://github.com/REDACTED.git/info/lfs.access=basic
lfs.repositoryformatversion=0
maintenance.auto=false
maintenance.repo=C:/repos/es-main-1
maintenance.strategy=incremental
pack.packsizelimit=2g
pull.rebase=false
rebase.autosquash=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=https://github.com/REDACTED.git
submodule.active=.
submodule.assets.url=https://github.com/REDACTED.git

=== Our Config Information ===
Git Config Path Information
Using config path: /C/ProgramData/Git/config
Using config path: /C/Program Files/Sublime Merge/Git/etc/gitconfig
Using config path: /C/Users/Thomas Hope/.config/git/config
Using config path: /C/Users/Thomas Hope/.gitconfig
Using config path: /C/repos/REDACTED/.git/config

Our config output is identical to the Git config output
Poldraunic commented 4 months ago

I as well had maintenance turned on and I had same issue with minor differences: it was not whole repository, but only around 500 files.

Simply running git gc didn't help because for me it was errored with messages unable to add cruft objects and failed to run repack. After Googling these errors for a while, I stumbled upon this StackOverflow answer: they suggested to run git gc --aggressive --prune=now and for me it did help.

nagylzs commented 3 months ago

It happened again today. git gc --aggressive --prune=now fixed it.