sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
981 stars 100 forks source link

[BUG] Git Stash is not working in SourceGit version 8.26, on MacOS 12.7 #404

Closed ozmium closed 2 weeks ago

ozmium commented 2 weeks ago

If you modify a file, and try to stash the changes using SourceGit's "Stash Local Changes" dialog, SourceGit will fail and not do it. This happens on Mac OS 12.7 Monterey. I don't know if Linux and Windows have the same problem.

https://github.com/user-attachments/assets/51f6fce3-db61-4fff-aaa1-2782cd9b2466

An example error is:

error: unknown option `pathspec-from-file=/var/folders/1c/n0b0n2xs7b71zwr998j0nty00000gp/T/tmp5JUuMw.tmp'
usage: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
          [-u|--include-untracked] [-a|--all] [-m|--message <message>]
          [--] [<pathspec>...]]
    -k, --keep-index      keep index
    -p, --patch           stash in patch mode
    -q, --quiet           quiet mode
    -u, --include-untracked
                          include untracked files in stash
    -a, --all             include ignore files
    -m, --message <message>
                          stash message

Stash works fine on other Git clients, for the same repository.

Version:

love-linger commented 2 weeks ago

which version of git you are using? The --pathspec-from-file=<file> option for git stash push command is introduce from 2.26.0 (4 years ago)

ozmium commented 2 weeks ago
git --version
git version 2.24.3 (Apple Git-128)

type git
git is /usr/bin/git

Maybe you need to make SourceGit compatible with older Git versions? Or check which version is used before running certain commands?

It's not so easy to update the system Git version on MacOS. It normally requires the user to install a separate Git version in a different location, and then point to it with the $PATH environment variable.

love-linger commented 2 weeks ago

I've pushed a commit that use the old style of stash command before 2.26.0