Fix pushing of annotated tags to actually include the tag object
commit41a9cd96293a85f11b4da02c45d881625212b32a
authorShawn O. Pearce <spearce@spearce.org>
Wed, 9 Jul 2008 04:15:29 +0000 (9 00:15 -0400)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 9 Jul 2008 22:57:54 +0000 (10 00:57 +0200)
tree1c1285e99677392b8d33e294fd4f80d83cfe0e29
parent164921708417c936949419d20473913ab39e9f00
Fix pushing of annotated tags to actually include the tag object

When we pushed an annotated tag to a remote repository jgit was
failing to include the annotated tag object itself as ObjectWalk
nextObject() failed to pop the object out of the internal pending
queue and return it for inclusion in the generated pack file.

We need to use two different flags for SEEN and IN_PENDING as a blob
or tree object can be SEEN during a TreeWalk, yet may also have been
inserted into the pending object list.  SEEN means we have output
the object to the caller, IN_PENDING means we have placed it into
the pending object list.  Together these prevent duplicates in the
queue and duplicate return values.

Noticed by Robin while trying to push an annotated tag:

  $ git tag -m foo X
  $ git rev-parse X
  49aa0e93621...

  $ jgit push somerepo refs/tags/X
  error: unpack should have generated 49aa0e93621...
  To somerepo.git
   ! [remote rejected] X -> X (bad pack)

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java