Skip to content

Commit c970a6f

Browse files
committed
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 <[email protected]>
1 parent 82d97da commit c970a6f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

git-am.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ do
350350
git cat-file commit "$commit" |
351351
sed -e '1,/^$/d' >"$dotest/msg-clean"
352352
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"
358359
fi
359360
;;
360361
esac

0 commit comments

Comments
 (0)