test_ln_s_add: refresh stat info of fake symbolic links
authorJohannes Sixt <j6t@kdbg.org>
Mon, 23 Feb 2015 18:14:47 +0000 (19:14 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Feb 2015 19:45:39 +0000 (11:45 -0800)
We have a helper function test_ln_s_add that inserts a symbolic link
into the index even if the file system does not support symbolic links.
There is a small flaw in the emulation path: the added entry does not
pick up stat information of the fake symbolic link from the file system,
as a consequence, the index is not exactly the same as for the "regular"
path (where symbolic links are available). To fix this, just call
git update-index again.

This flaw was revealed by the earlier change that tightened
compare_diff_raw(), because a test case in t4008 depends on the
correctly updated index.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-functions.sh
index 2f79146e6ce0c5df32845f7c9c0927cea133ad5f..17ecf4f16890239bc160e8fad0e487b53fb6b0c2 100644 (file)
@@ -707,7 +707,9 @@ test_ln_s_add () {
        else
                printf '%s' "$1" >"$2" &&
                ln_s_obj=$(git hash-object -w "$2") &&
-               git update-index --add --cacheinfo 120000 $ln_s_obj "$2"
+               git update-index --add --cacheinfo 120000 $ln_s_obj "$2" &&
+               # pick up stat info from the file
+               git update-index "$2"
        fi
 }