This would be used in places where we require a clean tree, such
as reverting and rebasing.
Signed-off-by: Junio C Hamano <[EMAIL PROTECTED]>
---
git-sh-setup-script | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
1de6046ded332e2278320be314f7a5e31a431e14
diff --git a/git-sh-setup-script b/git-sh-setup-script
--- a/git-sh-setup-script
+++ b/git-sh-setup-script
@@ -11,6 +11,17 @@ die() {
exit 1
}
+check_clean_tree() {
+ dirty1_=`git-update-cache -q --refresh` && {
+ dirty2_=`git-diff-cache --name-only --cached HEAD`
+ case "$dirty2_" in '') : ;; *) (exit 1) ;; esac
+ } || {
+ echo >&2 "$dirty1_"
+ echo "$dirty2_" | sed >&2 -e 's/^/modified: /'
+ (exit 1)
+ }
+}
+
[ -d "$GIT_DIR" ] &&
[ -d "$GIT_DIR/refs" ] &&
[ -d "$GIT_OBJECT_DIRECTORY" ] &&
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html