From d38e0d232e65401ae51c7c6f8ddf562fe9321d1c Mon Sep 17 00:00:00 2001 From: Bill Sommerfeld Date: Mon, 12 May 2025 09:31:23 -0700 Subject: [PATCH] Avoid non-POSIX "echo -n" behavior in util/gnc-vcs-info POSIX declined to standardize -n and recommends against using it. Instead, for -r, do a single echo with both the commithash and the modified flag. Tested on illumos, MacOS, and linux. --- util/gnc-vcs-info | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/gnc-vcs-info b/util/gnc-vcs-info index 0e38e784a3..cb9af943c6 100755 --- a/util/gnc-vcs-info +++ b/util/gnc-vcs-info @@ -102,13 +102,13 @@ then rc=$? fi if [ $rc = 0 ]; then - /bin/echo -n $githead # Add a "+" to the hash if there deleted or modified files (not excluded by .gitignore and friends) + modified="" # "Ignores" untracked files - # [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkm 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+" + # [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkm 2>/dev/null | wc -l) -gt 0 ] && modified="+" # Includes untracked files - [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && /bin/echo -n "+" - echo + [ $("$GIT_CMD" --git-dir "${real_gitdir}" ls-files -dkmo --exclude-standard 2>/dev/null | wc -l) -gt 0 ] && modified="+" + echo ${githead}${modified} exit 0 else exit 1