summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2016-03-22 20:58:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-22 21:21:07 (GMT)
commitfda3e2cf017493ad9051c027a527e5c995ebfaf1 (patch)
treee76a906b7bf5ca9bdb3b421ce9edebb7e275e16f /builtin/apply.c
parent808ecd4cca75acac5e4868f15d3e647fc73698d3 (diff)
downloadgit-fda3e2cf017493ad9051c027a527e5c995ebfaf1.zip
git-fda3e2cf017493ad9051c027a527e5c995ebfaf1.tar.gz
git-fda3e2cf017493ad9051c027a527e5c995ebfaf1.tar.bz2
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>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 42c610e..465f954 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -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);
if (orig_name) {
- int len;
- const char *name;
+ int len = strlen(orig_name);
char *another;
- name = orig_name;
- len = strlen(name);
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);
- if (!another || memcmp(another, name, len + 1))
+ if (!another || memcmp(another, orig_name, len + 1))
die((side == DIFF_NEW_NAME) ?
_("git apply: bad git-diff - inconsistent new filename on line %d") :
_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
free(another);
return orig_name;
- }
- else {
+ } else {
/* expect "/dev/null" */
if (memcmp("/dev/null", line, 9) || line[9] != '\n')
die(_("git apply: bad git-diff - expected /dev/null on line %d"), linenr);