Git development
 help / color / mirror / Atom feed
From: Ari Entlich <lmage11@twcny.rr.com>
To: Wincent Colaiuta <win@wincent.com>
Cc: Michael Witten <mfwitten@MIT.EDU>, Jeff King <peff@peff.net>,
	git@vger.kernel.org
Subject: Re: Proposed git mv behavioral change
Date: Sat, 20 Oct 2007 01:55:53 -0400	[thread overview]
Message-ID: <1192859753.13347.147.camel@g4mdd.entnet> (raw)

On Fri, 2007-10-19 at 13:33 +0200, Wincent Colaiuta wrote:
> El 19/10/2007, a las 4:29, Michael Witten escribió:
> > Ah. Basically my 'pseudo-code' is correct, but redundant.
> 
> If I understood the original poster's proposal then I don't think your
> code does what he asked for:
> 
> > What you want to happen is the following:
> > 
> > git show HEAD:A.txt > path/B.txt
> > git add path/B.txt
> > mv A.txt B.txt
> > git rm A.txt
> >
> > Is this correct?
> 
> Here you're copying the content of A.txt as it was in the last (HEAD)
> commit, but from what the poster said he wants the content of A.txt as
> it is staged in the index (that is, there may be staged but uncomitted
> changes).

You took the words right out of my mouth! :)

Yeah, I noticed the problem with using HEAD, but the other problem is
that this would change the contents of the file in the working directory
file, which I don't want. Thus, putting the contents of the file as it
is in the index into the working directory wouldn't be correct either.
In addition, I'm not quite sure where that "mv A.txt B.txt" came from,
since we're supposed to be moving A.txt to path/B.txt...

> > Better:
> >
> > > mv A.txt path/B.txt
> > > Point the index entry for A.txt to path/B.txt
> 
> Yes, that is basically what he was asking for, as I read it.

Yep! I was going to respond to your (Michael's) original message saying
exactly that. :)

> El 19/10/2007, a las 5:47, Jeff King escribió:
> > Hrm. So you _do_ want to do an index-only move of A to B, in which 
> > case the suggestion of a "git-mv --cached" seems sensible. Though 
> > I'm curious why you want that.
> 
> I agree that git-stash can be used in this workflow but I can also 
> imagine cases where the proposed "git-mv --cached" might be a bit 
> nicer.

As Shawn said, --cached wouldn't be entirely accurate as the file in the
working directory is being moved as well.

git-stash has been suggested to me numerous times, but I really feel
that there's no need to use it in this case - if the git mv command gave
adequate control to the user, it would be unnecessary.

> I'm thinking of occasions where you just want to do something 
> like:
> 
> git mv --cached foo bar
> git add --interactive bar

I think it would be the other way around, since the only time this
change would effect anything is when there are changes still waiting to
be staged.

Are you talking about REALLY only changing the index? I can't think of
why you'd want to do this either... After all, wouldn't there be no bar
file to do git add --interactive on? In addition, I don't think giving
--interactive a filename is meaningful...

> I'm not sure the proposed "--cached" switch should ever be the 
> default -- would need to ponder that one -- but I do think the switch 
> would be a nice addition.

Yeah, that is one thing I was wondering. It would break compatibility,
but would it be enough to put a note about that in the announcements for
a release? Could you make the change at a release when the interface
isn't guaranteed to be the same, or is this practice only done with
libraries?

It might be interesting to do some sort of survey of whether people
depend on this behavior. It seems pretty inconsistent with how git works
otherwise, and I'd be surprised if a lot of people expect it (kinda like
the Spanish Inquisition :-P).

Thanks,
	Ari

             reply	other threads:[~2007-10-20  5:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20  5:55 Ari Entlich [this message]
2007-10-20  6:31 ` Proposed git mv behavioral change Jeff King
2007-10-20 11:02 ` Wincent Colaiuta
2007-10-20 11:06   ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2007-10-19  4:41 lmage11
2007-10-18 15:47 lmage11
2007-10-19  1:47 ` Michael Witten
2007-10-19  1:57   ` Shawn O. Pearce
2007-10-19  2:07     ` Michael Witten
2007-10-19  2:15       ` Shawn O. Pearce
2007-10-19  2:16       ` Jeff King
2007-10-19  2:29         ` Michael Witten
2007-10-19 11:33           ` Wincent Colaiuta
2007-10-19 15:57             ` Michael Witten
2007-10-19  1:54 ` Shawn O. Pearce
2007-10-19  2:54   ` Michael Witten
2007-10-19  3:19     ` Shawn O. Pearce
2007-10-19  3:24       ` Jeff King
2007-10-19  3:26         ` Michael Witten
2007-10-19  3:35           ` Jeff King
2007-10-19  3:40             ` Michael Witten
2007-10-19  3:47               ` Jeff King
2007-10-19  3:53                 ` Michael Witten
2007-10-19  3:58                   ` Jeff King
2007-10-20  5:55                 ` Ari Entlich
2007-10-20  6:24                   ` Jeff King
2007-10-20  6:34                     ` Michael Witten
2007-10-20  6:36                       ` Jeff King
2007-10-20  6:36                     ` Shawn O. Pearce
2007-10-20  6:40                       ` Jeff King
2007-10-22 14:00                         ` Karl Hasselström
2007-10-20  6:45                       ` Michael Witten
2007-10-20  7:02                         ` Shawn O. Pearce
2007-10-20 11:15                         ` Wincent Colaiuta
2007-10-22 14:08                           ` Karl Hasselström
2007-10-20  5:55   ` Ari Entlich
2007-10-20  6:30     ` Shawn O. Pearce
2007-10-20  7:46       ` Mike Hommey
2007-10-20  6:34     ` Jeff King

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=1192859753.13347.147.camel@g4mdd.entnet \
    --to=lmage11@twcny.rr.com \
    --cc=git@vger.kernel.org \
    --cc=mfwitten@MIT.EDU \
    --cc=peff@peff.net \
    --cc=win@wincent.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