Thread (8 messages) flat view 8 messages, 6 authors, 2016-06-15
DORMANTno replies

[PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

Hello,

* Junio C Hamano [off-list ref] [050507 10:54]:
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?
Exactly:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree

This is it:
	/home/cip/adm/sithglan/work/git/bin/git-SunOS/bin/git-merge-one-file-script: syntax error at line 55: `orig=$' unexpected
	fatal: merge program failed
	git-merge-cache failed: child exit value: 1 at /home/cip/adm/sithglan/work/git/yagf/git line 1015.

The attached patch at the end of this eMail fixes it for me *without*
touching /bin/sh in the bang:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree
	Threewaydiff invloved.

[PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

Signed-Off-by: Thomas Glanzmann <redacted>
--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -52,9 +52,9 @@
 #
 "$1$2$3")
 	echo "Auto-merging $4."
-	orig=$(git-unpack-file $1)
-	src1=$(git-unpack-file $2)
-	src2=$(git-unpack-file $3)
+	orig=`git-unpack-file $1`
+	src1=`git-unpack-file $2`
+	src2=`git-unpack-file $3`
 	merge "$src2" "$orig" "$src1"
 	ret=$?
 	if [ "$6" != "$7" ]; then
@@ -64,7 +64,7 @@
 		echo "ERROR: Leaving conflict merge in $src2."
 		exit 1
 	fi
-	sha1=$(git-write-blob "$src2") || {
+	sha1=`git-write-blob "$src2"` || {
 		echo "ERROR: Leaving conflict merge in $src2."
 	}
 	exec git-update-cache --add --cacheinfo "$6" $sha1 "$4" ;;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help