t5521: test --dry-run does not make any changes
authorPaul Tan <pyokagan@gmail.com>
Fri, 29 May 2015 11:44:44 +0000 (19:44 +0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 May 2015 16:16:01 +0000 (09:16 -0700)
Test that when --dry-run is provided to git-pull, it does not make any
changes, namely:

* --dry-run gets passed to git-fetch, so no FETCH_HEAD will be created
and no refs will be fetched.

* The index and work tree will not be modified.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5521-pull-options.sh
index 453aba53f45e34f6b17bcad7628f4224d6c2de4c..56e7377189acdfed6fa76b8d9c4214974ba11394 100755 (executable)
@@ -117,4 +117,17 @@ test_expect_success 'git pull --all' '
        )
 '
 
+test_expect_success 'git pull --dry-run' '
+       test_when_finished "rm -rf clonedry" &&
+       git init clonedry &&
+       (
+               cd clonedry &&
+               git pull --dry-run ../parent &&
+               test_path_is_missing .git/FETCH_HEAD &&
+               test_path_is_missing .git/refs/heads/master &&
+               test_path_is_missing .git/index &&
+               test_path_is_missing file
+       )
+'
+
 test_done