Subject: Re: [PATCH] git-gui: Correctly set up locators in case of preset URL variable

From: "Shawn O. Pearce" <[email-masked]>
Date: Fri, 10 Oct 2008 09:42:55 -0700

Petr Baudis <[email-masked]> wrote:
> This patch fixes locators setup in case the URL variable is already set,
> e.g. in the clone dialog during 'git gui clone'.

Huh.  Better, but Remote->Push... still crashes with your series:

can't read "push_url": no such variable
can't read "push_url": no such variable
    while executing
"set $urlvar"
    (procedure "location_input" line 26)
    invoked from within
"location_input $w.dest.url_t push_url push"
    (procedure "do_push_anywhere" line 53)
    invoked from within
"do_push_anywhere"
    invoked from within
".#mbar.#mbar#remote invoke active"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke active]"
    (procedure "tk::MenuInvoke" line 50)
    invoked from within
"tk::MenuInvoke .#mbar.#mbar#remote 1"
    (command bound to event)

> diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl
> index 277e6b8..02c4eca 100644
> --- a/git-gui/lib/transport.tcl
> +++ b/git-gui/lib/transport.tcl
> @@ -68,8 +68,13 @@ proc location_input {widget urlvar op} {
>  
>  	global _locator_template _locator_input _locator_var
>  	trace remove variable _locator_input write locator_update
> -	set _locator_template $default_locator
> -	set _locator_input {}
> +	if {[set $urlvar] == {}} {
> +		set _locator_template $default_locator
> +		set _locator_input {}
> +	} else {
> +		set _locator_template "URL"
> +		set _locator_input [set $urlvar]
> +	}
>  	set _locator_var $urlvar
>  	trace add variable _locator_input write locator_update
>  
> -- 
> tg: (3c6c738..) t/git-gui/locator-preset (depends on: git-gui/locators t/git-gui/clonecmd)

-- 
Shawn.