forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include git sha in prompt if available
The sha will only be included if there is no tag starting with OTP_R* associated with the sha. This is because we do not want the sha to show on offical releases.
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
|
||
OUTPUT_FILE=$1 | ||
|
||
if command -v git 2>&1 >/dev/null && | ||
test -d $ERL_TOP/.git -o -f $ERL_TOP/.git | ||
then | ||
VSN=`git describe --match "OTP_R[0-9][0-9][A-B]*" HEAD` | ||
case "$VSN" in | ||
OTP_R*-g*) | ||
VSN=`echo $VSN | sed -e 's/.*-g\\(.*\\)/\\1/g'` ;; | ||
*) VSN="na" ;; | ||
esac | ||
else | ||
VSN="na" | ||
fi | ||
|
||
|
||
# Only update the file if there has been a change to | ||
# the version number. | ||
if test -r $OUTPUT_FILE | ||
then | ||
VC=`sed -n -e 's/^.*"\\\\"\\(.*\\)\\\\"".*/\\1/p' < $OUTPUT_FILE` | ||
else | ||
VC=unset | ||
fi | ||
echo "VSN = $VSN" | ||
echo "VC = $VC" | ||
if test "$VSN" != "$VC" | ||
then | ||
echo "# Automatically generated by $0 - DO NOT EDIT." > $OUTPUT_FILE | ||
if test "$VSN" = "na" | ||
then | ||
echo "# GIT_VSN=-DERLANG_GIT_VERSION=\"\\\"$VSN\\\"\"" >> $OUTPUT_FILE | ||
else | ||
echo "GIT_VSN=-DERLANG_GIT_VERSION=\"\\\"$VSN\\\"\"" >> $OUTPUT_FILE | ||
fi | ||
exit 0 | ||
fi | ||
exit 1 |