aboutsummaryrefslogtreecommitdiff
path: root/gitstatus
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-06-11 10:23:28 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2021-06-11 10:23:28 +0300
commit2e0989c0184925177ecdd43bbe5523eeb0764cd2 (patch)
tree3ddc6085044bf19610f0149f3107de1129df7dc6 /gitstatus
parentf5d61840ae3a4f8c2765e1a67d94d9a96de71601 (diff)
parent038de6f78b21171615d0b4628471e71efe10d77e (diff)
Merge commit '038de6f78b21171615d0b4628471e71efe10d77e'
Diffstat (limited to 'gitstatus')
-rwxr-xr-xgitstatus/build29
1 files changed, 23 insertions, 6 deletions
diff --git a/gitstatus/build b/gitstatus/build
index 667def9f..f77f1982 100755
--- a/gitstatus/build
+++ b/gitstatus/build
@@ -316,16 +316,33 @@ app="$outdir"/usrbin/"$appname"
command strip "$app".tmp
command mkdir -- "$workdir"/repo
-command git -C "$workdir"/repo init
-command git -C "$workdir"/repo config user.name "Your Name"
-command git -C "$workdir"/repo config user.email "you@example.com"
-command git -C "$workdir"/repo commit --allow-empty --allow-empty-message --no-gpg-sign -m ''
+printf '[init]\n defaultBranch = master\n' >"$workdir"/.gitconfig
+(
+ cd -- "$workdir"/repo
+ GIT_CONFIG_NOSYSTEM=1 HOME="$workdir" command git init
+ GIT_CONFIG_NOSYSTEM=1 HOME="$workdir" command git config user.name "Your Name"
+ GIT_CONFIG_NOSYSTEM=1 HOME="$workdir" command git config user.email "you@example.com"
+ GIT_CONFIG_NOSYSTEM=1 HOME="$workdir" command git commit \
+ --allow-empty --allow-empty-message --no-gpg-sign -m ''
+)
resp="$(printf "hello\037$workdir/repo\036" | "$app".tmp)"
-[ -n "$resp" -a -z "${resp##hello*1*$workdir/repo*master*}" ]
+case "$resp" in
+ hello*1*/repo*master*);;
+ *)
+ >&2 echo 'error: invalid gitstatusd response for a git repo'
+ exit 1
+ ;;
+esac
resp="$(printf 'hello\037\036' | "$app".tmp)"
-[ -n "$resp" -a -z "${resp##hello*0*}" ]
+case "$resp" in
+ hello*0*);;
+ *)
+ >&2 echo 'error: invalid gitstatusd response for a non-repo'
+ exit 1
+ ;;
+esac
command mv -f -- "$app".tmp "$app"