Skip to content
This repository has been archived by the owner. It is now read-only.

fix: printHash.sh; replace echo -n, check if $1 is set. #1188

Merged
merged 1 commit into from Jul 5, 2021
Merged
Changes from all commits
Commits
File filter
Filter file types
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.

Always

Just for now

fix: printHash.sh; replace echo -n, check if $1 is set.
  • Loading branch information
mssx86 committed Jul 1, 2021
commit de64bbe875fb0ff1dd8bdd0b2a33e713b344a98f
@@ -1,12 +1,14 @@
#!/usr/bin/env bash

> $1

echo -n "#define GIT_SHA1 \"" > $1

if (command -v "git" >/dev/null) then
git rev-parse --short HEAD | tr -d '\n' >> $1
#!/usr/bin/env sh
if [ -z "${1}" ]
then
printf "%s\n" "Input the path to the file for writing the commit hash to."
else
printf "%s" "#define GIT_SHA1 \"" > $1

if (command -v "git" >/dev/null) then
git rev-parse --short HEAD | tr -d '\n' >> $1
fi

printf "%s\n" "\"" >> $1
printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
fi

echo "\"" >> $1
echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1