git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug with deleted files and stash-push --keep-idex

From
MNMartin Nicolay <m.nicolay@osm-ag.de>
Date
Jul 11, 2019, 12:55 UTC
Message-ID
<alpine.LSU.2.20.1907111452560.3570@cpza.bfz-tzou.qr>
Hi!
I don't know if this is a software or documentation bug.
man git-stash says about --keep-index:
     If the --keep-index option is used, all changes already added to
     the index are left intact.
If a file is deleted and this deletion is in the index a following
     $ git stash push --keep-index
keeps this deletion in the index but not in the working-tree.
If a file is changed and this change is in the index a following
     $ git stash push --keep-index
keeps this change in the index and also in the working-tree.
This is inconsistent.
------------- deletion -------------
$ git status
On branch master
Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
         deleted:    test-file
$ git stash push --keep-index
Saved working directory and index state WIP on master: a3171f887b new test-file
$ git status
On branch master
Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
         deleted:    test-file
Untracked files:
   (use "git add <file>..." to include in what will be committed)
         test-file

------------- change ------------- $ git status On branch master Your branch is up to date with 'origin/master'.

Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
         modified:   test-file

$ git stash push --keep-index Saved working directory and index state WIP on master: a3171f887b new test-file $ git status On branch master Your branch is up to date with 'origin/master'.

Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)
         modified:   test-file
--------------------------

My expectation was that the deletion would be preserved within the working-tree because this is a change added to the index and should be left intact.

Best regards Martin Nicolay

-- 
No MS-Word attachments (http://www.gnu.org/philosophy/no-word-attachments.html)
_______________________________________________________________________________
OSM AG | Ruhrallee 191 | 45136 Essen | Fon: 0201-89 555 | Fax: 0201-89 55 400
web: www.osm-ag.de | e-mail: info@osm-ag.de
IBAN: DE67 4325 0030 0001 0059 82 | BIC: WELADED1HRN
USt-ldNr.: DE163337313 | HRB: 28171 Essen
Aufsichtsratsvorsitzende: Dipl.-Kff. Sabine Elsas
Vorstand: Johannes Kuhn (Vorsitzender), Christian Damsky, Axel Roland

--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
_______________________________________________________________________________
Next: Thomas Gummerer
Message 1 of 7 in “Bug with deleted files and stash-push --keep-idex”
  1. Martin NicolayJul 11, 2019
  2. stash: fix handling removed files with --keep-indexThomas Gummerer, Jul 11, 2019
  3. Junio C HamanoJul 11, 2019
  4. Thomas GummererJul 16, 2019
  5. Junio C HamanoJul 16, 2019
  6. stash: fix handling removed files with --keep-indexThomas Gummerer, Jul 16, 2019
  7. Junio C HamanoJul 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.