Git development
 help / color / mirror / Atom feed
* [PATCH] Reintegrate: send "Huh?" warnings to stderr, not stdout
@ 2026-04-27 10:47 Erik Cervin-Edin
  2026-04-28 18:05 ` Tian Yuchen
  2026-05-04 10:28 ` [PATCH v2] " erik
  0 siblings, 2 replies; 4+ messages in thread
From: Erik Cervin-Edin @ 2026-04-27 10:47 UTC (permalink / raw)
  To: git; +Cc: gitster

The "Huh?: $msg" warning in show_merge(), emitted when a first-parent
merge subject does not match either "Merge branch '...'" or "Merge
remote branch '...'", uses

	echo 2>&1 "Huh?: $msg"

The "2>&1" redirect dupes stderr onto stdout's destination; it does
not change where stdout itself points.  Since echo writes to stdout,
the "Huh?:" message lands on stdout regardless -- as would any
command's normal output.  The intent appears to have been ">&2",
which dupes stdout onto stderr.

In the common Reintegrate invocation that captures stdout, e.g.

	Meta/Reintegrate next..seen >Meta/redo-seen.sh

this means the warning is silently embedded in the generated heredoc
body instead of being printed to the maintainer's terminal.  The
resulting redo-* script is corrupted with a "Huh?:..." line and the
maintainer has no diagnostic that something went wrong.

Every other diagnostic in this script already uses ">&2"; this line
is the lone outlier.

Use ">&2" so the warning reaches stderr as intended.

Signed-off-by: Erik Cervin-Edin <erik@cervined.in>
---
 Reintegrate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Reintegrate b/Reintegrate
index a1e67a0330..6fdc7c5f41 100755
--- a/Reintegrate
+++ b/Reintegrate
@@ -327,7 +327,7 @@ show_merge () {
 		merge_hier=
 		;;
 	*)
-		echo 2>&1 "Huh?: $msg"
+		echo >&2 "Huh?: $msg"
 		return
 		;;
 	esac &&
-- 
2.53.0


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

end of thread, other threads:[~2026-05-04 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 10:47 [PATCH] Reintegrate: send "Huh?" warnings to stderr, not stdout Erik Cervin-Edin
2026-04-28 18:05 ` Tian Yuchen
2026-05-04 10:03   ` Erik Cervin Edin
2026-05-04 10:28 ` [PATCH v2] " erik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox