From: Duy Nguyen <pclouds@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC] git checkout $tree -- $path always rewrites files
Date: Fri, 7 Nov 2014 17:13:47 +0700 [thread overview]
Message-ID: <CACsJy8CPLvmbcdHHmfu6g0dUXJVQ8NhwqfGPD=-kcBmzF_ha6g@mail.gmail.com> (raw)
In-Reply-To: <20141107083805.GA26365@peff.net>
On Fri, Nov 7, 2014 at 3:38 PM, Jeff King <peff@peff.net> wrote:
> On Fri, Nov 07, 2014 at 03:13:24AM -0500, Jeff King wrote:
>
>> I noticed that "git checkout $tree -- $path" will _always_ unlink and
>> write a new copy of each matching path, even if they are up-to-date with
>> the index and the content in $tree is the same.
>
> By the way, one other thing I wondered while looking at this code: when
> we checkout a working tree file, we unlink the old one and write the new
> one in-place. Is there a particular reason we do this versus writing to
> a temporary file and renaming it into place? That would give
> simultaneous readers a more atomic view.
>
> I suspect the answer is something like: you cannot always do a rename,
> because you might have a typechange, directory becoming a file, or vice
> versa; so anyone relying on an atomic view during a checkout operation
> is already Doing It Wrong. Handling a content-change of an existing
> path would complicate the code, so we do not bother.
Not a confirmation, but it looks like Linus did it just to make sure
he had new permissions right, in e447947 (Be much more liberal about
the file mode bits. - 2005-04-16).
--
Duy
next prev parent reply other threads:[~2014-11-07 10:14 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 [this message]
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
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='CACsJy8CPLvmbcdHHmfu6g0dUXJVQ8NhwqfGPD=-kcBmzF_ha6g@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).