Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git status reports (non-existent) modifications after git stash push #1437

Closed
1 task done
boogisha opened this issue Jan 20, 2018 · 4 comments
Closed
1 task done

git status reports (non-existent) modifications after git stash push #1437

boogisha opened this issue Jan 20, 2018 · 4 comments
Milestone

Comments

@boogisha
Copy link

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.16.0.windows.2
cpu: x86_64
built from commit: a56c4f9e2a9513d2be57dc4346e0e84887399cd9
sizeof-long: 4
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 6.1.7601]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VIM
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

Nothing special that I can think of at the moment.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash

git init
echo A >test.txt
git add -- test.txt
git commit -m A
echo B >>test.txt
git stash push
git diff   # no changes, correct
git status # test.txt modified...?
  • What did you expect to occur after running these commands?

File "test.txt" shouldn't be listed as "modified" in git status output after git stash push. git diff correctly shows no differences.

  • What actually happened instead?

git status reports file "test.txt" as modified.

This also causes commands like git rebase -i --autostash to fail, as "modifications"(?) seem to be reported inside the working tree even after stashing.

At first, I thought it may be core Git bug, but testing on Ubuntu with v2.16.0 worked as expected (using the same test script provided above):

$ git version
git version 2.16.0

$ ./test.sh
+ git init
Initialized empty Git repository in /stash-push/.git/
+ echo A
+ git add -- test.txt
+ git commit -m A
[master (root-commit) c825473] A
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
+ echo B
+ git stash push
Saved working directory and index state WIP on master: c825473 A
+ git diff
+ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	test.sh

nothing added to commit but untracked files present (use "git add" to track)

On the other hand, this is what Git for Windows v2.16.0(2) does:

$ git version
git version 2.16.0.windows.2

$ ./test.sh
+ git init
Initialized empty Git repository in c:/stash-push/.git/
+ echo A
+ git add -- test.txt
+ git commit -m A
[master (root-commit) eb99ae2] A
 1 file changed, 1 insertion(+)
 create mode 100644 test.txt
+ echo B
+ git stash push
Saved working directory and index state WIP on master: eb99ae2 A
+ git diff
+ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        test.sh

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

Please let me know if I can be of more help, might be providing some more data.

@peolsson
Copy link

This happens to me as well. However, strangely enough "git checkout -- ." works as expected (as reported in issue #1438).

It's quite simple to reproduce. Do some kind of change, execute "git stash". The changes will be stashed, but git status still shows the files as changed. When doing a diff it shows no changes though. To make them not occur in "git status", I just execute "git checkout -- .", which seems to put the files in the correct state, and everything works as expected. The stash is also correct, so it's possible to do a git stash apply and get the changes back.

@boogisha
Copy link
Author

boogisha commented Jan 20, 2018

I'm running git bisect at the moment (as v2.15.1.windows.2 worked as expected, in contrast to v2.16.0.windows.2), hopefully getting somewhere.

@boogisha
Copy link
Author

boogisha commented Jan 20, 2018

For what it's worth (if I did this correctly), git bisect between v2.15.1.windows.2 (good) and v2.16.0.windows.2 (bad) pointed to fcba80a (ping @atetubou for reference), here`s output:

fcba80a2696c48fba77dd2ab3810092476e36fc2 is the first bad commit
commit fcba80a2696c48fba77dd2ab3810092476e36fc2
Author: Takuto Ikuta <tikuta@chromium.org>
Date:   Tue Jan 16 20:39:44 2018 +0900

    reset.c: enable fscache

    In git reset --hard, unpack-trees() is called with oneway_merge().
    oneway_merge calls lstat for each files in a repository.
    It is bottleneck of git reset --hard, especially in large repository.

    This patch improves time by using fscache.
    In chromium repository, time of git reset --hard is changed like below.
    I took 3 times stats in the repository.

    master:
    TotalSeconds: 21.0337971
    TotalSeconds: 20.0046612
    TotalSeconds: 20.6501752
    Avg: 20.5628778333333

    this patch:
    TotalSeconds: 4.8552376
    TotalSeconds: 4.8722343
    TotalSeconds: 4.9268245
    Avg: 4.88476546666667

    Signed-off-by: Takuto Ikuta <tikuta@chromium.org>

:040000 040000 b9baeab1b8bb8799506c61d2477eb06f9459a331 71ac2d1de1290bd39be9a07b7011d783a733a8d0 M      builtin

@dscho
Copy link
Member

dscho commented Jan 20, 2018

@boogisha excellent analysis, thank you! If nobody beats me to it, I hope to get to this ticket by this coming Tuesday.

dscho added a commit to git-for-windows/build-extra that referenced this issue Jan 22, 2018
A set of regressions introduced by patches intended
to speed up `reset` and `checkout` was fixed (issues
[#1437](git-for-windows/git#1437),
[#1438](git-for-windows/git#1438),
[#1440](git-for-windows/git#1440) and
[#1442](git-for-windows/git#1442).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho closed this as completed in e76e5c4 Jan 22, 2018
@dscho dscho added this to the v2.16.0(3) milestone Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants