summaryrefslogtreecommitdiff
path: root/Git/Ref.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Git/Ref.hs')
-rw-r--r--Git/Ref.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Git/Ref.hs b/Git/Ref.hs
index 7f21b0ab8..6cd56271f 100644
--- a/Git/Ref.hs
+++ b/Git/Ref.hs
@@ -18,6 +18,12 @@ import Data.Char (chr)
headRef :: Ref
headRef = Ref "HEAD"
+headFile :: Repo -> FilePath
+headFile r = localGitDir r </> "HEAD"
+
+setHeadRef :: Ref -> Repo -> IO ()
+setHeadRef ref r = writeFile (headFile r) ("ref: " ++ fromRef ref)
+
{- Converts a fully qualified git ref into a user-visible string. -}
describe :: Ref -> String
describe = fromRef . base