threads / patch / 14000

patchgit-am: head -1 is obsolete and doesn't work on some new systems

Subject: [PATCH] git-am: head -1 is obsolete and doesn't work on some new systems

## tl;dr

One message between Jun 17, 2008 and Jun 17, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Alejandro Mery· Jun 17, 2008, 11:43 UTC · lore

head -<n> was deprecated by POSIX, and as modern versions of coreutils package don't support it at least one exports _POSIX2_VERSION=199209 it's fails on some systems.

head -n<n> is portable, but sed <n>q is even more.
Signed-off-by: Alejandro Mery <amery@geeks.cl>
---
 git-am.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-am.sh +1 −2
diff --git a/git-am.sh b/git-am.sh
index b48096e..2c517ed 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -421,7 +421,7 @@ do
 	else
 	    action=yes
 	fi
-	FIRSTLINE=$(head -1 "$dotest/final-commit")
+	FIRSTLINE=$(sed 1q "$dotest/final-commit")
 
 	if test $action = skip
 	then
--
1.5.4.3 

← back to recent threads