Merge branch 'bc/reread-attributes-during-rebase'

The "git am" based backend of "git rebase" ignored the result of
updating ".gitattributes" done in one step when replaying
subsequent steps.

* bc/reread-attributes-during-rebase:
  am: reload .gitattributes after patching it
  path: add a function to check for path suffix
This commit is contained in:
Junio C Hamano
2019-09-09 12:26:40 -07:00
9 changed files with 183 additions and 23 deletions

11
apply.c
View File

@ -4643,6 +4643,7 @@ static int apply_patch(struct apply_state *state,
struct patch *list = NULL, **listp = &list;
int skipped_patch = 0;
int res = 0;
int flush_attributes = 0;
state->patch_input_file = filename;
if (read_patch_file(&buf, fd) < 0)
@ -4670,6 +4671,14 @@ static int apply_patch(struct apply_state *state,
patch_stats(state, patch);
*listp = patch;
listp = &patch->next;
if ((patch->new_name &&
ends_with_path_components(patch->new_name,
GITATTRIBUTES_FILE)) ||
(patch->old_name &&
ends_with_path_components(patch->old_name,
GITATTRIBUTES_FILE)))
flush_attributes = 1;
}
else {
if (state->apply_verbosity > verbosity_normal)
@ -4746,6 +4755,8 @@ static int apply_patch(struct apply_state *state,
if (state->summary && state->apply_verbosity > verbosity_silent)
summary_patch_list(list);
if (flush_attributes)
reset_parsed_attributes();
end:
free_patch_list(list);
strbuf_release(&buf);