* creation or deletion of an empty file. In any of these cases,
* both sides are the same name under a/ and b/ respectively.
*/
-static char *git_header_name(struct apply_state *state,
+static char *git_header_name(int p_value,
const char *line,
int llen)
{
goto free_and_fail1;
/* strip the a/b prefix including trailing slash */
- cp = skip_tree_prefix(state->p_value, first.buf, first.len);
+ cp = skip_tree_prefix(p_value, first.buf, first.len);
if (!cp)
goto free_and_fail1;
strbuf_remove(&first, 0, cp - first.buf);
if (*second == '"') {
if (unquote_c_style(&sp, second, NULL))
goto free_and_fail1;
- cp = skip_tree_prefix(state->p_value, sp.buf, sp.len);
+ cp = skip_tree_prefix(p_value, sp.buf, sp.len);
if (!cp)
goto free_and_fail1;
/* They must match, otherwise ignore */
}
/* unquoted second */
- cp = skip_tree_prefix(state->p_value, second, line + llen - second);
+ cp = skip_tree_prefix(p_value, second, line + llen - second);
if (!cp)
goto free_and_fail1;
if (line + llen - cp != first.len ||
}
/* unquoted first name */
- name = skip_tree_prefix(state->p_value, line, llen);
+ name = skip_tree_prefix(p_value, line, llen);
if (!name)
return NULL;
if (unquote_c_style(&sp, second, NULL))
goto free_and_fail2;
- np = skip_tree_prefix(state->p_value, sp.buf, sp.len);
+ np = skip_tree_prefix(p_value, sp.buf, sp.len);
if (!np)
goto free_and_fail2;
*/
if (!name[len + 1])
return NULL; /* no postimage name */
- second = skip_tree_prefix(state->p_value, name + len + 1,
+ second = skip_tree_prefix(p_value, name + len + 1,
line_len - (len + 1));
if (!second)
return NULL;
* or removing or adding empty files), so we get
* the default name from the header.
*/
- patch->def_name = git_header_name(state, line, len);
+ patch->def_name = git_header_name(state->p_value, line, len);
if (patch->def_name && state->root.len) {
char *s = xstrfmt("%s%s", state->root.buf, patch->def_name);
free(patch->def_name);