Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=git-hooks.git;a=commitdiff;h=d8103671c0116a3b7ef286fdc907ae562a796d31

commit d8103671c0116a3b7ef286fdc907ae562a796d31
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Mon Mar 24 14:34:42 2008 +0100

checkout: support for detached head

diff --git a/checkout/checkout.py b/checkout/checkout.py
index fa73d20..c361310 100644
--- a/checkout/checkout.py
+++ b/checkout/checkout.py
@@ -21,6 +21,13 @@ def callback(patch):
sys.stdout.flush()
time.sleep(1)
except OSError:
-                       os.system("git checkout -f")
+                       ret = os.system("git symbolic-ref HEAD &>/dev/null")
+                       if ret != 0:
+                               # this is a detached head
+                               os.system("git checkout -m master")
+                       else:
+                               # we don't know where we are, need to
+                               # check every checked out file
+                               os.system("git checkout -f")
return
print "WARNING: Timeout exceeded, checkout failed!"
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to