Thread (8 messages) flat view 8 messages, 2 authors, 2016-06-15

Re: [PATCH 4/4] streaming filter: ident filter and filter cascading

From: René Scharfe <hidden>
Date: 2016-06-15 22:51:17
Subsystem: the rest · Maintainer: Linus Torvalds

Am 21.05.2011 23:05, schrieb René Scharfe:
Am 21.05.2011 08:58, schrieb Junio C Hamano:
quoted
Add support for "ident" filter on the output codepath. Because we now have
more than one filter active, also add support to cascade them together.

Signed-off-by: Junio C Hamano <redacted>
---

 * There is one known issue in this "ident" filter implementation. If the
   input data ends while the filter is still in the "SKIPPING" state, it
   should go to the "DRAINING" codepath using the same logic that triggers
   when it gets to the end of line, copying out what was already queued.
   However, the API does not offer an explicit way for the input side to
   say "that's all". We probably need to make a zero-byte input to the
   filter function as an explicit EOF signal or something---currently I
   think it will loop forever, but it is getting late, so I will not be
   further touching this code tonight.
AFAIU it will leave skipping mode once there is no input data anymore
instead of looping forever.  The accumulated stuff will be discarded.

The test suite is passed, by the way, even though t0021 seems to contain
a test for this issue (NoTerminatingSymbolAtEOF).  It uses echo to
create the files so there will be a terminating newline before the end
of the file, though, so this subtest probably needs to be changed.
-- >8 --
Subject: t0021-conversion.sh: fix NoTerminatingSymbolAtEOF test

The last line of the test file "expanded-keywords" ended in a newline,
which is a valid terminator for ident.  Use printf instead of echo to omit
it and thus really test if a file that ends unexpectedly in the middle of
an ident tag is handled properly.

Also take the oppertunity to calculate the expected ID dynamically
instead of hardcoding it into the test script.  This should make future
changes easier.

Signed-off-by: Rene Scharfe <redacted>
---
 t/t0021-conversion.sh |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 9078b84..275421e 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -66,25 +66,26 @@ test_expect_success expanded_in_repo '
 		echo "\$Id:NoSpaceAtEitherEnd\$"
 		echo "\$Id: NoTerminatingSymbol"
 		echo "\$Id: Foreign Commit With Spaces \$"
-		echo "\$Id: NoTerminatingSymbolAtEOF"
+		printf "\$Id: NoTerminatingSymbolAtEOF"
 	} > expanded-keywords &&
 
+	git add expanded-keywords &&
+	git commit -m "File with keywords expanded" &&
+	id=$(git rev-parse --verify :expanded-keywords) &&
+
 	{
 		echo "File with expanded keywords"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-		echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
+		echo "\$Id: $id \$"
+		echo "\$Id: $id \$"
+		echo "\$Id: $id \$"
+		echo "\$Id: $id \$"
+		echo "\$Id: $id \$"
+		echo "\$Id: $id \$"
 		echo "\$Id: NoTerminatingSymbol"
 		echo "\$Id: Foreign Commit With Spaces \$"
-		echo "\$Id: NoTerminatingSymbolAtEOF"
+		printf "\$Id: NoTerminatingSymbolAtEOF"
 	} > expected-output &&
 
-	git add expanded-keywords &&
-	git commit -m "File with keywords expanded" &&
-
 	echo "expanded-keywords ident" >> .gitattributes &&
 
 	rm -f expanded-keywords &&
-- 
1.7.5.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help