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

Re: [PATCH] t6022: Use -eq not = to test output of wc -l

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:03

Junio C Hamano wrote:
Jonathan Nieder [off-list ref] writes:
quoted
+	if test "$3" = -
+	then
+		line_count_tmp=test_line_count.output
+		cat >"$line_count_tmp"
+		set -- "$1" "$2" "$line_count_tmp"
+	fi
+	if ! test $(wc -l <"$3") "$1" "$2"
 	then
 		echo "test_line_count: line count for $3 !$1 $2"
 		cat "$3"
 		return 1
You forgot to clean the temporary file here.
The idea was to leave it around to help in diagnosis.  But you are
right, it is more useful to not break later tests:

		rm -f "$line_count_tmp"
		return 1
Also if the file is huge, do we really want to cat the whole thing?
I think so.  (Maybe not if it is binary, though.)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help