Skip to content

Signed tags incorrectly checked out #649

Open
@danielrbradley

Description

@danielrbradley

When pushing a signed tag (or possibly any other tag object), the checked out tag ref points directly to the commit hash rather than the tag object.

Impact: unable to perform additional git commands as tree is out of sync.

Example workflow with issue

  1. Create and push signed tag. Creates something like:

    $ cat .git/refs/tags/v1.0.0
    6d516f7003b7db4f2a6e3a15332f23afa3e4e7f9
    $ git cat-file -t 6d516f7003b7db4f2a6e3a15332f23afa3e4e7f9
    tag
    $ git cat-file -p 6d516f7003b7db4f2a6e3a15332f23afa3e4e7f9
    object 3f7352e5bd0ac4ad07bb64964d96b411a29d769b:refs
    type commit
    tag v1.0.0
    tagger Author Name <author@company.example> 1638969265 +0000
  2. Use checkout action during workflow running based on the tag push trigger:

    "on":
      push:
        tags:
          - v*.*.*
    ...
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v2
  3. Source is fetched using a command such as:

    /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +3f7352e5bd0ac4ad07bb64964d96b411a29d769b:refs/tags/v1.0.0
  4. The tag is now out of sync with the remote. If a command tries to sync the tag it will fail e.g.

    $ git fetch --prune --unshallow --tags
    ! [rejected]        v1.0.0     -> v1.0.0  (would clobber existing tag)
    $ cat .git/refs/tags/v1.0.0
    3f7352e5bd0ac4ad07bb64964d96b411a29d769b

Note: this might in fact affect any tag which creates a tag object rather than a direct referent to the commit object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions