From: Chris Packham <judge.packham@gmail.com>
To: "Rémi Rampin" <remirampin@gmail.com>
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>, GIT <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] Fixes _is_git
Date: Thu, 5 Feb 2015 21:13:45 +1300 [thread overview]
Message-ID: <CAFOYHZAerQWpeOPzD5D3gqKdWYvaCE3vB88Y_iD30eRF5MC2DQ@mail.gmail.com> (raw)
In-Reply-To: <54D0EEB9.1090803@gmail.com>
On Wed, Feb 4, 2015 at 4:52 AM, Rémi Rampin <remirampin@gmail.com> wrote:
> 2015-02-02 12:24 UTC-05:00, Remi Rampin <remirampin@gmail.com>:
>>> proc _is_git {path} {
>>> + if {[file isfile $path]} {
>>> + set fp [open $path r]
>>> + gets $fp line
>>> + close $fp
>>> + if {[regexp "^gitdir: (.+)$" $line line link_target]} {
>
> 2015-02-03 3:44 UTC-05:00, Chris Packham <judge.packham@gmail.com>:
>> It might be simpler to use one of the 'string' commands e.g. string
>> wordend "gitdir: " I also suspect the string functions would be faster
>> than regexp but that probably doesn't matter.
>
> I want to check that the file actually begins with "gitdir: " and then
> extract the path, so I'm not sure if using string functions is that
> simple/fast.
Makes sense.
>
>>> + return [_is_git [file join [file dirname $path] $link_target]]
>
>> Do we want to avoid pathological cases of infinite recursion? Someone
>> would have to maliciously create such a situation.
>
> Limiting the recursion is very simple, but I'm not sure people are
> supposed to stumble on that. More importantly this probably calls for a
> different error message, thus a new error result that I am not ready to
> implement. But it could be another patch.
> But I suppose I can add a simple "return 0" limit to the recursion if
> needed, let me know.
It'd have to be fairly intentional to cause any real problems. The one
thing I was thinking was to factor out the part that checks for HEAD
info objects etc into a __is_git that _is_git could call thus
eliminating recursion but I don't see it really being anything more
than a theoretical issue.
next prev parent reply other threads:[~2015-02-05 8:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 21:46 [git-gui] bug report: "Open existing repository" dialog fails on submodules Rémi Rampin
2015-02-02 8:41 ` Chris Packham
2015-02-02 8:43 ` Chris Packham
2015-02-02 15:59 ` Rémi Rampin
2015-02-02 17:24 ` [PATCH 1/2] Fixes _is_git Remi Rampin
2015-02-02 17:24 ` [PATCH 2/2] Makes _do_open2 set _gitdir to actual path Remi Rampin
2015-02-03 8:51 ` Chris Packham
2015-02-03 16:00 ` Rémi Rampin
2015-02-03 8:44 ` [PATCH 1/2] Fixes _is_git Chris Packham
2015-02-03 15:52 ` Rémi Rampin
2015-02-05 8:13 ` Chris Packham [this message]
2015-02-05 16:20 ` [PATCH 0/2] gitfile support git git-gui Remi Rampin
2015-02-05 16:20 ` [PATCH 1/2] Fixes chooser not accepting gitfiles Remi Rampin
2015-02-05 16:20 ` [PATCH 2/2] Makes chooser set 'gitdir' to the resolved path Remi Rampin
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=CAFOYHZAerQWpeOPzD5D3gqKdWYvaCE3vB88Y_iD30eRF5MC2DQ@mail.gmail.com \
--to=judge.packham@gmail.com \
--cc=git@vger.kernel.org \
--cc=patthoyts@users.sourceforge.net \
--cc=remirampin@gmail.com \
/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).