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

[PATCH take 2] filter-branch: Avoid an error message in the map function.

From
Johannes Sixt <j.sixt@eudaptics.com>
Date
Jul 4, 2007, 12:08 UTC
Message-ID
<468B8DB1.9A4CF1E6@eudaptics.com>
In-Reply-To
<Pine.LNX.4.64.0707041247520.4071@racer.site>

When the map function didn't find the rewritten commit of the passed in original id, it printed the original id, but it still fell through to the 'cat', which failed with an error message.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 git-filter-branch.sh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 22fb5bf..5fa9b61 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -16,8 +16,12 @@
 map()
 {
 	# if it was not rewritten, take the original
-	test -r "$workdir/../map/$1" || echo "$1"
-	cat "$workdir/../map/$1"
+	if test -r "$workdir/../map/$1"
+	then
+		cat "$workdir/../map/$1"
+	else
+		echo "$1"
+	fi
 }
 
 # When piped a commit, output a script to set the ident of either
-- 
1.5.3.rc0.5.g7cd9
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 6 in “filter-branch: Avoid an error message in the map function.”
  1. filter-branch: Avoid an error message in the map function.Johannes Sixt, Jul 4, 2007
  2. Johannes SchindelinJul 4, 2007
  3. Johannes SixtJul 4, 2007
  4. Johannes SchindelinJul 4, 2007
  5. filter-branch: Avoid an error message in the map function.Johannes Sixt, Jul 4, 2007
  6. Johannes SchindelinJul 4, 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.