stgit icon indicating copy to clipboard operation
stgit copied to clipboard

stgit stack invisible to Sublime Merge until git gc?

Open garthk opened this issue 10 months ago • 0 comments

G'day! Could you help me understand what's behind this compatibility problem?

Sublime Merge often loses track after stgit commands, ending up something like this:

Sublime Merge after stg new

The current branch will be off to the side, as if it not the current branch, and the dotted line at the left will trail off as if you'd checked out a detached HEAD from an unrelated repo with a single commit. In the example above, it didn't even show the current branch, which I'd created with stg branch --create. Full repro below.

Commands to confuse it:

# command                        # confuses Sublime Merge?
stg pop -1                       # yes
stg pop && stg push              # no
stg pop --all && stg push --all  # yes
stg pop --all                    # no

I've recently found I can restore Sublime Merge's to the view I'd expect, for a while:

Sublime Merge after git maintenance run

Commands to restore it:

git gc --no-prune
git maintenance run

This'll surely be more to do with their use of git than yours, but Sublime Merge has a thousand issues. It strikes me it's more likely someone familiar with Git internals will trip over my post here.

What's going on? What's the quickest command I could run in a zsh hook to identify and repair the problem?


Commands used to take the screenshots above:

brew install git stgit
brew install --cask sublime-merge
git init
smerge .
echo "Demonstrate a confused Sublime Merge." > README.md
git add README.md
git commit -m "Declare intent." 
stg branch --create work
vim README.md. # make some changes
stg new log-some-commands -m "Log some commands." -r README.md
# observe Sublime Merge is confused
git maintenance run
# observe Sublime Merge is no longer confused

Versions:

I've had the problem for at least a year, so any recent versions will do, but I'm currently running:

Configuration:

Sublime Merge's debug information shows a small selection of git's config, so these might prove relevant:

core.bare=false
core.filemode=true
core.fsmonitor=true
core.ignorecase=true
core.logallrefupdates=true
core.precomposeunicode=true
core.repositoryformatversion=0
maintenance.auto=false
maintenance.repo=/Users/my/git/repo
maintenance.strategy=incremental

Perhaps also relevant:

index.version=2

garthk avatar Feb 26 '25 00:02 garthk