static int newfd = -1;
static int unidiff_zero;
-static int p_value = 1;
+static int state_p_value = 1;
static int p_value_known;
static int check_index;
static int update_index;
q = guess_p_value(second);
if (p < 0) p = q;
if (0 <= p && p == q) {
- p_value = p;
+ state_p_value = p;
p_value_known = 1;
}
}
if (is_dev_null(first)) {
patch->is_new = 1;
patch->is_delete = 0;
- name = find_name_traditional(second, NULL, p_value);
+ name = find_name_traditional(second, NULL, state_p_value);
patch->new_name = name;
} else if (is_dev_null(second)) {
patch->is_new = 0;
patch->is_delete = 1;
- name = find_name_traditional(first, NULL, p_value);
+ name = find_name_traditional(first, NULL, state_p_value);
patch->old_name = name;
} else {
char *first_name;
- first_name = find_name_traditional(first, NULL, p_value);
- name = find_name_traditional(second, first_name, p_value);
+ first_name = find_name_traditional(first, NULL, state_p_value);
+ name = find_name_traditional(second, first_name, state_p_value);
free(first_name);
if (has_epoch_timestamp(first)) {
patch->is_new = 1;
static void gitdiff_verify_name(const char *line, int isnull, char **name, int side)
{
if (!*name && !isnull) {
- *name = find_name(line, NULL, p_value, TERM_TAB);
+ *name = find_name(line, NULL, state_p_value, TERM_TAB);
return;
}
if (isnull)
die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
*name, linenr);
- another = find_name(line, NULL, p_value, TERM_TAB);
+ another = find_name(line, NULL, state_p_value, TERM_TAB);
if (!another || memcmp(another, *name, len + 1))
die((side == DIFF_NEW_NAME) ?
_("git apply: bad git-diff - inconsistent new filename on line %d") :
{
patch->is_copy = 1;
free(patch->old_name);
- patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
+ patch->old_name = find_name(line, NULL, state_p_value ? state_p_value - 1 : 0, 0);
return 0;
}
{
patch->is_copy = 1;
free(patch->new_name);
- patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
+ patch->new_name = find_name(line, NULL, state_p_value ? state_p_value - 1 : 0, 0);
return 0;
}
{
patch->is_rename = 1;
free(patch->old_name);
- patch->old_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
+ patch->old_name = find_name(line, NULL, state_p_value ? state_p_value - 1 : 0, 0);
return 0;
}
{
patch->is_rename = 1;
free(patch->new_name);
- patch->new_name = find_name(line, NULL, p_value ? p_value - 1 : 0, 0);
+ patch->new_name = find_name(line, NULL, state_p_value ? state_p_value - 1 : 0, 0);
return 0;
}
int nslash;
int i;
- if (!p_value)
+ if (!state_p_value)
return (llen && line[0] == '/') ? NULL : line;
- nslash = p_value;
+ nslash = state_p_value;
for (i = 0; i < llen; i++) {
int ch = line[i];
if (ch == '/' && --nslash <= 0)
"%d leading pathname component (line %d)",
"git diff header lacks filename information when removing "
"%d leading pathname components (line %d)",
- p_value),
- p_value, linenr);
+ state_p_value),
+ state_p_value, linenr);
patch->old_name = xstrdup(patch->def_name);
patch->new_name = xstrdup(patch->def_name);
}
static int option_parse_p(const struct option *opt,
const char *arg, int unset)
{
- p_value = atoi(arg);
+ state_p_value = atoi(arg);
p_value_known = 1;
return 0;
}