Skip to content

Commit

Permalink
fix(install): improve git_clean function
Browse files Browse the repository at this point in the history
The commit refactors the git_clean function and adds a better documentation to explain its behavior. The fetch command is updated to pull tags with the remote branch. Also, the reset command is set to the latest tag fetched, ensuring that the function is always using the latest tag available. Finally, a command to remove all untracked files and directories was added to keep the repository clean.
  • Loading branch information
entelecheia committed May 9, 2023
1 parent 4b58e9e commit 6a98516
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
paths:
- "README.md"
- "mkdocs.yaml"
- "docs/**.md"
- "docs/images/**"
- "docs/**/*"
- ".github/workflows/deploy-docs.yaml"

permissions:
Expand Down
11 changes: 8 additions & 3 deletions docs/install
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ git_clean() {
log_task "Cleaning '${path}' with '${remote}' at branch '${branch}'"
git="git -C ${path}"
${git} checkout -B "${branch}"
${git} fetch "${remote}" "${branch}"
latest_tag=$(${git} describe --tags "$(${git} rev-list --tags --max-count=1)") # get latest tag
${git} reset --hard "${latest_tag}" # use latest tag instead of FETCH_HEAD
${git} fetch "${remote}" "${branch}" --tags
# get latest tag
latest_tag=$(${git} describe --tags "$(${git} rev-list --tags --max-count=1)")
# ensure to pull the latest tag
${git} fetch "${remote}" "${latest_tag}"
# reset to latest tag
${git} reset --hard "${latest_tag}"
# remove all untracked files and directories
${git} clean -fdx
unset path remote branch git
}
Expand Down

0 comments on commit 6a98516

Please sign in to comment.