Re: [PATCH] http-push: Fix error message for push <remote> :<branch>
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 18, 2008, 13:45 UTC
- Message-ID
- <alpine.LSU.1.00.0802181339470.30505@racer.site>
- In-Reply-To
- <20080218130726.GA26854@localhost>
Hi,
On Mon, 18 Feb 2008, Clemens Buchacher wrote:
Show 11 quoted lines
> 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@aon.at> > --- > > 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.
Show 17 quoted lines
> 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