Skip to content

Commit

Permalink
Rename to get_head_version()
Browse files Browse the repository at this point in the history
It's not specific to submodules
  • Loading branch information
iamsergio committed Jan 20, 2025
1 parent 881b9e4 commit 1e448f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gh_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,16 @@ def ci_run_status(proj_name, sha1):
return in_progress, completed, failed


def get_submodule_dependency_version(repo_path):
def get_head_version(repo_path, sha1='HEAD'):
'''
Runs git-describe on a sub-module, for example:
Returns the tagged version of a repo located at repo_path.
Runs git-describe on a git repo, for example:
git -C ../KDStateMachineEditor/3rdparty/graphviz describe --tags HEAD
which returns: 11.0.0-546-gb4650ee85
This won't update/init submodules, be sure to not run on an old checkout.
'''
return run_command_with_output(f"git -C {repo_path} describe --abbrev=0 --tags HEAD").strip()
return run_command_with_output(f"git -C {repo_path} describe --abbrev=0 --tags {sha1}").strip()


def checkout_randomly_named_branch(repo_path, prefix):
Expand Down Expand Up @@ -327,7 +329,7 @@ def get_submodule_versions(master_repo_path, proj_name, submodule_name=None):
submodule_main_branch = dep.get('main_branch', 'main')
latest_version = get_latest_release_tag_in_github(
None, repo_path, submodule_main_branch, True)
current_version = get_submodule_dependency_version(repo_path)
current_version = get_head_version(repo_path)

result.append({
'submodule_name': key, # the key in releasing.yml
Expand Down

0 comments on commit 1e448f4

Please sign in to comment.