Check another error condition in git-mv
[gitweb.git] / git-reset.sh
index 04c1ac0fd2e9e147f89b92cdd831572d53bcfb88..f9995cadf563a7b3b2c1dcdeea3bf862feac2e4b 100755 (executable)
@@ -60,7 +60,7 @@ then
 else
        rm -f "$GIT_DIR/ORIG_HEAD"
 fi
-echo "$rev" >"$GIT_DIR/HEAD"
+git-update-ref HEAD "$rev"
 
 case "$reset_type" in
 --hard )
@@ -81,10 +81,12 @@ case "$reset_type" in
                while (<$fh>) {
                        chomp;
                        if (! exists $keep{$_}) {
-                               print "$_\0";
+                               # it is ok if this fails -- it may already
+                               # have been culled by checkout-index.
+                               unlink $_;
                        }
                }
-       ' $tmp-exists | xargs -0 rm -v -f --
+       ' $tmp-exists
        ;;
 --soft )
        ;; # Nothing else to do