git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Steve Folly <steve@spfweb.co.uk>
Cc: <git@vger.kernel.org>, Nanako Shiraishi <nanako3@lavabit.com>
Subject: Re: git stash pop not reapplying deletions
Date: Mon, 15 Feb 2010 16:41:19 +0100	[thread overview]
Message-ID: <201002151641.19694.trast@student.ethz.ch> (raw)
In-Reply-To: <loom.20100215T152932-38@post.gmane.org>

Please don't remove the Cc list, it helps us (among other things) flag
the mail that is important.

On Monday 15 February 2010 15:32:44 Steve Folly wrote:
> Thomas Rast <trast <at> student.ethz.ch> writes:
> > Yes, [git stash without --index] does stage new files, but that is
> > only to help you: otherwise you could forget them before
> > committing.
> 
> But that's even more confusing - not using --index only 
> restores *some* of the index. To be honest, 
> that's not really helping - I still have to stage deletions 
> manually.
> 
> If not using --index isn't supposed to restore the index, 
> then surely it shouldn't be staging the new files?

Not sure.  I personally prefer the behaviour as it is now, as I have
status.showUntrackedFiles = no and would most likely forget about
them.  It has been that way since the introduction of git-stash, so
maybe Nanako (Cc'd) can enlighten us further.

That being said, it could probably be made configurable along the
lines of the patch below, or even with a config option.


diff --git i/git-stash.sh w/git-stash.sh
index 3a0685f..fc56e1b 100755
--- i/git-stash.sh
+++ w/git-stash.sh
@@ -222,12 +222,26 @@ show_stash () {
 
 apply_stash () {
 	unstash_index=
+	dont_touch_index=
 
 	while test $# != 0
 	do
 		case "$1" in
 		--index)
 			unstash_index=t
+			dont_touch_index=
+			;;
+		--index=apply)
+			unstash_index=t
+			dont_touch_index=
+			;;
+		--index=added-only)
+			unstash_index=
+			dont_touch_index=
+			;;
+		--index=none)
+			unstash_index=
+			dont_touch_index=t
 			;;
 		-q|--quiet)
 			GIT_QUIET=t
@@ -293,7 +307,7 @@ apply_stash () {
 			a="$TMP-added" &&
 			git diff-index --cached --name-only --diff-filter=A $c_tree >"$a" &&
 			git read-tree --reset $c_tree &&
-			git update-index --add --stdin <"$a" ||
+			(test -n "$dont_touch_index" || git update-index --add --stdin <"$a") ||
 				die "Cannot unstage modified files"
 			rm -f "$a"
 		fi

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2010-02-15 15:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-14 19:45 git stash pop not reapplying deletions Steve Folly
2010-02-14 22:08 ` Thomas Rast
2010-02-15 14:32   ` Steve Folly
2010-02-15 15:41     ` Thomas Rast [this message]
2010-02-15 16:01       ` [PATCH] stash pop: remove 'apply' options during 'drop' invocation Thomas Rast
2010-02-15 18:46         ` [PATCH v2] " Stephen Boyd
2010-02-15 21:09       ` git stash pop not reapplying deletions Steve Folly
2010-02-16  2:17   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002151641.19694.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=nanako3@lavabit.com \
    --cc=steve@spfweb.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).