-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Pathspec fatal git stash push keep-index with globs #2037
Comments
@christianbumann an MCVE usually comes in the form of a copy/paste'able list of commands, and if necessary with a URL from where to clone a tiny repository to reproduce the issue ;-) But reading again, I found some commands interspersed with the screenshots (from which I can copy exactly no text whatsoever...). Let me try first in WSL. |
Okay, I tested in WSL, and I have news: And in WSL (and by extension, Linux, because they are close enough for this current issue), this works: You probably come from the Java/Ant world, where Please test again, dropping the |
Turns out that a simple I think we'll need something like this: diff --git a/builtin/stash.c b/builtin/stash.c
index 794fba6e2d..23bdda3016 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -837,7 +837,7 @@ static void add_pathspecs(struct argv_array *args,
int i;
for (i = 0; i < ps.nr; i++)
- argv_array_push(args, ps.items[i].match);
+ argv_array_push(args, ps.items[i].original);
}
/* |
Dropping The example (command above which is no longer working for us) is only a short part of a script we are using. We created a git alias which cleans up the repo (stashing modified files - cleanup - unstash) and the pattern above is to define files which are created, but shouldn't be deleted during cleanup. Unfortunately we need some expression like **./ because the files can be in any folder inside the repo. |
I actually figured it out... see gitgitgadget#159 |
Ok thank you so much for your effort and fix! |
Please let me take a moment (catching my breath between three parallel projects, where this here ticket is one of them) to thank you for reporting this. Without reports like this one, I would not even be aware of the bugs, and I cannot fix what I do not know about. Granted, I would have liked the MCVE to be a bit more minimal, and a bit more convenient for me to reproduce (i.e. in a scripted form), and I was grumpy about it and shouldn't have been. I am sorry for that! So to give you an idea what is going to happen now:
Hopefully all of this will be done in time for v2.21.1, which I get a feeling will be happening some time soon (if the Git maintainer's recent "What's cooking" is any indication). |
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes git-for-windows#2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes git-for-windows#2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes git-for-windows#2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
So I sent the fix to the Git mailing list via gitgitgadget#159, and it was integrated into the "proposed updates" branch; I am confident that it will be make the hop to |
Okay, I merged the PR. The snapshot build is running here. Once it is done, the snapshot I would like you to test, @christianbumann, will be available at https://wingit.blob.core.windows.net/files/index.html. |
@dscho A first quick test from my side was successful. I will ask tomorrow some other developers from our company to test this version too... |
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Excellent. Please do make sure that all your use cases are covered. Nothing is more frustrating for me than fixing somebody's bug, releasing a new version of Git for Windows with too little testing by the bug reporter, only to find out that the bug was not fully fixed. You'd be surprised how often that happens... |
@dscho This is not working if more than one pattern will be passed. Example command: git stash push --all --keep-index :(glob)**/a.txt :(glob)**/b.txt2 If any of booth files exists (a.txt or b.txt2) this won't work error message: git stash push --all --keep-index :(glob)**/a.txt :(glob)**/b.txt2
Saved working directory and index state WIP on master: 48959c6a3b olkj
fatal: pathspec ':(glob,prefix:0)**/a.txt' did not match any files |
Okay, I tried to reproduce that, and was not able to confirm. It works over here. This is what I did (for my own ease, I reused the worktree of the regression test I introduced): C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>echo 1 >untracked.txt
C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>echo 2 >untracked.txt2
C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>dir untracked*
Volume in drive C is OSDisk
Volume Serial Number is 02D6-2667
Directory of C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked
03/13/2019 11:39 AM 4 untracked.txt
03/13/2019 11:39 AM 4 untracked.txt2
2 File(s) 8 bytes
0 Dir(s) 55,683,592,192 bytes free
C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>git stash push -u :(glob)**/*.txt :(glob)**/*.txt2
Saved working directory and index state WIP on master: 14579a4 Add .gitignore
C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>dir untracked*
Volume in drive C is OSDisk
Volume Serial Number is 02D6-2667
Directory of C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked
File Not Found For the record, this is the version I tested: C:\git-sdk-64\usr\src\git\wip6\t\trash directory.t3905-stash-include-untracked>git version --build-options
git version 2.21.0.windows.1.80.gdc2ae9a382
cpu: x86_64
built from commit: dc2ae9a38264da2af13b0f95cc4fa5eee2ebf893
sizeof-long: 4
sizeof-size_t: 8 |
@dscho Create only one of the file which fits the pattern C:\Dev\A\B>echo 1 >untracked.txt
C:\Dev\A\B>echo 2 >untracked.txt2
C:\Dev\A\B>dir untracked*
Datenträger in Laufwerk C: ist Windows
Volumeseriennummer: 1E13-129E
Verzeichnis von C:\Dev\A\B
14.03.2019 07:29 4 untracked.txt
14.03.2019 07:29 4 untracked.txt2
2 Datei(en), 8 Bytes
0 Verzeichnis(se), 121’764’409’344 Bytes frei
C:\Dev\A\B>git stash push -u :(glob)**/*.txt :(glob)**/*.txt2
Saved working directory and index state WIP on master: 88c946a9a Merged PR 11339: Fix typo in release notes
C:\Dev\A\B>dir untracked*
Datenträger in Laufwerk C: ist Windows
Volumeseriennummer: 1E13-129E
Verzeichnis von C:\Dev\A\B
Datei nicht gefunden
C:\Dev\A\B>echo 1 >untracked.txt
C:\Dev\A\B>dir untracked*
Datenträger in Laufwerk C: ist Windows
Volumeseriennummer: 1E13-129E
Verzeichnis von C:\Dev\A\B
14.03.2019 07:30 4 untracked.txt
1 Datei(en), 4 Bytes
0 Verzeichnis(se), 121’762’541’568 Bytes frei
C:\Dev\A\B>git stash push -u :(glob)**/*.txt :(glob)**/*.txt2
Saved working directory and index state WIP on master: 88c946a9a Merged PR 11339: Fix typo in release notes
fatal: pathspec ':(glob,prefix:0)**/*.txt2' did not match any files
C:\Dev\A\B> |
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes git-for-windows#2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
When passing a list of pathspecs to, say, `git add`, we need to be careful to use the original form, not the parsed form of the pathspecs. This makes a difference e.g. when calling git stash -- ':(glob)**/*.txt' where the original form includes the `:(glob)` prefix while the parsed form does not. However, in the built-in `git stash`, we passed the parsed (i.e. incorrect) form, and `git add` would fail with the error message: fatal: pathspec '**/*.txt' did not match any files at the stage where `git stash` drops the changes from the worktree, even if `refs/stash` has been actually updated successfully. This fixes #2037 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Setup
64bit
defaults?
Defaults
to the issue you're seeing?
Reproducible on many different machines
Details
CMD
Add a file, e.g. test.testextension
git stash push --all --keep-index :(glob)**/*.testextension
no error
Error
The text was updated successfully, but these errors were encountered: