summaryrefslogtreecommitdiff
path: root/t/t4011-diff-symlink.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-26 12:08:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-29 03:38:49 (GMT)
commit0231ae71d3d6706183777fbfd91667d620776e87 (patch)
treee075b82075d87d37b7a3db74aa5e9fea1410a55e /t/t4011-diff-symlink.sh
parentba4e356109e5bf2b86bde335128c0ab4161268a9 (diff)
downloadgit-0231ae71d3d6706183777fbfd91667d620776e87.zip
git-0231ae71d3d6706183777fbfd91667d620776e87.tar.gz
git-0231ae71d3d6706183777fbfd91667d620776e87.tar.bz2
diff: turn --ita-invisible-in-index on by default
Due to the implementation detail of intent-to-add entries, the current "git diff" (i.e. no treeish or --cached argument) would show the changes in the i-t-a file, but it does not mark the file as new, while "diff --cached" would mark the file as new while showing its content as empty. $ git diff | $ diff --cached --------------------------------|------------------------------- diff --git a/new b/new | diff --git a/new b/new index e69de29..5ad28e2 100644 | new file mode 100644 --- a/new | index 0000000..e69de29 +++ b/new | @@ -0,0 +1 @@ | +haha | One evidence of the current output being wrong is that, the output from "git diff" (with ita entries) cannot be applied because it assumes empty files exist before applying. Turning on --ita-invisible-in-index [1] [2] would fix this. The result is "new file" line moving from "git diff --cached" to "git diff". $ git diff | $ diff --cached --------------------------------|------------------------------- diff --git a/new b/new | new file mode 100644 | index 0000000..5ad28e2 | --- /dev/null | +++ b/new | @@ -0,0 +1 @@ | +haha | This option is on by default in git-status [1] but we need more fixup in rename detection code [3]. Luckily we don't need to do anything else for the rename detection code in diff.c (wt-status.c uses a customized one). [1] 425a28e0a4 (diff-lib: allow ita entries treated as "not yet exist in index" - 2016-10-24) [2] b42b451919 (diff: add --ita-[in]visible-in-index - 2016-10-24) [3] bc3dca07f4 (Merge branch 'nd/ita-wt-renames-in-status' - 2018-01-23) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4011-diff-symlink.sh')
-rwxr-xr-xt/t4011-diff-symlink.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index cf0f3a1..108c012 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -139,11 +139,13 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' '
test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '
cat >expect <<-\EOF &&
diff --git a/file.bin b/file.bin
- index e69de29..d95f3ad 100644
- Binary files a/file.bin and b/file.bin differ
+ new file mode 100644
+ index 0000000..d95f3ad
+ Binary files /dev/null and b/file.bin differ
diff --git a/link.bin b/link.bin
- index e69de29..dce41ec 120000
- --- a/link.bin
+ new file mode 120000
+ index 0000000..dce41ec
+ --- /dev/null
+++ b/link.bin
@@ -0,0 +1 @@
+file.bin