Re: [PATCH] introduce git root

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arjun Sreedharan <arjun024@xxxxxxxxx> writes:

> On 30 November 2014 at 04:38, Philip Oakley <philipoakley@xxxxxxx> wrote:
>> From: "Arjun Sreedharan" <arjun024@xxxxxxxxx>
>>>
>>> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]