difftool: fix bug when printing usage
commitd81345ce09c121fb0d18dec5c2535ec8d2a67542
authorDavid Aguilar <davvid@gmail.com>
Sun, 5 Feb 2017 21:23:38 +0000 (5 13:23 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Feb 2017 18:13:48 +0000 (6 10:13 -0800)
treedfd66a63db19d383530453f73f23b38d60fdf116
parent94d3997ecc09f36d17b9ad4b49c4709885e300f7
difftool: fix bug when printing usage

"git difftool -h" reports an error:

fatal: BUG: setup_git_env called without repository

Defer repository setup so that the help option processing happens before
the repository is initialized.

Add tests to ensure that the basic usage works inside and outside of a
repository.

Signed-off-by: David Aguilar <davvid@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/difftool.c
t/t7800-difftool.sh