Merge branch 'en/eol-attrs-gotchas'
All "mergy" operations that internally use the merge-recursive machinery should honor the merge.renormalize configuration, but many of them didn't. * en/eol-attrs-gotchas: checkout: support renormalization with checkout -m <paths> merge: make merge.renormalize work for all uses of merge machinery t6038: remove problematic test t6038: make tests fail for the right reason
This commit is contained in:
commit
4339259d5f
@ -239,6 +239,8 @@ static int checkout_merged(int pos, const struct checkout *state, int *nr_checko
|
||||
mmbuffer_t result_buf;
|
||||
struct object_id threeway[3];
|
||||
unsigned mode = 0;
|
||||
struct ll_merge_options ll_opts;
|
||||
int renormalize = 0;
|
||||
|
||||
memset(threeway, 0, sizeof(threeway));
|
||||
while (pos < active_nr) {
|
||||
@ -259,13 +261,12 @@ static int checkout_merged(int pos, const struct checkout *state, int *nr_checko
|
||||
read_mmblob(&ours, &threeway[1]);
|
||||
read_mmblob(&theirs, &threeway[2]);
|
||||
|
||||
/*
|
||||
* NEEDSWORK: re-create conflicts from merges with
|
||||
* merge.renormalize set, too
|
||||
*/
|
||||
memset(&ll_opts, 0, sizeof(ll_opts));
|
||||
git_config_get_bool("merge.renormalize", &renormalize);
|
||||
ll_opts.renormalize = renormalize;
|
||||
status = ll_merge(&result_buf, path, &ancestor, "base",
|
||||
&ours, "ours", &theirs, "theirs",
|
||||
state->istate, NULL);
|
||||
state->istate, &ll_opts);
|
||||
free(ancestor.ptr);
|
||||
free(ours.ptr);
|
||||
free(theirs.ptr);
|
||||
@ -771,13 +772,6 @@ static int merge_working_tree(const struct checkout_opts *opts,
|
||||
*/
|
||||
|
||||
add_files_to_cache(NULL, NULL, 0);
|
||||
/*
|
||||
* NEEDSWORK: carrying over local changes
|
||||
* when branches have different end-of-line
|
||||
* normalization (or clean+smudge rules) is
|
||||
* a pain; plumb in an option to set
|
||||
* o.renormalize?
|
||||
*/
|
||||
init_merge_options(&o, the_repository);
|
||||
o.verbosity = 0;
|
||||
work = write_in_core_index_as_tree(the_repository);
|
||||
|
@ -72,7 +72,6 @@ static const char **xopts;
|
||||
static size_t xopts_nr, xopts_alloc;
|
||||
static const char *branch;
|
||||
static char *branch_mergeoptions;
|
||||
static int option_renormalize;
|
||||
static int verbosity;
|
||||
static int allow_rerere_auto;
|
||||
static int abort_current_merge;
|
||||
@ -621,8 +620,6 @@ static int git_merge_config(const char *k, const char *v, void *cb)
|
||||
return git_config_string(&pull_octopus, k, v);
|
||||
else if (!strcmp(k, "commit.cleanup"))
|
||||
return git_config_string(&cleanup_arg, k, v);
|
||||
else if (!strcmp(k, "merge.renormalize"))
|
||||
option_renormalize = git_config_bool(k, v);
|
||||
else if (!strcmp(k, "merge.ff")) {
|
||||
int boolval = git_parse_maybe_bool(v);
|
||||
if (0 <= boolval) {
|
||||
@ -721,7 +718,6 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
||||
if (!strcmp(strategy, "subtree"))
|
||||
o.subtree_shift = "";
|
||||
|
||||
o.renormalize = option_renormalize;
|
||||
o.show_rename_progress =
|
||||
show_progress == -1 ? isatty(2) : show_progress;
|
||||
|
||||
|
@ -3792,9 +3792,12 @@ int merge_recursive_generic(struct merge_options *opt,
|
||||
static void merge_recursive_config(struct merge_options *opt)
|
||||
{
|
||||
char *value = NULL;
|
||||
int renormalize = 0;
|
||||
git_config_get_int("merge.verbosity", &opt->verbosity);
|
||||
git_config_get_int("diff.renamelimit", &opt->rename_limit);
|
||||
git_config_get_int("merge.renamelimit", &opt->rename_limit);
|
||||
git_config_get_bool("merge.renormalize", &renormalize);
|
||||
opt->renormalize = renormalize;
|
||||
if (!git_config_get_string("diff.renames", &value)) {
|
||||
opt->detect_renames = git_config_rename("diff.renames", value);
|
||||
free(value);
|
||||
|
@ -158,7 +158,7 @@ test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
|
||||
compare_files expected file.fuzzy
|
||||
'
|
||||
|
||||
test_expect_failure 'checkout -m after setting text=auto' '
|
||||
test_expect_success 'checkout -m after setting text=auto' '
|
||||
cat <<-\EOF >expected &&
|
||||
first line
|
||||
same line
|
||||
@ -168,12 +168,12 @@ test_expect_failure 'checkout -m after setting text=auto' '
|
||||
git rm -fr . &&
|
||||
rm -f .gitattributes &&
|
||||
git reset --hard initial &&
|
||||
git checkout a -- . &&
|
||||
git restore --source=a -- . &&
|
||||
git checkout -m b &&
|
||||
compare_files expected file
|
||||
git diff --no-index --ignore-cr-at-eol expected file
|
||||
'
|
||||
|
||||
test_expect_failure 'checkout -m addition of text=auto' '
|
||||
test_expect_success 'checkout -m addition of text=auto' '
|
||||
cat <<-\EOF >expected &&
|
||||
first line
|
||||
same line
|
||||
@ -183,23 +183,9 @@ test_expect_failure 'checkout -m addition of text=auto' '
|
||||
git rm -fr . &&
|
||||
rm -f .gitattributes file &&
|
||||
git reset --hard initial &&
|
||||
git checkout b -- . &&
|
||||
git restore --source=b -- . &&
|
||||
git checkout -m a &&
|
||||
compare_files expected file
|
||||
'
|
||||
|
||||
test_expect_failure 'cherry-pick patch from after text=auto was added' '
|
||||
append_cr <<-\EOF >expected &&
|
||||
first line
|
||||
same line
|
||||
EOF
|
||||
|
||||
git config merge.renormalize true &&
|
||||
git rm -fr . &&
|
||||
git reset --hard b &&
|
||||
test_must_fail git cherry-pick a >err 2>&1 &&
|
||||
grep "[Nn]othing added" err &&
|
||||
compare_files expected file
|
||||
git diff --no-index --ignore-cr-at-eol expected file
|
||||
'
|
||||
|
||||
test_expect_success 'Test delete/normalize conflict' '
|
||||
|
Loading…
Reference in New Issue
Block a user