summaryrefslogtreecommitdiff
path: root/git-sh-setup-script
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-08-27 23:53:27 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2005-08-29 12:52:02 -0700
commit48313592bf318139b39d6017a863f27420e3939a (patch)
tree10b79491f79ce17c773e37311a01697050cf2383 /git-sh-setup-script
parentRevert "Replace zero-length array decls with []." (diff)
downloadtgif-48313592bf318139b39d6017a863f27420e3939a.tar.xz
Redo "revert" using three-way merge machinery.
The reverse patch application using "git apply" sometimes is too rigid. Since the user would get used to resolving conflicting merges by hand during the normal merge experience, using the same machinery would be more helpful rather than just giving up. Cherry-picking and reverting are essentially the same operation. You pick one commit, and apply the difference that commit introduces to its own commit ancestry chain to the current tree. Revert applies the diff in reverse while cherry-pick applies it forward. They share the same logic, just different messages and merge direction. Rewrite "git rebase" using "git cherry-pick". Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-sh-setup-script')
-rwxr-xr-xgit-sh-setup-script11
1 files changed, 11 insertions, 0 deletions
diff --git a/git-sh-setup-script b/git-sh-setup-script
index 84e15df1bc..9ed5e85152 100755
--- 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)
+ }
+}
+
[ -h "$GIT_DIR/HEAD" ] &&
[ -d "$GIT_DIR/refs" ] &&
[ -d "$GIT_OBJECT_DIRECTORY/00" ]