File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- CURRENT_PROJECT_VERSION = 2617
1+ CURRENT_PROJECT_VERSION = 2619
Original file line number Diff line number Diff line change 11#! /bin/sh
2- buildNumber=` git rev-list --count main`
3- echo " CURRENT_PROJECT_VERSION = $buildNumber " > Planet/versioning.xcconfig
4- echo " Set CURRENT_PROJECT_VERSION to $buildNumber "
5- git add Planet/versioning.xcconfig
2+
3+ set -eu
4+
5+ repo_root=$( git rev-parse --show-toplevel)
6+ git_dir=$( git rev-parse --git-dir)
7+ case " $git_dir " in
8+ /* ) ;;
9+ * ) git_dir=" $repo_root /$git_dir " ;;
10+ esac
11+
12+ actual_index=" $git_dir /index"
13+ current_index=" ${GIT_INDEX_FILE:- $actual_index } "
14+ version_file=" Planet/versioning.xcconfig"
15+ build_number=$(( $(git rev- list -- count HEAD) + 1 ))
16+ version_line=" CURRENT_PROJECT_VERSION = $build_number "
17+
18+ cd " $repo_root "
19+
20+ current_line=" "
21+ if [ -f " $version_file " ]; then
22+ current_line=$( cat " $version_file " )
23+ fi
24+
25+ if [ " $current_line " != " $version_line " ]; then
26+ printf ' %s\n' " $version_line " > " $version_file "
27+ printf ' Set CURRENT_PROJECT_VERSION to %s\n' " $build_number "
28+ git add -- " $version_file "
29+
30+ # Partial commits can run hooks against a temporary index.
31+ if [ " $current_index " != " $actual_index " ]; then
32+ GIT_INDEX_FILE=" $actual_index " git add -- " $version_file "
33+ fi
34+ fi
You can’t perform that action at this time.
0 commit comments