public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* 'git stash push -- {dir}' puts files in stash that are outside of {dir}
@ 2023-07-26 17:05 Yuri
  2023-07-26 17:29 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Yuri @ 2023-07-26 17:05 UTC (permalink / raw)
  To: Git Mailing List

I am in the FreeBSD ports repository.

I run this command:

$ git stash push -m "gh-print-tuple" -- Mk

But then 'git show' shows that the top stash entry also has other files:

$ git stash show -p stash@{0} | grep diff
diff --git a/Mk/Scripts/print-submodule-gh_tuple.awk 
b/Mk/Scripts/print-submodule-gh_tuple.awk
diff --git a/Mk/Scripts/print-submodule-gh_tuple.sh 
b/Mk/Scripts/print-submodule-gh_tuple.sh
diff --git a/Mk/bsd.sites.mk b/Mk/bsd.sites.mk
diff --git a/audio/triceratops-lv2/files/patch-synth.cpp 
b/audio/triceratops-lv2/files/patch-synth.cpp
diff --git a/cad/scotch/distinfo b/cad/scotch/distinfo
diff --git 
a/cad/scotch/files/patch-Make.inc_Makefile.inc.i686__pc__freebsd 
b/cad/scotch/files/patch-Make.inc_Makefile.inc.i686__pc__freebsd
diff --git 
a/cad/scotch/files/patch-Make.inc_Makefile.inc.x86-64__pc__freebsd 
b/cad/scotch/files/patch-Make.inc_Makefile.inc.x86-64__pc__freebsd
diff --git a/x11/darktile/Makefile b/x11/darktile/Makefile
diff --git a/x11/darktile/distinfo b/x11/darktile/distinfo
diff --git 
a/x11/darktile/files/patch-vendor_github.com_kr_pty_ztypes__freebsd__arm64.go 
b/x11/darktile/files/patch-vendor_github.com_kr_pty_ztypes__freebsd__arm64.go
diff --git 
a/x11/darktile/files/patch-vendor_github.com_riywo_loginshell_loginshell.go 
b/x11/darktile/files/patch-vendor_github.com_riywo_loginshell_loginshell.go
diff --git a/x11/darktile/pkg-descr b/x11/darktile/pkg-descr


Why do files that are not under Mk get into stash?



Thanks,

Yuri



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'git stash push -- {dir}' puts files in stash that are outside of {dir}
  2023-07-26 17:05 'git stash push -- {dir}' puts files in stash that are outside of {dir} Yuri
@ 2023-07-26 17:29 ` Junio C Hamano
  2023-07-26 17:36   ` Yuri
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2023-07-26 17:29 UTC (permalink / raw)
  To: Yuri; +Cc: Git Mailing List

Yuri <yuri@tsoft•com> writes:

> I am in the FreeBSD ports repository.
>
> I run this command:
>
> $ git stash push -m "gh-print-tuple" -- Mk
>
> But then 'git show' shows that the top stash entry also has other files:
>
> $ git stash show -p stash@{0} | grep diff

Not offering a solution, as a quick test or two in my environment do
not reproduce this problem [*].  But instead of the above command,
which will show matches on any line that has "diff" in the "-p"
output, perhaps

    $ git stash show --stat

is easier to see?

Are there configuration variables set to affect the behaviour of the
"git stash" command in your environment that I do not have (I have
nothing in "git config -l | grep stash" output), which may be
affecting why it does not reproduce for me?

> Why do files that are not under Mk get into stash?


[Footnote]

* Admittedly I didn't recall we had pathspec support to "git stash
  push" so consider me no longer an expert in this area ;-).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'git stash push -- {dir}' puts files in stash that are outside of {dir}
  2023-07-26 17:29 ` Junio C Hamano
@ 2023-07-26 17:36   ` Yuri
  2023-07-26 18:14     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Yuri @ 2023-07-26 17:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On 7/26/23 10:29, Junio C Hamano wrote:
> Are there configuration variables set to affect the behaviour of the
> "git stash" command in your environment that I do not have (I have
> nothing in "git config -l | grep stash" output), which may be
> affecting why it does not reproduce for me?


"git config -l | grep stash" doesn't print anything.

Interestingly, the command 'git stash push -- Mk' puts intended and unintended files in stash, but the changes in unintended files (ones not under Mk) stay, while changes in the intended files are gone, as expected.

Clearing all changes and doing 'git stash pop && git stash push -- Mk' reproduces the problem.


Yuri


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'git stash push -- {dir}' puts files in stash that are outside of {dir}
  2023-07-26 17:36   ` Yuri
@ 2023-07-26 18:14     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2023-07-26 18:14 UTC (permalink / raw)
  To: Yuri; +Cc: Git Mailing List

Yuri <yuri@tsoft•com> writes:

> On 7/26/23 10:29, Junio C Hamano wrote:
>> Are there configuration variables set to affect the behaviour of the
>> "git stash" command in your environment that I do not have (I have
>> nothing in "git config -l | grep stash" output), which may be
>> affecting why it does not reproduce for me?
>
>
> "git config -l | grep stash" doesn't print anything.

Another thing to try.  The command internally uses some internal
form of "git diff" to find out what to save and reset to the HEAD
version in the working tree, so if you have an exotic configuration
variable that affects the way "diff" behaves, it _could_ trigger a
symptom like that (needless to say, the internal invocation of "git
diff" should have prepared for such an end-user configuration and
explicitly countermanded it, but people add configuration variables
after a command was implemented without thinking the ramification
through and especially when they are rarely used ones that do not
usually appear on Git developers' radar, such a bad interaction can
go unnoticed for a long time).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-26 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 17:05 'git stash push -- {dir}' puts files in stash that are outside of {dir} Yuri
2023-07-26 17:29 ` Junio C Hamano
2023-07-26 17:36   ` Yuri
2023-07-26 18:14     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox