summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a935824)
raw | patch | inline | side by side (parent: a935824)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 25 Sep 2005 05:52:32 +0000 (22:52 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 27 Sep 2005 01:04:17 +0000 (18:04 -0700) |
My stupidity deserved to be yelled at by Linus ... there is no reason
to require the working tree to be clean when merging -- the only
requirements are index to match HEAD commit and the paths involved in
merge are up to date in the working tree. Revert and cherry-pick are
just specialized forms of merge, and the requirements should be the
same.
Remove the 'general purpose routine to make sure tree is clean' from
git-sh-setup, to prevent me from getting tempted again.
Signed-off-by: Junio C Hamano <junkio@cox.net>
to require the working tree to be clean when merging -- the only
requirements are index to match HEAD commit and the paths involved in
merge are up to date in the working tree. Revert and cherry-pick are
just specialized forms of merge, and the requirements should be the
same.
Remove the 'general purpose routine to make sure tree is clean' from
git-sh-setup, to prevent me from getting tempted again.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-revert.sh | patch | blob | history | |
git-sh-setup.sh | patch | blob | history |
diff --git a/git-revert.sh b/git-revert.sh
index 722c4f755af5ea07981712d8abf6d6eed81c5d56..dfd914cf561c10f92ef2f3207446800de70c4834 100755 (executable)
--- a/git-revert.sh
+++ b/git-revert.sh
die "Your index file is unmerged."
;;
*)
- check_clean_tree || die "Cannot run $me from a dirty tree."
head=$(git-rev-parse --verify HEAD) ||
die "You do not have a valid HEAD"
+ files=$(git-diff-index --cached --name-only $head) || exit
+ if [ "$files" ]; then
+ die "Dirty index: cannot $me (dirty: $files)"
+ fi
;;
esac
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index d5bfa62dee0e85d404f955edefd2151e8c0e7aab..55db795843514571450acf7da600b6aba10c15d4 100755 (executable)
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
exit 1
}
-check_clean_tree() {
- dirty1_=`git-update-index -q --refresh` && {
- dirty2_=`git-diff-index --name-only --cached HEAD`
- case "$dirty2_" in '') : ;; *) (exit 1) ;; esac
- } || {
- echo >&2 "$dirty1_"
- echo "$dirty2_" | sed >&2 -e 's/^/modified: /'
- (exit 1)
- }
-}
-
[ -h "$GIT_DIR/HEAD" ] &&
[ -d "$GIT_DIR/refs" ] &&
[ -d "$GIT_OBJECT_DIRECTORY/00" ]