Merge branch 'fix'
[gitweb.git] / git-reset.sh
index eb44ee8cc197b7ff11159cf046b790cf693d3a72..6cb073cb16f8b8d8b923bd0cd77be00da0e169e3 100755 (executable)
@@ -3,7 +3,7 @@
 USAGE='[--mixed | --soft | --hard]  [<commit-ish>]'
 . git-sh-setup
 
-tmp=/var/tmp/reset.$$
+tmp=${GIT_DIR}/reset.$$
 trap 'rm -f $tmp-*' 0 1 2 3 15
 
 reset_type=--mixed
@@ -88,6 +88,9 @@ case "$reset_type" in
                                # it is ok if this fails -- it may already
                                # have been culled by checkout-index.
                                unlink $_;
+                               while (s|/[^/]*$||) {
+                                       rmdir($_) or last;
+                               }
                        }
                }
        ' $tmp-exists
@@ -100,4 +103,4 @@ case "$reset_type" in
        ;;
 esac
 
-rm -f "$GIT_DIR/MERGE_HEAD"
+rm -f "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/rr-cache/MERGE_RR"