Skip to content

Captain push -Bc fails when on a tag #85

@jwliechty

Description

@jwliechty

If on a tag of a git repository (for instance v3.0 and doing a captain push -Bc, there is an error where captain tries to create a docker tag with the name (HEAD detached at v3.0). This is because the getBranches function uses the following command to get all the branch names.

git branch --no-column --contains HEAD

Which gives the output (on my system)

* (HEAD detached at v3.0)
  b-four
  b-one
  b-three
  b-two
  master

The other interesting thing is that it uses the --contains flag. Instead, I think this should be the --points-at. If pushing up docker contains for tagged with branches, wouldn't you want to do so only for those branches whose HEAD is the same as what you currently have checked out? As it stands, the --contains will grab any branch that has the HEAD commit. This means that if on master and pushing with -B, master and develop will get tagged and pushed up even if develop is ahead of master in commits.

I have a pull request which addresses both of these concerns with tests!

Please review and accept!

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