public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Daniel Finnie <dan@danfinnie•com>
Cc: git@vger•kernel.org
Subject: Re: git ls-files -X option is relative to repo root
Date: Fri, 13 Feb 2015 14:02:10 -0800	[thread overview]
Message-ID: <xmqqy4o1lbbx.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAG4vEKP760_sq1fsJD_1jjz0_G+T8NosSXDqx0bvQy4tPVz5JQ@mail.gmail.com> (Daniel Finnie's message of "Fri, 13 Feb 2015 16:19:28 -0500")

Daniel Finnie <dan@danfinnie•com> writes:

> Do you have any comments on why the path in --exclude-from=<path> is
> relative to the project root?

Not really.

Because ls-files was designed to be used by Porcelain scripts, and
because the first thing Porcelain scripts are expected to do is to
learn the prefix and then cd to the root level of the working tree
before doing anything else, <path> that is relative to the root
level of the working tree ends up to be not so unnatural thing to be
used with --exclude-from=<path> (e.g. ".git/info/exclude").

If it were relative to whatever subdirectory the invoker of the
Porcelain script happened to be, Porcelain would have to do a lot
more (e.g. in "cd x/y && myPorcelain ../../.git/info/exclude", the
myPorcelain script would first have to learn the prefix is x/y, go
up two levels, and then strip two ../ from ../../.git/info/exclude
to turn it into .git/info/exclude when it runs ls-files).

So that is a convenience explanation in retrospect, but "Why" is
often a futile question to ask when talking about evolution, in
which whatever works gets picked.

      reply	other threads:[~2015-02-13 22:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13 19:23 git ls-files -X option is relative to repo root Daniel Finnie
2015-02-13 20:42 ` Junio C Hamano
2015-02-13 20:54   ` Junio C Hamano
2015-02-13 21:19     ` Daniel Finnie
2015-02-13 22: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

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

  git send-email \
    --in-reply-to=xmqqy4o1lbbx.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=dan@danfinnie$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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