threads / discuss / 28832

error from 'git push' on v1.7.8-rc0

Subject: error from 'git push' on v1.7.8-rc0

## tl;dr

5 messages between Nov 3, 2011 and Nov 3, 2011.

replies: 4people: 2as markdown or json

Stefan Näwe· Nov 3, 2011, 11:43 UTC · lore
I get errors from git push when trying to delete a (remote) branch:

$ ./bin-wrappers/git versiongit version 1.7.8.rc0 $ ./bin-wrappers/git push -q . :refs/heads/nogofatal: bad object 0000000000000000000000000000000000000000fatal: bad object 0000000000000000000000000000000000000000remote: warning: Allowing deletion of corrupt ref. I bisected this to: 52fed6e receive-pack: check connectivity before concluding "git push"

$ git describe 52fed6e~1 v1.7.5.3-492-gf96400c

$ ./bin-wrappers/git version git version 1.7.5.3.492.gf9640

$ ./bin-wrappers/git push -q . :refs/heads/nogo remote: warning: Allowing deletion of corrupt ref.

It makes no difference if the branch to be deleted exists, or not.
Regards,
  Stefan
-- 
----------------------------------------------------------------
python -c "print '73746566616e2e6e6165776540676d61696c2e636f6d'.decode('hex')"
Stefan Näwe· Nov 3, 2011, 11:49 UTC · re: Stefan Näwe · lore

Re: error from 'git push' on v1.7.8-rc0

On Thu, Nov 3, 2011 at 12:43 PM, Stefan Näwe <stefan.naewe@gmail.com> wrote:
> I get errors from git push when trying to delete a (remote) branch:
>
> $ ./bin-wrappers/git versiongit version 1.7.8.rc0
> $ ./bin-wrappers/git push -q . :refs/heads/nogofatal: bad object
$ ./bin-wrappers/git push -q . :refs/heads/nogo
(re-wrapped)

$ ./bin-wrappers/git push -q . :refs/heads/nogo fatal: bad object 0000000000000000000000000000000000000000 fatal: bad object 0000000000000000000000000000000000000000 remote: warning: Allowing deletion of corrupt ref.

Stefan
-- 
----------------------------------------------------------------
python -c "print '73746566616e2e6e6165776540676d61696c2e636f6d'.decode('hex')"
Stefan Naewe· Nov 3, 2011, 17:26 UTC · re: Stefan Näwe · lore

Re: error from 'git push' on v1.7.8-rc0

Stefan Näwe <stefan.naewe <at> gmail.com> writes:
> 
> On Thu, Nov 3, 2011 at 12:43 PM, Stefan Näwe <stefan.naewe <at> gmail.com> 
wrote:
Show 12 quoted lines
> > I get errors from git push when trying to delete a (remote) branch:
> >
> > $ ./bin-wrappers/git versiongit version 1.7.8.rc0
> > $ ./bin-wrappers/git push -q . :refs/heads/nogofatal: bad object
> $ ./bin-wrappers/git push -q . :refs/heads/nogo
> 
> (re-wrapped)
> 
> $ ./bin-wrappers/git push -q . :refs/heads/nogo
> fatal: bad object 0000000000000000000000000000000000000000
> fatal: bad object 0000000000000000000000000000000000000000
> remote: warning: Allowing deletion of corrupt ref.
I think the problem lies actually in 'rev-list':
$ git rev-list --verify-objects 0000000000000000000000000000000000000000 \
   --not --all
fatal: bad object 0000000000000000000000000000000000000000
Regards,
  Stefan
Junio C Hamano· Nov 3, 2011, 18:59 UTC · re: Stefan Näwe · lore

Re: error from 'git push' on v1.7.8-rc0

Stefan Näwe <stefan.naewe@gmail.com> writes:
Show 7 quoted lines
> I get errors from git push when trying to delete a (remote) branch:
>
> $ ./bin-wrappers/git versiongit version 1.7.8.rc0
> $ ./bin-wrappers/git push -q . :refs/heads/nogofatal: bad object
> 0000000000000000000000000000000000000000fatal: bad object
> 0000000000000000000000000000000000000000remote: warning: Allowing
> deletion of corrupt ref.

Thanks. I think the operation does _not_ error out and fail to delete, but I agree that the "fatal:" message should be squelched.

Junio C Hamano· Nov 3, 2011, 19:15 UTC · re: Junio C Hamano · lore

Re: error from 'git push' on v1.7.8-rc0

Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Stefan Näwe <stefan.naewe@gmail.com> writes:
>
>> I get errors from git push when trying to delete a (remote) branch:
>>
>> $ ./bin-wrappers/git versiongit version 1.7.8.rc0
>> $ ./bin-wrappers/git push -q . :refs/heads/nogofatal: bad object
>> 0000000000000000000000000000000000000000fatal: bad object
>> 0000000000000000000000000000000000000000remote: warning: Allowing
>> deletion of corrupt ref.
>
> Thanks. I think the operation does _not_ error out and fail to delete, but
> I agree that the "fatal:" message should be squelched.
-- >8 --
Subject: receive-pack: do not expect object 0{40} to exist

When pushing to delete a ref, it uses 0{40} as an object name to signal that the request is a deletion. We shouldn't trigger "deletion of a corrupt ref" warning in such a case, which was designed to notice that a ref points at an object that is truly missing from the repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/receive-pack.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 261b610..7ec68a1 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -634,7 +634,7 @@ static int command_singleton_iterator(void *cb_data, unsigned char sha1[20])
 	struct command **cmd_list = cb_data;
 	struct command *cmd = *cmd_list;
 
-	if (!cmd)
+	if (!cmd || is_null_sha1(cmd->new_sha1))
 		return -1; /* end of list */
 	*cmd_list = NULL; /* this returns only one */
 	hashcpy(sha1, cmd->new_sha1);
@@ -659,11 +659,16 @@ static int iterate_receive_command_list(void *cb_data, unsigned char sha1[20])
 	struct command **cmd_list = cb_data;
 	struct command *cmd = *cmd_list;
 
-	if (!cmd)
-		return -1; /* end of list */
-	*cmd_list = cmd->next;
-	hashcpy(sha1, cmd->new_sha1);
-	return 0;
+	while (cmd) {
+		if (!is_null_sha1(cmd->new_sha1)) {
+			hashcpy(sha1, cmd->new_sha1);
+			*cmd_list = cmd->next;
+			return 0;
+		}
+		cmd = cmd->next;
+	}
+	*cmd_list = NULL;
+	return -1; /* end of list */
 }
 
 static void execute_commands(struct command *commands, const char *unpacker_error)

← back to recent threads