From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, jnareb@gmail.com, dirson@bertin.fr,
kevin@sb.org, peff@peff.net
Subject: Re: [PATCH] get_sha1: support relative path "<obj>:<sth>" syntax
Date: Thu, 11 Nov 2010 08:30:42 +0700 [thread overview]
Message-ID: <AANLkTimxR1YV+D2HBHUr8bCbrT7XyHfKoMN71raUZ3Jx@mail.gmail.com> (raw)
In-Reply-To: <7veiatht1b.fsf@alter.siamese.dyndns.org>
2010/11/11 Junio C Hamano <gitster@pobox.com>:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> 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
next prev parent reply other threads:[~2010-11-11 1:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-09 7:30 [RFC] Using gitrevisions :/search style with other operators Yann Dirson
2010-11-09 8:06 ` Kevin Ballard
2010-11-09 9:24 ` Yann Dirson
2010-11-10 0:18 ` Junio C Hamano
2010-11-10 0:33 ` Kevin Ballard
2010-11-10 7:32 ` Yann Dirson
2010-11-10 7:46 ` Kevin Ballard
2010-11-10 7:46 ` Yann Dirson
2010-11-10 15:26 ` Jakub Narebski
2010-11-10 16:37 ` [PATCH] get_sha1: support relative path "<obj>:<sth>" syntax Nguyễn Thái Ngọc Duy
2010-11-10 17:17 ` Matthieu Moy
2010-11-10 17:47 ` Jonathan Nieder
2010-11-11 13:18 ` Nguyen Thai Ngoc Duy
2010-11-10 19:34 ` Junio C Hamano
2010-11-11 1:30 ` Nguyen Thai Ngoc Duy [this message]
2010-12-09 21:10 ` Junio C Hamano
2010-12-09 21:37 ` Junio C Hamano
2010-12-10 1:35 ` Nguyen Thai Ngoc Duy
2010-11-10 17:23 ` [RFC] Using gitrevisions :/search style with other operators Junio C Hamano
2010-11-10 18:19 ` Jakub Narebski
2010-11-09 16:10 ` Jeff King
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=AANLkTimxR1YV+D2HBHUr8bCbrT7XyHfKoMN71raUZ3Jx@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=dirson@bertin.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=kevin@sb.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).