Re: [PATCH 1/2] Fixes _is_git
- From
Chris Packham <judge.packham@gmail.com>
- Date
- Feb 3, 2015, 08:44 UTC
- Message-ID
- <CAFOYHZBHoXC34gBu_Lx347f=-uUcVM1nHYT87SzxfeMa=KdFgw@mail.gmail.com>
- In-Reply-To
- <1422897883-11036-1-git-send-email-remirampin@gmail.com>
Hi Remi,
Added Pat Thoyts the git-gui maintainer.
(Disclaimer, it's been years since I did anything with Tcl).
On Tue, Feb 3, 2015 at 6:24 AM, Remi Rampin <remirampin@gmail.com> wrote:
Show 19 quoted lines
> Function _git_dir would previously fail to accept a "gitdir: ..." file
> as a valid Git repository.
> ---
> lib/choose_repository.tcl | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
> index 92d6022..49ff641 100644
> --- a/lib/choose_repository.tcl
> +++ b/lib/choose_repository.tcl
> @@ -339,6 +339,16 @@ method _git_init {} {
> }
>
> 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]} {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.
> + 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.
Show 14 quoted lines
> + }
> + return 0
> + }
> +
> if {[file exists [file join $path HEAD]]
> && [file exists [file join $path objects]]
> && [file exists [file join $path config]]} {
> --
> 1.9.5.msysgit.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html