Thread (1 message) 1 message, 1 author, 2021-10-21

Re: [PATCH 7/8] Makefile: stop having command-list.h depend on a wildcard

From: Junio C Hamano <hidden>
Date: 2021-10-21 18:24:37

Jeff King [off-list ref] writes:
On Wed, Oct 20, 2021 at 08:39:58PM +0200, Ævar Arnfjörð Bjarmason wrote:
quoted
 get_synopsis () {
+	head -n 10 "Documentation/$1.txt" |
 	sed -n '
 		/^NAME/,/'"$1"'/H
 		${
 			x
 			s/.*'"$1"' - \(.*\)/N_("\1")/
 			p
-		}' "Documentation/$1.txt"
+		}'
 }
By the way, I'm not sure about the utility of this change. It reduces
the number of lines that sed looks at, but at the cost of an extra
process. That's probably a net loss. And if we did want to limit the
data sed covers, doing "pq" after we matched would be simpler.
Doesn't the above

 - slurp the lines into hold space while we are in the synopsis
   part;
 - otherwise keep reading and discarding;
 - and do the processing at end

So presumably, instead of waiting till the end, can't we immediately
process the thing and exit?

I guess your "'pq' after we matched" is saying the same thing.  I
agree that extra process with an ad-hoc limitation of 10 does leave
a bad taste in my mouth.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help