public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Arjun Sreedharan <arjun024@gmail•com>
Cc: Philip Oakley <philipoakley@iee•org>, Git <git@vger•kernel.org>,
	Junio C Hamano <gitster@pobox•com>
Subject: Re: [PATCH] introduce git root
Date: Sun, 30 Nov 2014 12:58:54 +0100	[thread overview]
Message-ID: <vpqoaro99xd.fsf@anie.imag.fr> (raw)
In-Reply-To: <CAJFMrCEciWXhBb36MVeFPi7Y7D=9zQ2xGPpiyUz9y4_hOh_taw@mail.gmail.com> (Arjun Sreedharan's message of "Sun, 30 Nov 2014 10:05:37 +0530")

Arjun Sreedharan <arjun024@gmail•com> writes:

> On 30 November 2014 at 04:38, Philip Oakley <philipoakley@iee•org> wrote:
>> From: "Arjun Sreedharan" <arjun024@gmail•com>
>>>
>>> This introduces `git root` which outputs the root directory
>>> (the directory that contains .git).
>>> The same can be accomplished by `git rev-parse --show-toplevel`.
>>> `git root` is much more intuitive and easy to remember.
>>> All it does is set the arguments for rev-parse
>>
>>
>> This may be better as an alias.
>> I've added it to my aliases list.
>>
>
> I know that. I am suggesting this to be a built-in command, without having the
> need to add as an alias.

Indeed, suggesting people to add an alias does not solve the
discoverability issue. git rev-parse --show-toplevel is not just long,
it's just not the place where people would look for (it's neither about
revision nor about parsing, so clearly, "rev-parse" is not a good place
to host the feature in the UI).

If we were to rewrite Git from scratch, then I would be all for having a
"git root" command. Given that we already have rev-parse
--show-toplevel, and that we'll have to keep it anyway for backward
compatibility, I'm a bit more hesitant ("Git is hard to use because it
doesn't have enough commands" is not a complain I hear so often ;-) ),
but still mostly positive.

If we go this way, then the documentation must be updated too. I think
the doc should still recommend "git rev-parse --show-toplevel" for
scripting until Git versions implementing "git root" are widely deployed
enough.

Also, there are other options of git rev-parse which should be dealt
with: at least --show-cdup (could be eg. "git root --relative") and
--show-prefix, but probably also others from the "Options for Files" in
the man of git-rev-parse.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2014-11-30 11:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 20:00 [PATCH] introduce git root Arjun Sreedharan
2014-11-29 23:08 ` Philip Oakley
2014-11-30  4:35   ` Arjun Sreedharan
2014-11-30 11:58     ` Matthieu Moy [this message]
2014-12-01  3:04       ` Junio C Hamano
2014-12-01  4:17         ` Christian Couder
2014-12-01  4:53           ` Junio C Hamano
2014-12-02  7:04           ` Jeff King
2014-12-02 10:05             ` Christian Couder
2014-12-02 17:26             ` Junio C Hamano
2014-12-04  9:22               ` Jeff King
2014-12-04 19:02                 ` Junio C Hamano
2014-12-04 20:00                   ` Matthieu Moy
2014-12-04 20:19                     ` Junio C Hamano
2014-12-04 21:12                   ` Jeff King
2014-12-04 21:30                     ` Junio C Hamano
2014-12-05  2:27                     ` Christian Couder
2014-12-05  9:27                       ` Jeff King
2014-12-07  5:23                         ` Christian Couder
2014-12-09 18:17                         ` Junio C Hamano
2014-12-10  9:16                           ` Christian Couder
2014-12-10 20:10                           ` Jeff King
2014-12-10 21:08                             ` 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

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

  git send-email \
    --in-reply-to=vpqoaro99xd.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=arjun024@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=philipoakley@iee$(echo .)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