git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Teach git-stash to "apply --index"
Date: Tue, 3 Jul 2007 12:17:05 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707031212570.4071@racer.site> (raw)
In-Reply-To: <7vodiut8c3.fsf@assigned-by-dhcp.cox.net>

Hi,

On Mon, 2 Jul 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 	I am not quite sure if this should not be the default, with
> > 	--skip-index to turn it off if the trivial index merge fails,
> > 	and the user might be interested only in the working directory
> > 	changes anyway.
> >
> > 	Comments?
> 
> There is a bit of impedance mismatch between a rename-aware
> three-way merge (aka merge-recursive) used to update the working
> tree and a patch that updates the index.  The "rename-aware"
> thing can be fixed by doing the diff with -M, though.

Ah yes, I did not think about renames. But like you said, adding -M to the 
diff should help that.

> It might be easier to explain (1) not have --index option, but attempt 
> to do this always, and (2) even if the index cannot be updated, keep 
> going, without worrying about losing the difference between I and W, 
> probably with a message to the end user.

Okay, in this case I propose to make this the default, with an option 
"--skip-index" to only try re-apply the changes to the working directory.

> Suppose you are the user who gets "perhaps you would want to run without 
> --index?" hint.  What can you do?  Run without --index, or forget about 
> unstashing.  But the latter does not sound like an option.  So it feels 
> to me that --index is an unnecessary option.

It is very much like the choice you have with "git checkout" vs "git 
checkout -f". Either you change your index accordingly, or you say "I 
don't care about the index. What changes I had there, I will reconstruct 
myself."

> The potential confusion problem I mentioned in two of my earlier 
> messages due to the program doing one thing sometimes and another thing 
> some other times still applies, though.

Yes, that's why I would suggest not going ahead when the index could not 
be easily merged. Rather give the user enough information to decide.

Of course, this means that in complicated cases, the user mustn't run and 
hide when she hears "index!", but I guess that complicated cases always 
need you to know your tools better than easy problems.

Ciao,
Dscho

      reply	other threads:[~2007-07-03 11:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-02 11:14 [PATCH] Teach git-stash to "apply --index" Johannes Schindelin
2007-07-03  4:33 ` Junio C Hamano
2007-07-03 11:17   ` Johannes Schindelin [this message]

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

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

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707031212570.4071@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).