Re: [PATCH 8/9] stash show: teach --include-tracked and --only-untracked
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 2, 2021, 21:56 UTC
- Message-ID
- <xmqq5z3af81v.fsf@gitster.c.googlers.com>
- In-Reply-To
- <c2375d1fc6c5fe7a36d2f868b172e83749d67b45.1612258145.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
Show 7 quoted lines
> 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"?
Show 5 quoted lines
> 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.