Add a new --current-branch argument that lets the user supply a name for
the current branch. This allows the automatic tag generation to avoid
calling git - something useful if the tree is not using a git checkout
(like a tarball). It also allows you to pull a temporary branch in git
but ignore it and act like the temporary branch is the base branch.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
def target_tag(self):
if self.cli.tag:
return self.cli.tag
- try:
- branch = _git_current_branch(self).replace("/", "-")
- except subprocess.CalledProcessError:
- branch = "UNKNOWN"
+ branch = self.cli.current_branch
+ if not branch:
+ try:
+ branch = _git_current_branch(self).replace("/", "-")
+ except subprocess.CalledProcessError:
+ branch = "UNKNOWN"
return f"{branch}.{self.cli.distro}"
@property
"-t",
help="Specify a container tag",
)
+ parser.add_argument(
+ "--current-branch",
+ help="Manually specify the current branch name",
+ )
parser.add_argument(
"--image-repo",
help="Specify a container image repository",