{"thread":{"id":"51463","subject":"Bug with deleted files and stash-push --keep-idex","startedAt":"2019-07-11T13:02:21Z","lastAt":"2019-07-16T20:09:02Z","messageCount":7,"participants":["Martin Nicolay","Thomas Gummerer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378804","messageId":"alpine.LSU.2.20.1907111452560.3570@cpza.bfz-tzou.qr","threadId":"51463","inReplyTo":null,"subject":"Bug with deleted files and stash-push --keep-idex","fromName":"Martin Nicolay","fromEmail":"m.nicolay@osm-ag.de","sentAt":"2019-07-11T12:55:43Z","receivedAt":"2019-07-11T13:02:21Z","isPatch":false,"sender":{"key":"m.nicolay@osm-ag.de","avatar":null},"body":"Hi!\n\nI don't know if this is a software or documentation bug.\n\nman git-stash says about --keep-index:\n     If the --keep-index option is used, all changes already added to\n     the index are left intact.\n\nIf a file is deleted and this deletion is in the index a following\n     $ git stash push --keep-index\nkeeps this deletion in the index but not in the working-tree.\n\nIf a file is changed and this change is in the index a following\n     $ git stash push --keep-index\nkeeps this change in the index and also in the working-tree.\n\nThis is inconsistent.\n\n------------- deletion -------------\n$ git status\nOn branch master\nChanges to be committed:\n   (use \"git reset HEAD <file>...\" to unstage)\n\n         deleted:    test-file\n\n$ git stash push --keep-index\nSaved working directory and index state WIP on master: a3171f887b new test-file\n$ git status\nOn branch master\nChanges to be committed:\n   (use \"git reset HEAD <file>...\" to unstage)\n\n         deleted:    test-file\n\nUntracked files:\n   (use \"git add <file>...\" to include in what will be committed)\n\n         test-file\n\n------------- change -------------\n$ git status\nOn branch master\nYour branch is up to date with 'origin/master'.\n\nChanges to be committed:\n   (use \"git reset HEAD <file>...\" to unstage)\n\n         modified:   test-file\n\n$ git stash push --keep-index\nSaved working directory and index state WIP on master: a3171f887b new test-file\n$ git status\nOn branch master\nYour branch is up to date with 'origin/master'.\n\nChanges to be committed:\n   (use \"git reset HEAD <file>...\" to unstage)\n\n         modified:   test-file\n\n--------------------------\n\nMy expectation was that the deletion would be preserved within the\nworking-tree because this is a change added to the index and should be\nleft intact.\n\nBest regards\nMartin Nicolay\n\n-- \n\nNo MS-Word attachments (http://www.gnu.org/philosophy/no-word-attachments.html)\n_______________________________________________________________________________\nOSM AG | Ruhrallee 191 | 45136 Essen | Fon: 0201-89 555 | Fax: 0201-89 55 400\nweb: www.osm-ag.de | e-mail: info@osm-ag.de\nIBAN: DE67 4325 0030 0001 0059 82 | BIC: WELADED1HRN\nUSt-ldNr.: DE163337313 | HRB: 28171 Essen\nAufsichtsratsvorsitzende: Dipl.-Kff. Sabine Elsas\nVorstand: Johannes Kuhn (Vorsitzender), Christian Damsky, Axel Roland\n\n--\nDiese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.\nWenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten\nhaben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.\nDas unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht\ngestattet.\n_______________________________________________________________________________"},{"id":"378842","messageId":"20190711174828.GF15477@hank.intra.tgummerer.com","threadId":"51463","inReplyTo":"alpine.LSU.2.20.1907111452560.3570@cpza.bfz-tzou.qr","subject":"[PATCH] stash: fix handling removed files with --keep-index","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2019-07-11T17:48:28Z","receivedAt":"2019-07-11T17:48:35Z","isPatch":true,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"On 07/11, Martin Nicolay wrote:\n> Hi!\n> \n> I don't know if this is a software or documentation bug.\n> \n> man git-stash says about --keep-index:\n>     If the --keep-index option is used, all changes already added to\n>     the index are left intact.\n> \n> If a file is deleted and this deletion is in the index a following\n>     $ git stash push --keep-index\n> keeps this deletion in the index but not in the working-tree.\n> \n> If a file is changed and this change is in the index a following\n>     $ git stash push --keep-index\n> keeps this change in the index and also in the working-tree.\n> \n> This is inconsistent.\n\nThanks for your report.  This has come up before in\nhttps://public-inbox.org/git/1555437849815.60450@rasenplanscher.info/,\nwhich I first thought was expected behaviour, but that was just me\nmisunderstanding the --keep-index option.  So I belive this is indeed\na bug.\n\nLuckily I had some more time to actually look at this this time\naround, so below is a potential fix.\n\nThis comes with a small caveat of overwriting untracked files if they\nhave been removed from the index, and replaced with a file that has\nnot been added yet.  I think that's okay as that happens in other\nplaces as well in stash, but wanted to point it out anyway.\n\n--- >8 ---\nSubject: [PATCH] stash: fix handling removed files with --keep-index\n\ngit stash push --keep-index is supposed to keep all changes that have\nbeen added to the index, both in the index and on disk.\n\nCurrently this doesn't behave correctly when a file is removed from\nthe index.  Instead of keeping it deleted on disk, --keep-index\ncurrently restores the file.\n\nFix that behaviour by using 'git restore' which can faithfully restore\nthe index and working tree.  This also simplifies the code.\n\nNote that this will overwrite untracked files if the untracked file\nhas the same name as a file that has been deleted in the index.\n\nSigned-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n---\n builtin/stash.c  | 34 ++++++++++------------------------\n t/t3903-stash.sh |  7 +++++++\n 2 files changed, 17 insertions(+), 24 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex fde6397caa..2a58c007e1 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1391,30 +1391,16 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q\n \t\t}\n \n \t\tif (keep_index == 1 && !is_null_oid(&info.i_tree)) {\n-\t\t\tstruct child_process cp_ls = CHILD_PROCESS_INIT;\n-\t\t\tstruct child_process cp_checkout = CHILD_PROCESS_INIT;\n-\t\t\tstruct strbuf out = STRBUF_INIT;\n-\n-\t\t\tif (reset_tree(&info.i_tree, 0, 1)) {\n-\t\t\t\tret = -1;\n-\t\t\t\tgoto done;\n-\t\t\t}\n-\n-\t\t\tcp_ls.git_cmd = 1;\n-\t\t\targv_array_pushl(&cp_ls.args, \"ls-files\", \"-z\",\n-\t\t\t\t\t \"--modified\", \"--\", NULL);\n-\n-\t\t\tadd_pathspecs(&cp_ls.args, ps);\n-\t\t\tif (pipe_command(&cp_ls, NULL, 0, &out, 0, NULL, 0)) {\n-\t\t\t\tret = -1;\n-\t\t\t\tgoto done;\n-\t\t\t}\n-\n-\t\t\tcp_checkout.git_cmd = 1;\n-\t\t\targv_array_pushl(&cp_checkout.args, \"checkout-index\",\n-\t\t\t\t\t \"-z\", \"--force\", \"--stdin\", NULL);\n-\t\t\tif (pipe_command(&cp_checkout, out.buf, out.len, NULL,\n-\t\t\t\t\t 0, NULL, 0)) {\n+\t\t\tstruct child_process cp_restore = CHILD_PROCESS_INIT;\n+\n+\t\t\tcp_restore.git_cmd = 1;\n+\t\t\targv_array_pushl(&cp_restore.args, \"restore\", \"--source\", oid_to_hex(&info.i_tree),\n+\t\t\t\t\t \"--staged\", \"--worktree\", NULL);\n+\t\t\tif (!ps->nr)\n+\t\t\t\targv_array_push(&cp_restore.args, \".\");\n+\t\t\telse\n+\t\t\t\tadd_pathspecs(&cp_restore.args, ps);\n+\t\t\tif (run_command(&cp_restore)) {\n \t\t\t\tret = -1;\n \t\t\t\tgoto done;\n \t\t\t}\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex b22e671608..b8e337893f 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -1234,4 +1234,11 @@ test_expect_success 'stash works when user.name and user.email are not set' '\n \t)\n '\n \n+test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' '\n+\ttest_commit to-remove to-remove &&\n+\tgit rm to-remove &&\n+\tgit stash --keep-index &&\n+\ttest_path_is_missing to-remove\n+'\n+\n test_done\n-- \n2.22.0.599.gf5cf68d754\n"},{"id":"378869","messageId":"xmqqims8qn8f.fsf@gitster-ct.c.googlers.com","threadId":"51463","inReplyTo":"20190711174828.GF15477@hank.intra.tgummerer.com","subject":"Re: [PATCH] stash: fix handling removed files with --keep-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-11T21:23:44Z","receivedAt":"2019-07-11T21:23:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Gummerer <t.gummerer@gmail.com> writes:\n\n> Fix that behaviour by using 'git restore' which can faithfully restore\n> the index and working tree.  This also simplifies the code.\n\nHmph.  I would have preferred to see we stayed away from 'restore'\n(and used 'checkout' instead, if you must use a Porcelain command),\nso that the \"fix\" can go to maintenance tracks, if distro packagers\nchoose to backport it.\n\nIsn't the machinery for \"git status\" (in wt-status.c) mature enough\nto allow us to learn what got changed all in-core, without spawning\nan external process these days, though?\n\n>  \t\tif (keep_index == 1 && !is_null_oid(&info.i_tree)) {\n> -\t\t\tstruct child_process cp_ls = CHILD_PROCESS_INIT;\n> -\t\t\tstruct child_process cp_checkout = CHILD_PROCESS_INIT;\n> -\t\t\tstruct strbuf out = STRBUF_INIT;\n> -\n> -\t\t\tif (reset_tree(&info.i_tree, 0, 1)) {\n> -\t\t\t\tret = -1;\n> -\t\t\t\tgoto done;\n> -\t\t\t}\n> -\n> -\t\t\tcp_ls.git_cmd = 1;\n> -\t\t\targv_array_pushl(&cp_ls.args, \"ls-files\", \"-z\",\n> -\t\t\t\t\t \"--modified\", \"--\", NULL);\n> -\n> -\t\t\tadd_pathspecs(&cp_ls.args, ps);\n> -\t\t\tif (pipe_command(&cp_ls, NULL, 0, &out, 0, NULL, 0)) {\n> -\t\t\t\tret = -1;\n> -\t\t\t\tgoto done;\n> -\t\t\t}\n> -\n> -\t\t\tcp_checkout.git_cmd = 1;\n> -\t\t\targv_array_pushl(&cp_checkout.args, \"checkout-index\",\n> -\t\t\t\t\t \"-z\", \"--force\", \"--stdin\", NULL);\n> -\t\t\tif (pipe_command(&cp_checkout, out.buf, out.len, NULL,\n> -\t\t\t\t\t 0, NULL, 0)) {\n> +\t\t\tstruct child_process cp_restore = CHILD_PROCESS_INIT;\n> +\n> +\t\t\tcp_restore.git_cmd = 1;\n> +\t\t\targv_array_pushl(&cp_restore.args, \"restore\", \"--source\", oid_to_hex(&info.i_tree),\n> +\t\t\t\t\t \"--staged\", \"--worktree\", NULL);\n> +\t\t\tif (!ps->nr)\n> +\t\t\t\targv_array_push(&cp_restore.args, \".\");\n> +\t\t\telse\n> +\t\t\t\tadd_pathspecs(&cp_restore.args, ps);\n> +\t\t\tif (run_command(&cp_restore)) {\n>  \t\t\t\tret = -1;\n>  \t\t\t\tgoto done;\n>  \t\t\t}\n> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> index b22e671608..b8e337893f 100755\n> --- a/t/t3903-stash.sh\n> +++ b/t/t3903-stash.sh\n> @@ -1234,4 +1234,11 @@ test_expect_success 'stash works when user.name and user.email are not set' '\n>  \t)\n>  '\n>  \n> +test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' '\n> +\ttest_commit to-remove to-remove &&\n> +\tgit rm to-remove &&\n> +\tgit stash --keep-index &&\n> +\ttest_path_is_missing to-remove\n> +'\n> +\n>  test_done\n"},{"id":"378958","messageId":"20190716133501.GG15477@hank.intra.tgummerer.com","threadId":"51463","inReplyTo":"xmqqims8qn8f.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] stash: fix handling removed files with --keep-index","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2019-07-16T13:35:01Z","receivedAt":"2019-07-16T13:35:07Z","isPatch":true,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"On 07/11, Junio C Hamano wrote:\n> Thomas Gummerer <t.gummerer@gmail.com> writes:\n> \n> > Fix that behaviour by using 'git restore' which can faithfully restore\n> > the index and working tree.  This also simplifies the code.\n> \n> Hmph.  I would have preferred to see we stayed away from 'restore'\n> (and used 'checkout' instead, if you must use a Porcelain command),\n> so that the \"fix\" can go to maintenance tracks, if distro packagers\n> choose to backport it.\n\nFair enough.  I thought this wouldn't even go to 'maint', since the\nbug exists since a while, so 'git restore' would be fine, but didn't\nthink of distro packagers.  I'm happy to use 'checkout' here instead.  \n\n> Isn't the machinery for \"git status\" (in wt-status.c) mature enough\n> to allow us to learn what got changed all in-core, without spawning\n> an external process these days, though?\n\nMaybe, I'm not all that familar with that machinery.  My longer term\nhope was actually to libify the checkout machinery, and to use that\nhere and use that to do all this (and the 'add', 'diff-index' and\n'apply' dance above) in core.  But maybe it's worth looking at the\n\"git status\" machinery for that as well?\n\nI probably won't have enough time to do that in the next few weeks\nthough, so my preference would be to just use checkout for this (I'll\nsend an updated patch) to fix the bug in the next release.  As we're\nalready spawning two external processes and would replace that with\njust spawning one it wouldn't make anything worse at least.\n\nThen we can try to do this all in-core at some point later, which I\nthink is a bit more work, and probably wouldn't be ready for the next\nrelease (at least I won't have time to work on it).\n\n> >  \t\tif (keep_index == 1 && !is_null_oid(&info.i_tree)) {\n> > -\t\t\tstruct child_process cp_ls = CHILD_PROCESS_INIT;\n> > -\t\t\tstruct child_process cp_checkout = CHILD_PROCESS_INIT;\n> > -\t\t\tstruct strbuf out = STRBUF_INIT;\n> > -\n> > -\t\t\tif (reset_tree(&info.i_tree, 0, 1)) {\n> > -\t\t\t\tret = -1;\n> > -\t\t\t\tgoto done;\n> > -\t\t\t}\n> > -\n> > -\t\t\tcp_ls.git_cmd = 1;\n> > -\t\t\targv_array_pushl(&cp_ls.args, \"ls-files\", \"-z\",\n> > -\t\t\t\t\t \"--modified\", \"--\", NULL);\n> > -\n> > -\t\t\tadd_pathspecs(&cp_ls.args, ps);\n> > -\t\t\tif (pipe_command(&cp_ls, NULL, 0, &out, 0, NULL, 0)) {\n> > -\t\t\t\tret = -1;\n> > -\t\t\t\tgoto done;\n> > -\t\t\t}\n> > -\n> > -\t\t\tcp_checkout.git_cmd = 1;\n> > -\t\t\targv_array_pushl(&cp_checkout.args, \"checkout-index\",\n> > -\t\t\t\t\t \"-z\", \"--force\", \"--stdin\", NULL);\n> > -\t\t\tif (pipe_command(&cp_checkout, out.buf, out.len, NULL,\n> > -\t\t\t\t\t 0, NULL, 0)) {\n> > +\t\t\tstruct child_process cp_restore = CHILD_PROCESS_INIT;\n> > +\n> > +\t\t\tcp_restore.git_cmd = 1;\n> > +\t\t\targv_array_pushl(&cp_restore.args, \"restore\", \"--source\", oid_to_hex(&info.i_tree),\n> > +\t\t\t\t\t \"--staged\", \"--worktree\", NULL);\n> > +\t\t\tif (!ps->nr)\n> > +\t\t\t\targv_array_push(&cp_restore.args, \".\");\n> > +\t\t\telse\n> > +\t\t\t\tadd_pathspecs(&cp_restore.args, ps);\n> > +\t\t\tif (run_command(&cp_restore)) {\n> >  \t\t\t\tret = -1;\n> >  \t\t\t\tgoto done;\n> >  \t\t\t}\n> > diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\n> > index b22e671608..b8e337893f 100755\n> > --- a/t/t3903-stash.sh\n> > +++ b/t/t3903-stash.sh\n> > @@ -1234,4 +1234,11 @@ test_expect_success 'stash works when user.name and user.email are not set' '\n> >  \t)\n> >  '\n> >  \n> > +test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' '\n> > +\ttest_commit to-remove to-remove &&\n> > +\tgit rm to-remove &&\n> > +\tgit stash --keep-index &&\n> > +\ttest_path_is_missing to-remove\n> > +'\n> > +\n> >  test_done\n"},{"id":"378963","messageId":"20190716142322.GH15477@hank.intra.tgummerer.com","threadId":"51463","inReplyTo":"20190711174828.GF15477@hank.intra.tgummerer.com","subject":"[PATCH v2] stash: fix handling removed files with --keep-index","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2019-07-16T14:23:22Z","receivedAt":"2019-07-16T14:23:28Z","isPatch":true,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"git stash push --keep-index is supposed to keep all changes that have\nbeen added to the index, both in the index and on disk.\n\nCurrently this doesn't behave correctly when a file is removed from\nthe index.  Instead of keeping it deleted on disk, --keep-index\ncurrently restores the file.\n\nFix that behaviour by using 'git checkout' in no-overlay mode which\ncan faithfully restore the index and working tree.  This also\nsimplifies the code.\n\nNote that this will overwrite untracked files if the untracked file\nhas the same name as a file that has been deleted in the index.\n\nSigned-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n---\n\nThis would be the version using 'git checkout' instead of 'git\nrestore'.  Still not doing everything in-core though, as mentioned in\nthe previous email.\n\n builtin/stash.c  | 32 +++++++++-----------------------\n t/t3903-stash.sh |  7 +++++++\n 2 files changed, 16 insertions(+), 23 deletions(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex fde6397caa..b5a301f24d 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -1391,30 +1391,16 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q\n \t\t}\n \n \t\tif (keep_index == 1 && !is_null_oid(&info.i_tree)) {\n-\t\t\tstruct child_process cp_ls = CHILD_PROCESS_INIT;\n-\t\t\tstruct child_process cp_checkout = CHILD_PROCESS_INIT;\n-\t\t\tstruct strbuf out = STRBUF_INIT;\n-\n-\t\t\tif (reset_tree(&info.i_tree, 0, 1)) {\n-\t\t\t\tret = -1;\n-\t\t\t\tgoto done;\n-\t\t\t}\n-\n-\t\t\tcp_ls.git_cmd = 1;\n-\t\t\targv_array_pushl(&cp_ls.args, \"ls-files\", \"-z\",\n-\t\t\t\t\t \"--modified\", \"--\", NULL);\n-\n-\t\t\tadd_pathspecs(&cp_ls.args, ps);\n-\t\t\tif (pipe_command(&cp_ls, NULL, 0, &out, 0, NULL, 0)) {\n-\t\t\t\tret = -1;\n-\t\t\t\tgoto done;\n-\t\t\t}\n+\t\t\tstruct child_process cp = CHILD_PROCESS_INIT;\n \n-\t\t\tcp_checkout.git_cmd = 1;\n-\t\t\targv_array_pushl(&cp_checkout.args, \"checkout-index\",\n-\t\t\t\t\t \"-z\", \"--force\", \"--stdin\", NULL);\n-\t\t\tif (pipe_command(&cp_checkout, out.buf, out.len, NULL,\n-\t\t\t\t\t 0, NULL, 0)) {\n+\t\t\tcp.git_cmd = 1;\n+\t\t\targv_array_pushl(&cp.args, \"checkout\", \"--no-overlay\",\n+\t\t\t\t\t oid_to_hex(&info.i_tree), \"--\", NULL);\n+\t\t\tif (!ps->nr)\n+\t\t\t\targv_array_push(&cp.args, \":/\");\n+\t\t\telse\n+\t\t\t\tadd_pathspecs(&cp.args, ps);\n+\t\t\tif (run_command(&cp)) {\n \t\t\t\tret = -1;\n \t\t\t\tgoto done;\n \t\t\t}\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex b22e671608..b8e337893f 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -1234,4 +1234,11 @@ test_expect_success 'stash works when user.name and user.email are not set' '\n \t)\n '\n \n+test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' '\n+\ttest_commit to-remove to-remove &&\n+\tgit rm to-remove &&\n+\tgit stash --keep-index &&\n+\ttest_path_is_missing to-remove\n+'\n+\n test_done\n-- \n2.22.0.599.gf5cf68d754\n"},{"id":"378992","messageId":"xmqqblxt3fpb.fsf@gitster-ct.c.googlers.com","threadId":"51463","inReplyTo":"20190716133501.GG15477@hank.intra.tgummerer.com","subject":"Re: [PATCH] stash: fix handling removed files with --keep-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-16T20:08:32Z","receivedAt":"2019-07-16T20:08:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Gummerer <t.gummerer@gmail.com> writes:\n\n> On 07/11, Junio C Hamano wrote:\n>> Thomas Gummerer <t.gummerer@gmail.com> writes:\n>> \n>> > Fix that behaviour by using 'git restore' which can faithfully restore\n>> > the index and working tree.  This also simplifies the code.\n>> \n>> Hmph.  I would have preferred to see we stayed away from 'restore'\n>> (and used 'checkout' instead, if you must use a Porcelain command),\n>> so that the \"fix\" can go to maintenance tracks, if distro packagers\n>> choose to backport it.\n>\n> Fair enough.  I thought this wouldn't even go to 'maint', since the\n> bug exists since a while, so 'git restore' would be fine, but didn't\n> think of distro packagers.  I'm happy to use 'checkout' here instead.  \n\nAs long as the \"--no-overlay\" option is used, it is not much better.\nBackporting the fix goes only back to 2.22 and no earlier.\n"},{"id":"378993","messageId":"xmqq7e8h3fop.fsf@gitster-ct.c.googlers.com","threadId":"51463","inReplyTo":"20190716142322.GH15477@hank.intra.tgummerer.com","subject":"Re: [PATCH v2] stash: fix handling removed files with --keep-index","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-16T20:08:54Z","receivedAt":"2019-07-16T20:09:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Gummerer <t.gummerer@gmail.com> writes:\n\n> git stash push --keep-index is supposed to keep all changes that have\n> been added to the index, both in the index and on disk.\n\nThanks, will queue.\n"}]}