Re: [PATCH 8/9] stash show: teach --include-tracked and --only-untracked
From: Junio C Hamano <hidden>
Date: 2021-02-02 21:57:25
Denton Liu [off-list ref] writes:
Stash entries can be made with untracked files via `git stash push --include-untracked`. However, because the untracked files are stored in the third parent of the stash entry and not the stash entry itself, running `git stash show` does not include the untracked files as part of the diff. Teach stash the --include-tracked option, which also displays the
Is that "tracked" or "untracked"?
untracked files in a stash entry from the third parent (if it exists). Do this by just concatenating the diff of the third parent against an empty tree. One limitation of this is that it would be possible to manually craft a stash entry which would present duplicate entries in the diff by duplicating a file in the stash and in the third parent.
In other words, a broken "stash" that cannot have be taken with "stash save -u" may show nonsense? I wouldn't be so worried about it, as long as we won't crash in "git stash show". But a larger downside is that you will have to see all diffs from the tracked paths from A to Z before you start seeing untracked paths from A to Z, which is not what people would expect how "include" behave---it is more like "append as afterthought". If we cannot do a good job showing both in a sensible way, I'd rather not to see us introduce such an incomplete "--include-untracked" option until we can do so. The "only-untracked" one does not have such problem, so it is probably a good feature to add at this moment, though. This is not in the scope of this topic, but I wonder if it people want to have the "--only-untracked" option on the "stash apply" command.