summaryrefslogtreecommitdiff
path: root/t/t4001-diff-rename.sh
diff options
context:
space:
mode:
authorEckhard S. Maaß <eckhard.s.maass@googlemail.com>2018-05-04 11:12:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-06 03:59:33 (GMT)
commitdc6b1d92ca9c0c538daa244e3910bb8b2a50d959 (patch)
tree4c0340f8e846700094724fc42e7a6f25ba79d004 /t/t4001-diff-rename.sh
parent1f1cddd558b54bb0ce19c8ace353fd07b758510d (diff)
downloadgit-dc6b1d92ca9c0c538daa244e3910bb8b2a50d959.zip
git-dc6b1d92ca9c0c538daa244e3910bb8b2a50d959.tar.gz
git-dc6b1d92ca9c0c538daa244e3910bb8b2a50d959.tar.bz2
wt-status: use settings from git_diff_ui_config
If you do something like - git add . - git status - git commit - git show (or git diff HEAD) one would expect to have analogous output from git status and git show (or similar diff-related programs). This is generally not the case, as git status has hard coded values for diff related options. With this commit the hard coded settings are dropped from the status command in favour for values provided by git_diff_ui_config. What follows are some remarks on the concrete options which were hard coded in git status: diffopt.detect_rename Since the very beginning of git status in a3e870f2e2 ("Add "commit" helper script", 2005-05-30), git status always used rename detection, whereas with commands like show and log one had to activate it with a command line option. After 5404c116aa ("diff: activate diff.renames by default", 2016-02-25) the default behaves the same by coincidence, but changing diff.renames to other values can break the consistency between git status and other commands again. With this commit one control the same default behaviour with diff.renames. diffopt.rename_limit Similarly one has the option diff.renamelimit to adjust this limit for all commands but git status. With this commit git status will also honor those. diffopt.break_opt Unlike the other two options this cannot be configured by a configuration option yet. This commit will also change the default behaviour to not use break rewrites. But as rename detection is most likely on, this is dangerous to be activated anyway as one can see here: https://public-inbox.org/git/xmqqegqaahnh.fsf@gitster.dls.corp.google.com/ Signed-off-by: Eckhard S. Maaß <eckhard.s.maass@gmail.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4001-diff-rename.sh')
-rwxr-xr-xt/t4001-diff-rename.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index a07816d..bf40303 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -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 &&