Skip to content

Commit fda3e2c

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 808ecd4 commit fda3e2c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

builtin/apply.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -931,22 +931,19 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
931931
return find_name(line, NULL, p_value, TERM_TAB);
932932

933933
if (orig_name) {
934-
int len;
935-
const char *name;
934+
int len = strlen(orig_name);
936935
char *another;
937-
name = orig_name;
938-
len = strlen(name);
939936
if (isnull)
940-
die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr);
937+
die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
938+
orig_name, linenr);
941939
another = find_name(line, NULL, p_value, TERM_TAB);
942-
if (!another || memcmp(another, name, len + 1))
940+
if (!another || memcmp(another, orig_name, len + 1))
943941
die((side == DIFF_NEW_NAME) ?
944942
_("git apply: bad git-diff - inconsistent new filename on line %d") :
945943
_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
946944
free(another);
947945
return orig_name;
948-
}
949-
else {
946+
} else {
950947
/* expect "/dev/null" */
951948
if (memcmp("/dev/null", line, 9) || line[9] != '\n')
952949
die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr);

0 commit comments

Comments
 (0)