git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Martin von Zweigbergk <martinvonz@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC] git checkout $tree -- $path always rewrites files
Date: Sun, 9 Nov 2014 04:42:43 -0500	[thread overview]
Message-ID: <20141109094243.GA17369@peff.net> (raw)
In-Reply-To: <CANiSa6gqu9cRJ4gY5M4ou_zQP=1+U2_C9nHDOoaX01yYn5C+aw@mail.gmail.com>

On Sat, Nov 08, 2014 at 08:19:21AM -0800, Martin von Zweigbergk wrote:

> > What should:
> >
> >   git checkout HEAD -- some-new-path
> >
> > do in that case? With the current code, it actually barfs, complaining
> > that nothing matched some-new-path (because it is not part of HEAD, and
> > therefore we don't consider it at all), and aborts the whole operation.
> > I think we would want to delete some-new-path in that case, too.
> 
> I don't think we'd want it to be deleted. I would view 'git reset
> --hard' as the role model here, and that command (without paths) would
> not remove the file. And applying it to a path should not change the
> behavior, just restrict it to the paths, right?

Are you sure about "git reset" here? If I do:

  git init
  echo content >file && git add file && git commit -m base
  echo modified >file
  echo new >some-new-path
  git add file some-new-path
  git reset --hard

then we delete some-new-path (it is not untracked, because the index
knows about it). That makes sense to me. I.e., we treat it with the same
"preciousness" whether it is named explicitly or not.

-Peff

  reply	other threads:[~2014-11-09  9:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  8:13 [RFC] git checkout $tree -- $path always rewrites files Jeff King
2014-11-07  8:38 ` Jeff King
2014-11-07 10:13   ` Duy Nguyen
2014-11-07 16:51     ` Junio C Hamano
2014-11-07 19:15     ` Jeff King
2014-11-07 17:14 ` Junio C Hamano
2014-11-07 19:17   ` Jeff King
     [not found]     ` <CANiSa6hufp=80TaesNpo1CxCbwVq3LPXvYaUSbcmzPE5pj_GGw@mail.gmail.com>
2014-11-08  7:10       ` Martin von Zweigbergk
     [not found]         ` <CAPc5daWdzrHr8Rdksr3HycMRQu0=Ji7h=BPYjzZj7MH6Ko0VgQ@mail.gmail.com>
2014-11-08  8:03           ` Martin von Zweigbergk
2014-11-08  8:30           ` Jeff King
2014-11-08  8:45             ` Jeff King
2014-11-09 18:37               ` Junio C Hamano
2014-11-08 16:19             ` Martin von Zweigbergk
2014-11-09  9:42               ` Jeff King [this message]
2014-11-09 17:21             ` Junio C Hamano
2014-11-13 18:30               ` Jeff King
2014-11-13 19:15                 ` Junio C Hamano
2014-11-13 19:26                   ` Jeff King
2014-11-13 20:03                     ` Jeff King
2014-11-13 21:18                       ` Junio C Hamano
2014-11-13 21:37                         ` Jeff King
2014-11-14  5:44               ` David Aguilar
2014-11-14 19:27                 ` 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=20141109094243.GA17369@peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martinvonz@gmail.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.
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).