git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] git-gui: allow opening work trees from the startup dialog

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Jun 8, 2020, 09:31 UTC
Message-ID
<20200608093118.ppwpydlkd5bmsjh5@yadavpratyush.com>
In-Reply-To
<pull.644.v2.git.1591418019023.gitgitgadget@gmail.com>
+Cc Eric.
On 06/06/20 04:33AM, Mikhail Terekhov via GitGitGadget wrote:
Show 46 quoted lines
> From: Mikhail Terekhov <termim@gmail.com>
> 
> In proc _is_git check that supplied path is a valid work tree path.
> This allows the choose_repository::pick dialog to accept path to a
> work tree directory.
> 
> Signed-off-by: Mikhail Terekhov <termim@gmail.com>
> ---
>  lib/choose_repository.tcl | 29 +++++------------------------
>  1 file changed, 5 insertions(+), 24 deletions(-)
> 
> diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
> index e54f3e66d8f..07f29b0b13b 100644
> --- a/lib/choose_repository.tcl
> +++ b/lib/choose_repository.tcl
> @@ -357,31 +357,12 @@ proc _is_git {path {outdir_var ""}} {
>  	if {$outdir_var ne ""} {
>  		upvar 1 $outdir_var outdir
>  	}
> -	if {[file isfile $path]} {
> -		set fp [open $path r]
> -		gets $fp line
> -		close $fp
> -		if {[regexp "^gitdir: (.+)$" $line line link_target]} {
> -			set path [file join [file dirname $path] $link_target]
> -			set path [file normalize $path]
> -		}
> -	}
> -
> -	if {[file exists [file join $path HEAD]]
> -	 && [file exists [file join $path objects]]
> -	 && [file exists [file join $path config]]} {
> -		set outdir $path
> -		return 1
> -	}
> -	if {[is_Cygwin]} {
> -		if {[file exists [file join $path HEAD]]
> -		 && [file exists [file join $path objects.lnk]]
> -		 && [file exists [file join $path config.lnk]]} {
> -			set outdir $path
> -			return 1
> -		}
> +	if {[catch { 
> +		set outdir [git rev-parse --resolve-git-dir $path] 
> +		} ]} {
> +			return 0

I fixed trailing whitespace in a couple lines and a small style nitpick. You can check them here [0]. Will merge. Thanks both.

[0] https://github.com/prati0100/git-gui/commit/79089e52643ce1ba7d8494f32b2fb1891c926079
-- 
Regards,
Pratyush Yadav
Previous: Mikhail Terekhov via GitGitGadgetNext: Pratyush Yadav
Message 5 of 6 in “git-gui: allow opening work trees from the startup dialog”
  1. git-gui: allow opening work trees from the startup dialogMikhail Terekhov via GitGitGadget, May 26, 2020
  2. Pratyush YadavJun 5, 2020
  3. Eric SunshineJun 5, 2020
  4. git-gui: allow opening work trees from the startup dialogMikhail Terekhov via GitGitGadget, Jun 6, 2020
  5. Pratyush YadavJun 8, 2020
  6. Pratyush YadavJun 22, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.