Skip to content

Synchronize built-in add -i/-p patches with upstream #2422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static int pathname_entry_cmp(const void *unused_cmp_data,
}

struct collection_status {
enum { FROM_WORKTREE = 0, FROM_INDEX = 1 } phase;
enum { FROM_WORKTREE = 0, FROM_INDEX = 1 } mode;

const char *reference;

Expand Down Expand Up @@ -473,9 +473,9 @@ static void collect_changes_cb(struct diff_queue_struct *q,
}

file_item = entry->item;
adddel = s->phase == FROM_INDEX ?
adddel = s->mode == FROM_INDEX ?
&file_item->index : &file_item->worktree;
other_adddel = s->phase == FROM_INDEX ?
other_adddel = s->mode == FROM_INDEX ?
&file_item->worktree : &file_item->index;
adddel->seen = 1;
adddel->add = stat.files[i]->added;
Expand Down Expand Up @@ -526,9 +526,9 @@ static int get_modified_files(struct repository *r,
struct setup_revision_opt opt = { 0 };

if (filter == INDEX_ONLY)
s.phase = i ? FROM_WORKTREE : FROM_INDEX;
s.mode = (i == 0) ? FROM_INDEX : FROM_WORKTREE;
else
s.phase = i ? FROM_INDEX : FROM_WORKTREE;
s.mode = (i == 0) ? FROM_WORKTREE : FROM_INDEX;
s.skip_unseen = filter && i;

opt.def = is_initial ?
Expand All @@ -544,7 +544,7 @@ static int get_modified_files(struct repository *r,
if (ps)
copy_pathspec(&rev.prune_data, ps);

if (s.phase == FROM_INDEX)
if (s.mode == FROM_INDEX)
run_diff_index(&rev, 1);
else {
rev.diffopt.flags.ignore_dirty_submodules = 1;
Expand Down