[PATCH git-remote-gcrypt imported] Allowing git-config to ...

Sean Whitton spwhitton at spwhitton.name
Wed Jul 22 23:52:54 BST 2020


Hello Jay,

Thank you for the patch, but unfortunately there are still some issues.

On Wed 22 Jul 2020 at 11:16AM +01, Jay Colson wrote:

> diff --git a/git-remote-gcrypt b/git-remote-gcrypt
> index 689e025..42c3d5e 100755
> --- a/git-remote-gcrypt
> +++ b/git-remote-gcrypt
> @@ -748,6 +750,11 @@ do_push()
>
>  	while IFS=: read -r src_ dst_ # << +src:dst
>  	do
> +		if [ "+" = "${src_:0:1}" ]
> +		then
> +			Force_passed=true
> +		fi
> +
>  		src_=${src_#+}
>  		filter_to ! @Refslist "$Hex40 $dst_" "$Refslist"

What happens if some of the refspecs have a + but not all of them do?
I think you need to check for a missing +, not the presence of one.

> @@ -761,6 +768,14 @@ do_push()
>  $1
>  EOF
>
> +	if [ "$Conf_force_required" = true ] && [ "$Force_passed" != true ]
> +	then
> +		echo_die "gcrypt.force-required is set to true.  Explicitly force push by passing --force in order to override this error."
> +	elif [ "$Force_passed" != true ]
> +	then
> +		echo_info "An implicit --force push is occuring. Please set 'git config --global add gcrypt.force-required true' to protect from implicit force pushes."
> +	fi
> +
>  	tmp_encrypted="$Tempdir/packP"
>  	tmp_objlist="$Tempdir/objlP"

$Force_passed should be localised to the function -- see the first few
lines of do_push for how this is done.

Rather than checking the value of $Force_passed twice, please nest the
$Conf_force_required check inside a $Force_passed check.

-- 
Sean Whitton



More information about the sgo-software-discuss mailing list