Issue 3329: Pushing tag objects to refs/heads/* is legal if the tag points to a commit in the remote branch's history
Status:  New
Owner: ----
Reported by agwhee...@gmail.com, Apr 23, 2015
 Bug 575  blocks tag objects from getting pushed to refs/heads in most cases.  But you can still push a tag object to refs/heads if the remote branch already exists, and the tag points to a commit that is in the history of the remote branch.

Affected Version: 2.8.4

What steps will reproduce the problem?

  $ git push origin HEAD:refs/heads/delme
  $ git tag -m'hi' delme HEAD

The below command should fail/block the tag object 
from getting pushed to refs/heads/: 

  $ git push origin delme:refs/heads/delme


You can verify that origin/delme is a tag object:

  $ git show origin/delme
  tag delme
  Tagger: Andrew Wheeler <awheeler@motorola.com>
  Date:   Thu Apr 23 15:26:46 2015 -0500

  hi


What is the expected output? What do you see instead?

I expect the final push command to fail with "not a commit", just as it would if refs/heads/delme does not already exist.


Please provide any additional information below.

It seems that parseRewind() in ReceiveCommits.java isn't validating that the pushed object is a commit.