Skip to content

Commit

Permalink
Remove dead code from "git am"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 27, 2009
1 parent 82d97da commit c970a6f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,12 @@ do
git cat-file commit "$commit" |
sed -e '1,/^$/d' >"$dotest/msg-clean"
else
SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
case "$keep_subject" in -k) SUBJECT="[PATCH] $SUBJECT" ;; esac

(printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
git stripspace > "$dotest/msg-clean"
{
sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
echo
cat "$dotest/msg"
} |
git stripspace > "$dotest/msg-clean"
fi
;;
esac
Expand Down

0 comments on commit c970a6f

Please sign in to comment.