Merge branch 'em/status-rename-config'
authorJunio C Hamano <gitster@pobox.com>
Wed, 23 May 2018 05:38:23 +0000 (14:38 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 May 2018 05:38:23 +0000 (14:38 +0900)
"git status" learned to pay attention to UI related diff
configuration variables such as diff.renames.

* em/status-rename-config:
wt-status: use settings from git_diff_ui_config

builtin/commit.c
t/t4001-diff-rename.sh
wt-status.c
index 5571d4a3e2be5ee8a71b7d5dba72b782c848f15e..5240f112257566a13ef0697783c713c822c7b256 100644 (file)
@@ -161,9 +161,9 @@ static void determine_whence(struct wt_status *s)
 static void status_init_config(struct wt_status *s, config_fn_t fn)
 {
        wt_status_prepare(s);
+       init_diff_ui_defaults();
        git_config(fn, s);
        determine_whence(s);
-       init_diff_ui_defaults();
        s->hints = advice_status_hints; /* must come after git_config() */
 }
 
index a07816d5605f30ccb7f7ce6fe83288fff535538c..bf4030371a9fc8f5abe7e88d84c98a097b9821dd 100755 (executable)
@@ -138,6 +138,18 @@ test_expect_success 'favour same basenames over different ones' '
        test_i18ngrep "renamed: .*path1 -> subdir/path1" out
 '
 
+test_expect_success 'test diff.renames=true for git status' '
+       git -c diff.renames=true status >out &&
+       test_i18ngrep "renamed: .*path1 -> subdir/path1" out
+'
+
+test_expect_success 'test diff.renames=false for git status' '
+       git -c diff.renames=false status >out &&
+       test_i18ngrep ! "renamed: .*path1 -> subdir/path1" out &&
+       test_i18ngrep "new file: .*subdir/path1" out &&
+       test_i18ngrep "deleted: .*[^/]path1" out
+'
+
 test_expect_success 'favour same basenames even with minor differences' '
        git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
        git status >out &&
index 50815e5faffba0e9df861dbc4881e9fbffd7a941..32f3bcaebd43aab58aea440ff704ca5340c61963 100644 (file)
@@ -625,9 +625,6 @@ static void wt_status_collect_changes_index(struct wt_status *s)
        rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
        rev.diffopt.format_callback = wt_status_collect_updated_cb;
        rev.diffopt.format_callback_data = s;
-       rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
-       rev.diffopt.rename_limit = 200;
-       rev.diffopt.break_opt = 0;
        copy_pathspec(&rev.prune_data, &s->pathspec);
        run_diff_index(&rev, 1);
 }
@@ -985,7 +982,6 @@ static void wt_longstatus_print_verbose(struct wt_status *s)
        setup_revisions(0, NULL, &rev, &opt);
 
        rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
-       rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
        rev.diffopt.file = s->fp;
        rev.diffopt.close_file = 0;
        /*