builtin/apply: get rid of useless 'name' variable

While at it put an 'else' on the same line as the previous '}'.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Christian Couder 2016-03-22 21:58:40 +01:00 committed by Junio C Hamano
parent 808ecd4cca
commit fda3e2cf01

View file

@ -931,22 +931,19 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
return find_name(line, NULL, p_value, TERM_TAB); return find_name(line, NULL, p_value, TERM_TAB);
if (orig_name) { if (orig_name) {
int len; int len = strlen(orig_name);
const char *name;
char *another; char *another;
name = orig_name;
len = strlen(name);
if (isnull) if (isnull)
die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr); die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
orig_name, linenr);
another = find_name(line, NULL, p_value, TERM_TAB); another = find_name(line, NULL, p_value, TERM_TAB);
if (!another || memcmp(another, name, len + 1)) if (!another || memcmp(another, orig_name, len + 1))
die((side == DIFF_NEW_NAME) ? die((side == DIFF_NEW_NAME) ?
_("git apply: bad git-diff - inconsistent new filename on line %d") : _("git apply: bad git-diff - inconsistent new filename on line %d") :
_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr); _("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
free(another); free(another);
return orig_name; return orig_name;
} } else {
else {
/* expect "/dev/null" */ /* expect "/dev/null" */
if (memcmp("/dev/null", line, 9) || line[9] != '\n') if (memcmp("/dev/null", line, 9) || line[9] != '\n')
die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr); die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr);