Re: [PATCH] http-push: Fix error message for push <remote> :<branch>

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

 



Hi,

On Mon, 18 Feb 2008, Clemens Buchacher wrote:

> git http-push <remote> :<branch> currently fails with the error message 
> "cannot happen anymore". Print a more useful error message instead.
> 
> Signed-off-by: Clemens Buchacher <drizzd@xxxxxx>
> ---
> 
> We should actually support this feature, of course. Unfortunately, a lot 
> has changed since the version of send-pack which http-push is based on 
> (v1.2.4-398-gaa1dbc9). I think http-push should be updated to reflect 
> these changes at a larger scope. Is there any work going on in this 
> direction?

Nope.  You are the ideal candidate to start, though.

> diff --git a/http-push.c b/http-push.c
> index f9b77d6..8de091f 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -2311,6 +2311,15 @@ int main(int argc, char **argv)
>  
>  		if (!ref->peer_ref)
>  			continue;
> +
> +		if (is_zero_sha1(ref->peer_ref->new_sha1)) {
> +			error("Deleting remote branches via :<branch> is not "
> +				"currently supported by http-push. Use git "
> +				"http-push -d <remote-url> <branch> instead.");
> +			rc = -2;
> +			continue;
> +		}
> +

You forgot to remove the now-obsolete warning...

Besides, why don't you just try to imitate the code for "-d"?  It says

        if (delete_branch) {
                if (delete_remote_branch(refspec[0], force_delete) == -1)
                        fprintf(stderr, "Unable to delete remote branch %s\n",
                                refspec[0]);
                goto cleanup;
        }

So I think something like this should work, at the same place you added 
your code:

		if (is_zero_sha1(ref->peer_ref->new_sha1)) {
			if (delete_remote_branch(ref->peer_ref->name,
					force_delete || ref->force) == -1) {
				error("Could not remove %s",
					ref->peer_ref->name);
				rc = -4;
			}
			continue;
		}

Care to try that?

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