Re: [PATCH] get_sha1: support relative path "<obj>:<sth>" syntax

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

 



2010/11/11 Junio C Hamano <gitster@xxxxxxxxx>:
> Nguyán ThÃi Ngác Duy Â<pclouds@xxxxxxxxx> writes:
>
>> Â Â Â Â Â Â Â if (namelen < 3 ||
>> Â Â Â Â Â Â Â Â Â name[2] != ':' ||
>> - Â Â Â Â Â Â Â Â name[1] < '0' || '3' < name[1])
>> + Â Â Â Â Â Â Â Â name[1] < '0' || '3' < name[1]) {
>> Â Â Â Â Â Â Â Â Â Â Â cp = name + 1;
>> + Â Â Â Â Â Â Â Â Â Â if (startup_info && cp[0] == '.' &&
>> + Â Â Â Â Â Â Â Â Â Â Â Â (cp[1] == '/' || (cp[1] == '.' && cp[2] == '/'))) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â new_path = prefix_path(startup_info->prefix,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âstrlen(startup_info->prefix),
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcp);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â cp = new_path;
>> + Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â }
>
> What does this new codepath do when we know where the working tree is and
> we are outside of the working tree (e.g. we are looking at the index or a
> commit in a submodule from above the superproject)?
>
> What should it do?

Prefix is NULL in that case. So no prefixing, git will complain the
given path does not exist (although it should say "./" syntax is not
usable without a worktree).

prefix_path() dies if the resolved path is outside repo. So no, users
can't look up files in superproject from a subproject. I think we need
to define the superproject/subproject relation first. I have
$HOME/.git, but I don't think it's a superproject to any repos inside
my $HOME.
-- 
Duy
ÿô.nlj·Ÿ®‰­†+%ŠË±é¥Šwÿº{.nlj· ŠßžØn‡r¡öë¨è&£ûz¹Þúzf£¢·hšˆ§~†­†Ûÿÿïÿ‘ê_èæ+v‰¨þ)ßø

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