Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Olf0 opened this issue Mar 15, 2023 · 0 comments

Comments

@Olf0
Copy link

Olf0 commented Mar 15, 2023

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.
@Olf0 Olf0 changed the title tar_git misses to filter for the branch provided by the branch parameter and uses a wrong branch name to construct a version string tar_git misses to filter for the branch provided by the branch parameter and uses a wrong branch name to construct a version string Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant