Re: Bug: "git stash create" ignores "message" argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 06, 2025 at 11:28:46AM +1000, José Miguel Armijo Fidalgo wrote:

> What did you do before the bug happened? (Steps to reproduce your issue)
>     $ git stash create "example message"
>     1e9b483d1f9477de5c99a708f4aa512ba
>     $ git stash store 1e9b483d1f9477de5c99a708f4aa512ba
>     $ git stash list
> 
> What did you expect to happen? (Expected behavior)
>      stash@{0}: example message
> 
> What happened instead? (Actual behavior)
>      stash@{0}: Created via "git stash store".

Hmm. Is it "stash create" that is the problem, or "stash store"?

If I do this:

  git init
  echo foo >file
  git add file
  git commit -m foo

  echo bar >file
  commit=$(git stash create "example message")

and then look at the resulting commit:

  git cat-file commit $commit

then it has the expected commit message "On main: example message".

But when we "git stash store" it, the matching reflog message is the
generic "created via git stash store" one. And that reflog message is
what is shown by "stash list" (because it is essentially just a reflog
walk of the stash ref).

So (just guessing) the intended usage is probably:

  commit=$(git stash create "$msg")
  git stash store -m "$msg" $commit

Which is a bit awkward, but then the point of these sub-commands is for
scripted use (I did not even know we had them until seeing this thread).

So perhaps we'd want one or both of:

  1. A documentation fix to make it clear that if you want to behave the
     same as "stash push" you should feed the message to both "create"
     and "store".

  2. Possibly "stash store" could pull the default message from the
     commit, rather than using the generic one.

-Peff




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux