Re: [PATCH] Set GIT_PATHNAME_PREFIX with aliases.

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

 



Am 5/5/2010 2:51, schrieb Jeff King:
> On Tue, May 04, 2010 at 08:25:22PM -0400, Jared Hance wrote:
> 
>> The environment variable GIT_PATHNAME_PREFIX passes on the
>> current working directory (where the git command was called from)
>> to shell aliases (aliases that begin with "!"). This allows these
>> shell aliases to know the directory that the git command was called
>> from.
> 
> Seems like a reasonable goal, but...

Sorry, I disagree.

The availability of this environment variable doesn't help the alias
writer a lot:

1. The alias is still burdened with the task to check *when* to use the
variable, i.e., whether an argument passed is absolute or relative, and
apply the variable only to a relative argument.

2. When more than one pathspec is passed to the alias, it is tedious to
apply $GIT_PATHNAME_PREFIX to each of them.

The only way where this variable could be used in a useful manner is to
write the alias as

   !cd "${GIT_PATHNAME_PREFIX:-.}" && { do stuff... ; }

which is something that git should do before it invokes the alias.

-- Hannes
--
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]