git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Alejandro Mery <amery@geeks.cl>
Date
Jun 17, 2008, 11:43 UTC
Message-ID
<4857A37D.8040004@geeks.cl>

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(-)
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 
Message 1 of 1 in “git-am: head -1 is obsolete and doesn't work on some new systems”
  1. git-am: head -1 is obsolete and doesn't work on some new systemsAlejandro Mery, Jun 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.