From: Junio C Hamano <gitster@pobox.com>
To: Sitaram Chamarty <sitaramc@gmail.com>
Cc: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>, git@vger.kernel.org
Subject: Re: Checkout file without changing index?
Date: Thu, 25 Apr 2019 13:02:44 +0900 [thread overview]
Message-ID: <xmqqv9z2ybob.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <005b0aed-2c20-0c91-e4ad-98b0ec39359d@gmail.com> (Sitaram Chamarty's message of "Thu, 25 Apr 2019 09:10:50 +0530")
Sitaram Chamarty <sitaramc@gmail.com> writes:
> I'm not in a position to use either of those on at least some of my
> systems, but meanwhile, I thought I'd ask this: what is the difference
> between this and "git show REF:PATH > PATH", in terms of side-effects.
>
> (I.e., any differences other than looking cleaner, not having to repeat
> "PATH" etc.)
For that matter, what's the difference between these two and
git cat-file --filters REF:PATH >PATH
;-)
I think the major difference is that checkout and restore are facing
an end-user who is typing the command to the terminal interactively,
so it does not make it easy to deposit the contents to an arbitrary
path while taking pathspecs to allow multiple files to be checked
out. On the other hand, these "get content for a single path out of
the odb and then write it out to wherever I want to" may be more
suited for scripting.
Between the two that are for the-content-at-a-single-path, I would
further expect "git show REF:PATH" output would be less reliable
over time, as we reserve the right to add frills to the output from
the command to make it a more pleasant experience to humans (e.g. it
is not totally inconceivable for the command to notice "ah, this is
a JavaScript source file, so let's pass it through a syntax-aware
highligher), as opposed to placing more emphasis on the byte for
byte fidelity, which is desired for components used in scripts.
Those who would want the latter should be using the plumbing
cat-file.
prev parent reply other threads:[~2019-04-25 4:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 13:37 Checkout file without changing index? Piotr Krukowiecki
2019-04-24 13:46 ` Junio C Hamano
2019-04-24 18:15 ` Piotr Krukowiecki
2019-04-24 20:16 ` Philip Oakley
2019-04-25 3:40 ` Sitaram Chamarty
2019-04-25 4:02 ` Junio C Hamano [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
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=xmqqv9z2ybob.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=piotr.krukowiecki@gmail.com \
--cc=sitaramc@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).