Skip to contentSkip to conversation

push not resolving commit-ish?

DISCUSSION Michael S. Tsirkin 3 participants 12 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next
error: Trying to write non-commit object a8c6d53c4d84b3a5eb182758a9cdceceba4691da to branch refs/heads/vhost-next To /scm/linux
! [remote rejected] v3.10-rc2 -> vhost-next (failed to write)
error: failed to push some refs to '/scm/linux'

linux$ git log v3.10-rc2|head -5
commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75

Author: Linus Torvalds <[email protected]>
Date:   Mon May 20 14:37:38 2013 -0700
    Linux 3.10-rc2

linux$ $ git push -f $PWD c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:refs/heads/vhost-next Everything up-to-date

#1 lore raw
Quoted 15 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next
error: Trying to write non-commit object a8c6d53c4d84b3a5eb182758a9cdceceba4691da to branch refs/heads/vhost-next To /scm/linux
! [remote rejected] v3.10-rc2 -> vhost-next (failed to write)
error: failed to push some refs to '/scm/linux'

linux$ git log v3.10-rc2|head -5
commit c7788792a5e7b0d5d7f96d0766b4cb6112d47d75

Author: Linus Torvalds <[email protected]>
Date:   Mon May 20 14:37:38 2013 -0700
Quoted 8 lines
    Linux 3.10-rc2

linux$ $ git push -f $PWD c7788792a5e7b0d5d7f96d0766b4cb6112d47d75:refs/heads/vhost-next Everything up-to-date

Forgot to say - this is recent git.git master:

1.8.3.rc3.8.g5e49f30

#3 lore raw
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

How else would you push a tag out?

Well my reaction is, it seems to figure out it needs a commit and then instead of just getting it, it errors out. Why not just DWIM?

But at least I see the reason now, thanks.

Signature · 1 line
MST
#4 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

How else would you push a tag out?

Well my reaction is, it seems to figure out it needs a commit and then instead of just getting it, it errors out. Why not just DWIM?

Ahh, that one.

The local branch name hierarchy refs/heads/ is special in that you cannot have a tag sitting at the tip, so when "push" decides to update something under refs/heads/ on the receiving end, it may not be a bad idea to peel it to a commit (and fail if it does not) before creating a pack and telling the other end what the value of the updated tip should be, and I do not think it will hurt anybody.

Restriction in the other direction (i.e. "if push does not go to refs/tags/, unconditionally unwrap") is a no-no, though.

#5 lore raw
Quoted 13 lines · Junio C Hamano
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

How else would you push a tag out?

Well my reaction is, it seems to figure out it needs a commit and then instead of just getting it, it errors out. Why not just DWIM?

Quoted 8 lines

Ahh, that one.

The local branch name hierarchy refs/heads/ is special in that you cannot have a tag sitting at the tip, so when "push" decides to update something under refs/heads/ on the receiving end, it may not be a bad idea to peel it to a commit (and fail if it does not) before creating a pack and telling the other end what the value of the updated tip should be, and I do not think it will hurt anybody.

Yes, that would help my case.

Quoted 3 lines

Restriction in the other direction (i.e. "if push does not go to refs/tags/, unconditionally unwrap") is a no-no, though.

#6 lore raw
In reply to Michael S. Tsirkin
Quoted 4 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next

Perhaps v3.10-rc2^{}. Yeah, totally and completely not-user-friendly, I already complained about it to no avail.

Signature · 1 line
Felipe Contreras
#7 lore raw
Quoted 7 lines · Felipe Contreras
Quoted 4 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next

Perhaps v3.10-rc2^{}. Yeah, totally and completely not-user-friendly,

More commonly "v3.10-rc2^0:vhost-next", if you are truly pushing it out to a remote repository, but then it invites a puzzlement "What do you plan to do next after pushing? The only reason v3.10-rc2 is used is because there is not yet a local branch that will host the vhost-next changes that is built on top of that tag (otherwise you would be pushing that branch to vhost-next)".

But in this particular case, you are force-pushing into the current repository, and it is spelled much more commonly

git branch -f vhost-next v3.10-rc2

I would think.

#8 lore raw
Quoted 17 lines · Junio C Hamano
Quoted 7 lines · Felipe Contreras
Quoted 4 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next

Perhaps v3.10-rc2^{}. Yeah, totally and completely not-user-friendly,

More commonly "v3.10-rc2^0:vhost-next", if you are truly pushing it out to a remote repository, but then it invites a puzzlement "What do you plan to do next after pushing? The only reason v3.10-rc2 is used is because there is not yet a local branch that will host the vhost-next changes that is built on top of that tag (otherwise you would be pushing that branch to vhost-next)".

Quoted 6 lines

But in this particular case, you are force-pushing into the current repository, and it is spelled much more commonly

git branch -f vhost-next v3.10-rc2

I would think.

That was just a bad example though, I really use it for push to remove.

#9 lore raw
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Junio C Hamano
Quoted 7 lines · Felipe Contreras
Quoted 4 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next

Perhaps v3.10-rc2^{}. Yeah, totally and completely not-user-friendly,

More commonly "v3.10-rc2^0:vhost-next", if you are truly pushing it out to a remote repository, but then it invites a puzzlement "What do you plan to do next after pushing? The only reason v3.10-rc2 is used is because there is not yet a local branch that will host the vhost-next changes that is built on top of that tag (otherwise you would be pushing that branch to vhost-next)".

But in this particular case, you are force-pushing into the current repository, and it is spelled much more commonly

Quoted 6 lines
Quoted 3 lines

git branch -f vhost-next v3.10-rc2

I would think.

That was just a bad example though, I really use it for push to remove.

Then it invites a puzzlement as you can see above.

#10 lore raw
In reply to Junio C Hamano
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Felipe Contreras
Quoted 4 lines · Michael S. Tsirkin

Looks like push can't resolve tags to commits.
Why is that?

linux$ git push -f $PWD v3.10-rc2:refs/heads/vhost-next

Quoted 8 lines
Quoted 1 line

Perhaps v3.10-rc2^{}. Yeah, totally and completely not-user-friendly,

More commonly "v3.10-rc2^0:vhost-next", if you are truly pushing it out to a remote repository, but then it invites a puzzlement "What do you plan to do next after pushing? The only reason v3.10-rc2 is used is because there is not yet a local branch that will host the vhost-next changes that is built on top of that tag (otherwise you would be pushing that branch to vhost-next)".

This was just a bad example.
The real reason is this:

I have a development branch, vhost-next. I have a tag there like for_linus for things that are ready to go out. I don't always point it at the tip of the branch since I might want to rebase/amend X last commits.

It's a tag and not a branch since I need to sign the tag. I push to a branch and not just the tag since this way people can track it and do downstream development on top. So pushing the tag to branch would save me some churn.

Quoted 6 lines

But in this particular case, you are force-pushing into the current repository, and it is spelled much more commonly

git branch -f vhost-next v3.10-rc2

I would think.

#11 lore raw
Quoted 4 lines · Michael S. Tsirkin

It's a tag and not a branch since I need to sign the tag. I push to a branch and not just the tag since this way people can track it and do downstream development on top. So pushing the tag to branch would save me some churn.

It seems our messages crossed.

Everything you said before the last sentence makes sense to me, and if the last sentence were "pushing the commit that is tagged to branch", it also makes sense to me.