Teach read-tree the -n|--dry-run option
authorJens Lehmann <Jens.Lehmann@web.de>
Wed, 25 May 2011 20:10:41 +0000 (22:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 May 2011 22:04:25 +0000 (15:04 -0700)
commitea5070c91f23e41a88dec48d2f8d96444c2d647a
tree02f08913add0b41a67d3369b5abc015bfe6e1133
parent2c9078d05bf2200c9671e0b292638d42e7e4fd71
Teach read-tree the -n|--dry-run option

The option can be used to check if read-tree with the same set of other
options like "-m" and "-u" would succeed without actually changing either
the index or the working tree.

The relevant tests in the t10?? range were extended to do a read-tree -n
before the real read-tree to make sure neither the index nor any local
files were changed with -n and the same exit code as without -n is
returned. The helper functions added for that purpose reside in the new
t/lib-read-tree.sh file.

The only exception is #13 in t1004 ("unlinking an un-unlink-able
symlink"). As this is an issue of wrong directory permissions it is not
detected with -n.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 files changed:
Documentation/git-read-tree.txt
builtin/read-tree.c
t/lib-read-tree.sh [new file with mode: 0644]
t/t1000-read-tree-m-3way.sh
t/t1001-read-tree-m-2way.sh
t/t1002-read-tree-m-u-2way.sh
t/t1004-read-tree-m-u-wf.sh
t/t1005-read-tree-reset.sh
t/t1008-read-tree-overlay.sh
t/t1011-read-tree-sparse-checkout.sh
t/t1012-read-tree-df.sh
t/t1020-subdirectory.sh