git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filter-branch: Avoid an error message in the map function.
@ 2007-07-04  7:54 Johannes Sixt
  2007-07-04 11:08 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2007-07-04  7:54 UTC (permalink / raw)
  To: gitster; +Cc: git, Johannes Schindelin, j.sixt, Johannes Sixt

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>
---
Is the sequence of && and || ok, or do you prefer if-then-else-fi?

-- Hannes

 git-filter-branch.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 22fb5bf..ff1cbcf 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -16,8 +16,9 @@ USAGE="git-filter-branch [-d TEMPDIR] [FILTERS] DESTBRANCH [REV-RANGE]"
 map()
 {
 	# if it was not rewritten, take the original
-	test -r "$workdir/../map/$1" || echo "$1"
-	cat "$workdir/../map/$1"
+	test -r "$workdir/../map/$1" &&
+	cat "$workdir/../map/$1" ||
+	echo "$1"
 }
 
 # When piped a commit, output a script to set the ident of either
-- 
1.5.3.rc0.5.g7cd9

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-04 12:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-04  7:54 [PATCH] filter-branch: Avoid an error message in the map function Johannes Sixt
2007-07-04 11:08 ` Johannes Schindelin
2007-07-04 11:45   ` Johannes Sixt
2007-07-04 11:49     ` Johannes Schindelin
2007-07-04 12:08       ` [PATCH take 2] " Johannes Sixt
2007-07-04 12:51         ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).