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

[PATCH] git-filter-branch.sh: more portable tr usage: use \012, not \n.

From
Jim Meyering <jim@meyering.net>
Date
Dec 18, 2007, 10:03 UTC
Message-ID
<87y7bs2uc4.fsf@rho.meyering.net>

I hesitate to suggest this, since GNU tr has accepted \n for 15 years, but there are supposedly a few crufty vendor-supplied versions of tr still in use. Also, all of the other uses of tr-with-newline in git use \012.

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 git-filter-branch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 3bb2f67..ee9e1b3 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -290,7 +290,7 @@ while read commit parents; do
 		eval "$filter_tree" < /dev/null ||
 			die "tree filter failed: $filter_tree"

-		git diff-index -r $commit | cut -f 2- | tr '\n' '\000' | \
+		git diff-index -r $commit | cut -f 2- | tr '\012' '\000' | \
 			xargs -0 git update-index --add --replace --remove
 		git ls-files -z --others | \
 			xargs -0 git update-index --add --replace --remove
--
1.5.4.rc0.53.gdfcd
Message 1 of 1 in “git-filter-branch.sh: more portable tr usage: use \012, not \n.”
  1. git-filter-branch.sh: more portable tr usage: use \012, not \n.Jim Meyering, Dec 18, 2007

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.