Skip to content

tar_git misses to filter for the branch provided by the branch parameter and uses a wrong branch name to construct a version string #5

@Olf0

Description

@Olf0

The tar_git script does not obey the branch parameter, if there is no valid tag (according to tar_git's processing rules) or if a commit ID (short-hash) was provided, or if a branch parameter is set and either no revision is set or in this Git branch commits exist newer than the tag referenced by the revision parameter: Then tar_git looks for the "closest" tag in the function set_versha which fulfils its tag processing rules, but misses to filter for the branch provided by the branch parameter (i.e., it searches in all branches).

Still, it uses the value of the branch parameter, or if none is provided, the branch name in which the "closest" tag was found to construct a new version string, which comprises: The processed name of the "closest" tag, a +, the branch name, a ., a date-time string (YYYYMMDDhhmmss), the number of commits since the "closest" tag in the branch it resides enclosed in dots .<n>., a g if newer commits exist in the branch referenced by branch than the tag referenced by revision, and the short-hash of the latest commit, resulting in, e.g., 0.5.2+main.20230129011931.6.g584263a with 0.5.2-3 as "closest" tag found. Note that if the "closest" tag determined does not originate from the branch provided by the branch parameter, still this parameter is inserted in the constructed string, despite using a Git checkout from another branch.


Hence this issue actually describes two different, but related bugs:

  1. The tar_git script does not obey the branch parameter, if there is no valid tag (according to tar_git's processing rules) or if a commit ID (short-hash) was provided, or if a branch parameter is set and either no revision is set or in this Git branch commits exist newer than the tag referenced by the revision parameter.
  2. If the tar_git script decides to check out a different branch than the one provided by the branch parameter, it still inserts the provided branch name into the constructed version name, instead of the name of the branch actually used. It does already do the right thing, if no branch parameter is provided: Using the branch name from which the source code is checked out.

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