sublimehq / sublime_merge

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

All tabs for worktrees will open to the same commit msg when a cherry-pick has conflicts #1792

Closed CheyenneWills closed 10 months ago

CheyenneWills commented 11 months ago

Version info

Description When SM has tabs (either in the same window or separate windows) open to repos that are worktrees and a cherry-pick is performed in one of those tabs which results in a conflict, all the other tabs for the other worktree repos will show the same commit message with the "Abort cherry pick" / "Nothing to commit" buttons. The tab that shows the branch where the cherry-pick is occuring shows the commit message with the "Abort cherry pick" / "Stage all unmerged files to continue" along with the ability to resolve the conflict(s).

This behavior is "old" (I was able to replicate the problem with a copy of SM from Dec 2018)

Steps to reproduce

Steps to reproduce the behavior:

  1. With a repo open in SM
  2. Create a worktree from an existing repository e.g. git worktree -b somenewbranch ${HOME}/someworktree
  3. Open the repo at ${HOME}/someworktree
  4. Do a cherry-pick that will result in a conflict from either of the tabs
  5. Observe what is displayed in each tab

In testing I did the following:

#in /tmp/tstgit
mkdir a
cd a
git init
touch a
git add .
git commit -m Initial
git worktree -b b ../b
git worktree -b c ../c
sublime-merge --safe-mode

opened the three repos ( a, b, c) updated and committed the file 'a' in repo a (branch is master) created a branch d and switched to it (branch is now b and "matches" master -- note this step is unnecessary -- but wanted to document the steps used for the screen shots provided below) updated and committed the file 'a' in repo b (branch is b) from repo a, did a cherry-pick for the commit just created in branch b which has conflicts

At this point, doing a git status in repo a, b and c show:

/tmp/tstgit/b $ cd ../a
/tmp/tstgit/a $ git status
On branch d
You are currently cherry-picking commit e2f57d0.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   a

no changes added to commit (use "git add" and/or "git commit -a")

$ cd ../b
/tmp/tstgit/b $ git status
On branch master
nothing to commit, working tree clean

/tmp/tstgit/b $ cd ../c
/tmp/tstgit/c $ git status
On branch dev
nothing to commit, working tree clean

Expected behavior

Only the tab that represents the branch where the cherry-pick is being performed should show the commit message and the "abort" cherry pick buttons, etc. associated with the cherry-pick

Debug Information

From the tab performing the cherry-pick

=== App Version Information ===
Build: 2089

=== Git Version Information ===
Using Git: git (system)
git version 2.41.0
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

=== Browse Page Information ===
HEAD: 6af488ad502f280d8152cb7059fc8bfc614b3dd5
Is in merge: 0
Is in cherry_pick: 1
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===
UU a

=== Our Status Information ===
U U a

=== Git Config Information ===

=        echo "Error: commit hash cannot be identified for $1" >&2
=        exit 1
=        target="--root"
    # change rebase editor to perl to regex-replace & not edit
=    # note: `(# )?` is for root commit support
=    # note: perl for simple multi-platform support
=    # root commit check
=    GIT_SEQUENCE_EDITOR="perl -p -i -e 's/(# )?pick $commitish/edit $commitish/'" \
    commitish="$(git rev-parse --verify --quiet --short --end-of-options "${1:-HEAD}")"
    fi
=    if ! git rev-parse --verify --quiet $target; then
=    if [ -z "$commitish" ]; then
=    target="$commitish~"
  git rebase -i "$target"
= local commitish target
=alias.gerrit-pick=!GERRIT_CHERRY_PICK=yes git cherry-pick -x
alias.qgerrit=gerrit-query --format "{number} {patchset} {status} {branch} {hash:.10} {subject}"
alias.qlog=log --oneline --pretty='%h %s'
alias.smerge-edit-commit-contents=!f() {
color.ui=auto
core.bare=false
core.excludesfile=~/.gitignore_global
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
diff.algorithm=histogram
user.email=xxxxxxx@xxxxxxxxxx
user.name=Cheyenne Wills
}; f
=
=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/cwills/.config/git/config
Using config path: /home/cwills/.gitconfig
Using config path: /tmp/tstgit/a/.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

From one of the other tabs

=== App Version Information ===
Build: 2089

=== Git Version Information ===
Using Git: git (system)
git version 2.41.0
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin

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

=== Git Status Information ===

=== Our Status Information ===

=== Git Config Information ===

=        echo "Error: commit hash cannot be identified for $1" >&2
=        exit 1
=        target="--root"
    # change rebase editor to perl to regex-replace & not edit
=    # note: `(# )?` is for root commit support
=    # note: perl for simple multi-platform support
=    # root commit check
=    GIT_SEQUENCE_EDITOR="perl -p -i -e 's/(# )?pick $commitish/edit $commitish/'" \
    commitish="$(git rev-parse --verify --quiet --short --end-of-options "${1:-HEAD}")"
    fi
=    if ! git rev-parse --verify --quiet $target; then
=    if [ -z "$commitish" ]; then
=    target="$commitish~"
  git rebase -i "$target"
= local commitish target
=alias.gerrit-pick=!GERRIT_CHERRY_PICK=yes git cherry-pick -x
alias.qgerrit=gerrit-query --format "{number} {patchset} {status} {branch} {hash:.10} {subject}"
alias.qlog=log --oneline --pretty='%h %s'
alias.smerge-edit-commit-contents=!f() {
color.ui=auto
core.bare=false
core.excludesfile=~/.gitignore_global
core.filemode=true
core.logallrefupdates=true
core.repositoryformatversion=0
diff.algorithm=histogram
user.email=xxxxxxxxxxxx@xxxxxxxxxxxxx
user.name=Cheyenne Wills
}; f
=
=== Our Config Information ===
Git Config Path Information
Using config path: /etc/gitconfig
Using config path: /home/cwills/.config/git/config
Using config path: /home/cwills/.gitconfig
Using config path: /tmp/tstgit/a/.git/worktrees/c/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

Screen shot

shot-2023-08-17_15-33-59

CheyenneWills commented 11 months ago

Looks like the developer release 2090 fixes this problem