Skip to content

Commit

Permalink
Build details for deattached mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorkert committed Aug 5, 2024
1 parent 46408f9 commit 5f6a091
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Scripts/capture-build-details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ else
plutil -replace com-LoopFollow-build-date -string "$formatted_date" "${info_plist_path}"

# Retrieve the current branch
git_branch=$(git symbolic-ref --short -q HEAD)
git_branch=$(git symbolic-ref --short -q HEAD 2>/dev/null || echo "")

# Attempt to retrieve the current tag
git_tag=$(git describe --tags --exact-match 2>/dev/null || echo "")

# Retrieve the current SHA of the latest commit
git_commit_sha=$(git log -1 --format="%h" --abbrev=7)

# Determine the branch or tag information
git_branch_or_tag="${git_branch:-${git_tag}}"
git_commit_sha=$(git log -1 --format="%h" --abbrev=7 2>/dev/null || echo "")

# Determine the branch or tag information, defaulting to "detached" if neither is available
if [ -z "$git_branch" ] && [ -z "$git_tag" ]; then
git_branch_or_tag="detached"
else
git_branch_or_tag="${git_branch:-${git_tag}}"
fi

# Update BuildDetails.plist with the branch or tag information
plutil -replace com-LoopFollow-branch -string "${git_branch_or_tag}" "${info_plist_path}"
Expand Down

0 comments on commit 5f6a091

Please sign in to comment.