Re: [PATCH 2/2] (resend) stash: Don't overwrite files that have gone from the index
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Apr 15, 2010, 07:33 UTC
- Message-ID
- <201004150933.41330.trast@student.ethz.ch>
- In-Reply-To
- <1271291062-32154-2-git-send-email-charles@hashpling.org>
Charles Bailey wrote:
Show 10 quoted lines
> diff --git a/git-stash.sh b/git-stash.sh
> index 908aab2..9efc544 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -87,6 +87,8 @@ create_stash () {
> export GIT_INDEX_FILE &&
> git read-tree -m $i_tree &&
> git add -u &&
> + { git diff --quiet --diff-filter=D --cached ||
> + git diff -z --name-only --diff-filter=D --cached | xargs -0 git add --ignore-errors; } &&I think you'll also have to turn it into an 'add -f' invocation since the file in question could conceivably have been ignored-but-tracked, and straight 'add' would refuse to re-track it.
(No, I don't have any good ideas on how to get rid of xargs short of some shell loop...)
--
Thomas Rast
trast@{inf,student}.ethz.ch