Remove dead code from "git am"
Ever since the initial implementation, "git am" had kept a dead code that never triggered due to a typo in the variable name. Worse yet, the code, if it weren't for the typo, would have attempted to add "[PATCH] " at the beginning of the Subject: header when "git am" is run with its "-k" option. However, because "git am -k" tells mailinfo to keep such prefix when parsing the input, the "[PATCH] " added by this dead code would have really been unnecessary duplicate. Embarrassing is that we kept _maintaining_ the codepath without anybody noticing for four years. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Nov 27, 2009 at 15:06 UTC
c970a6fd0142da3740f0205f16f91d3f2ed7e258
1 file changed
+6
-5
git-am.sh
+6
-5
@@ -350,11 +350,12 @@ do
350
git cat-file commit "$commit" |
351
sed -e '1,/^$/d' >"$dotest/msg-clean"
352
else
353
- SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
354
- case "$keep_subject" in -k) SUBJECT="[PATCH] $SUBJECT" ;; esac
355
-
356
- (printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
357
- git stripspace > "$dotest/msg-clean"
353
+ {
354
+ sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
355
+ echo
356
+ cat "$dotest/msg"
357
+ } |
358
+ git stripspace > "$dotest/msg-clean"
359
fi
360
;;
361
esac