From e94d5145d1aa910a9b83448539998cf3bb7c04c4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 20 Jun 2017 23:25:05 -0700 Subject: [PATCH] topgit_msg.awk: mostly avoid outputting blank lines When in only1 or multimatch mode do not output blank lines. In regular mode a blank line will still be output but only when the kind, branch name and empty subject explanations have all been disabled. These blank lines are maintained in case the output lines need to match up one-to-one with the input branch lines. In only1 and multimatch mode that can't happen normally anyway so that's why they get the change. Signed-off-by: Kyle J. McKay --- awk/topgit_msg.awk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/awk/topgit_msg.awk b/awk/topgit_msg.awk index 5df42f7..530a79b 100644 --- a/awk/topgit_msg.awk +++ b/awk/topgit_msg.awk @@ -40,6 +40,10 @@ # input must be result of the git --batch output as described for # awk_topgit_msg_prepare # +# Note that if only1 is true or kwregex starts with a "+" then nothing at +# all (normally there would at least be a blank line) will be output when +# there are no matches +# # output is 0 or more branch lines with .topmsg "Subject:" descriptions # in the same order they appear on the input in this format: # @@ -106,6 +110,7 @@ BEGIN { if (substr(kwregex, 1, 1) != "^") kwregex = "^" kwregex if (substr(kwregex, length(kwregex)) != "$") kwregex = kwregex "$" if (OFS == "") OFS = " " + doblank = !only1 && !inclkw } function included(abranch) { @@ -203,7 +208,8 @@ $3 ~ /^[0123]$/ && $2 ~ /^[0-9]+$/ { if (colfmt) outline = sprintf("%-39s\t", outline) else outline = outline OFS } - print outline subj + if (doblank || subj != "" || outline != "") + print outline subj if (only1) exitnow(0) } if (err < 0) exitnow(2) -- 2.11.4.GIT