Re: [PATCHv2 2/2] git-gui: handle bare repos correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, 19 Feb 2009, Giuseppe Bilotta wrote:

> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index 12c7ff3..a4c0d4b 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -122,6 +122,7 @@ unset oguimsg
>  set _appname {Git Gui}
>  set _gitdir {}
>  set _gitworktree {}
> +set _isbare {}
>  set _gitexec {}
>  set _reponame {}
>  set _iscygwin {}
> @@ -254,6 +255,23 @@ proc get_config {name} {
>  	}
>  }
>  
> +proc is_bare {} {
> +	global _isbare
> +	global _gitdir
> +	global _gitworktree
> +
> +	if {$_isbare eq {}} {
> +		if {[is_config_true core.bare]
> +			|| ($_gitworktree eq {}
> +				&& [lindex [file split $_gitdir] end] ne {.git})} {
> +			set _isbare 1
> +		} else {
> +			set _isbare 0
> +		}
> +	}
> +	return $_isbare
> +}

git rev-parse --is-bare-repository anyone?

> @@ -1913,7 +1931,7 @@ proc do_gitk {revs} {
>  		}
>  
>  		set pwd [pwd]
> -		if { $_gitworktree ne {} } {
> +		if { ![is_bare] } {

Why is this change needed at all?

> @@ -2317,10 +2335,12 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
>  #
>  menu .mbar.repository
>  
> -.mbar.repository add command \
> -	-label [mc "Explore Working Copy"] \
> -	-command {do_explore}
> -.mbar.repository add separator
> +if {![is_bare]} {
> +	.mbar.repository add command \
> +		-label [mc "Explore Working Copy"] \
> +		-command {do_explore}
> +	.mbar.repository add separator
> +}

How did you make sure that there are no more places?

(I, for one, would expect the standard mode of staging to fail in a bare 
repository.)

Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux