filter-branch: use require_clean_work_tree

Filter-branch already requires that we have a clean work tree before starting. However, it failed to refresh the index before checking, which means it could be wrong in the case of stat-dirtiness. Instead of simply adding a call to refresh the index, let's switch to using the require_clean_work_tree function provided by git-sh-setup. It does exactly what we want, and with fewer lines of code and more specific output messages. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 1, 2011 at 17:53 UTC 5347a50fec066845e5dfa34a53cbec1ea347641d
1 file changed +1 -3
git-filter-branch.sh
+1 -3
@@ -108,9 +108,7 @@ OPTIONS_SPEC=
108 . git-sh-setup
109
110 if [ "$(is_bare_repository)" = false ]; then
111 - git diff-files --ignore-submodules --quiet &&
112 - git diff-index --cached --quiet HEAD -- ||
113 - die "Cannot rewrite branch(es) with a dirty working directory."
111 + require_clean_work_tree 'rewrite branches'
112 fi
113
114 tempdir=.git-rewrite