From e2f5f6ef6795c880a2f13ea472b96704b4a4ca94 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 24 Sep 2005 22:52:32 -0700 Subject: Do not require clean tree when reverting and cherry-picking. 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 --- git-revert.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git-revert.sh') diff --git a/git-revert.sh b/git-revert.sh index 722c4f755a..dfd914cf56 100755 --- a/git-revert.sh +++ b/git-revert.sh @@ -56,9 +56,12 @@ t) 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 -- cgit v1.2.3