Re: [PATCH 1/2] Rename submodule.<name>.rebase to submodule.<name>.update

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

 



Johan Herland, 03.06.2009:
> The addition of "submodule.<name>.rebase" demonstrates the usefulness of
> alternatives to the default behaviour of "git submodule update". However,
> by naming the config variable "submodule.<name>.rebase", and making it a
> boolean choice, we are artificially constraining future git versions that
> may want to add _more_ alternatives than just "rebase".
> 
> Therefore, while "submodule.<name>.rebase" are not yet in a stable git
> release, future-proof it, by changing it from
> 
>   submodule.<name>.rebase = true/false
> 
> to
> 
>   submodule.<name>.update = checkout/rebase
> 
> where "checkout" specifies the default behaviour of "git submodule update"
> (checking out the new commit to a detached HEAD), and "rebase" specifies
> the --rebase behaviour (where the current local branch in the submodule is
> rebase onto the new commit). Thus .update == checkout is .rebase == false,
> and .update == rebase is equivalent to .rebase == false. Finally, leaving
                                                    ^^^^^
.rebase == true

> diff --git a/git-submodule.sh b/git-submodule.sh
> @@ -400,9 +400,9 @@ cmd_update()
>  			die "Unable to find current revision in submodule path '$path'"
>  		fi
>  
> -		if test true = "$rebase"
> +		if ! test -z "$update"

Isn't this simpler: if test -n "$update"
OTOH I think I have heard something about portability, but I'm not sure.

> @@ -420,16 +420,18 @@ cmd_update()
>  				die "Unable to fetch in submodule path '$path'"
>  			fi
>  
> -			if test true = "$rebase_module"
> -			then
> -				command="git-rebase"
> +			case "$update_module" in
> +			rebase)
> +				command="git rebase"

I think it is common practice to use the dashed form in scripts and this
patch shouldn't change it anyway.

>  				action="rebase"
>  				msg="rebased onto"
> -			else
> -				command="git-checkout $force -q"
> +				;;
> +			*)
> +				command="git checkout $force -q"

ditto

--
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]