"git stash push" doesn't respect pathspec regarding files added to index

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

 



Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
# Create repository with two files
git init
echo 'old contents in foo' >foo
echo 'old contents in bar' >bar
git add foo bar
git commit -m 'init'
# Modify both files and add them to index
echo 'new contents in foo' >foo
echo 'new contents in bar' >bar
git add foo bar
# Push stash with only "foo" in the pathspec
git stash push foo
# Reset and pop the stash
git reset --hard
git stash pop

What did you expect to happen? (Expected behavior)
Only the file "foo" should be restored from the stash.

What happened instead? (Actual behavior)
The stash entry stores and consequently restores changes in both files.

What's different between what you expected and what actually happened?
The changes in the file "bar" should not be included in the created stash entry.

Anything else you want to add:
This happens only if the files are added to the index.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.34.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC
Wed Sep 11 15:25:05 UTC 2 x86_64
compiler info: gnuc: 11.4
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

Regards
Piotr Siupa




[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