summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-07 13:55:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-07 14:07:25 -0400
commitff03a89236956904b617e02468102e5d390306bd (patch)
tree7095a8d9b4491c2c777cf0d39ad8d4f0da3c6c1e /Annex
parent8aec790a7aefba4dc2e8e0d219d333c12ad585e3 (diff)
add new status command
This works for both direct and indirect mode. It may need some performance tuning. Note that unlike git status, it only shows the status of the work tree, not the status of the index. So only one status letter, not two .. and since files that have been added and not yet committed do not differ between the work tree and the index, they are not shown. Might want to add display of the index vs the last commit eventually. This commit was sponsored by an unknown bitcoin contributor, whose contribution as been going up lately! ;)
Diffstat (limited to 'Annex')
-rw-r--r--Annex/CatFile.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/Annex/CatFile.hs b/Annex/CatFile.hs
index 407b4ddae..812d032c6 100644
--- a/Annex/CatFile.hs
+++ b/Annex/CatFile.hs
@@ -27,6 +27,7 @@ import qualified Annex
import Git.Types
import Git.FilePath
import Git.FileMode
+import qualified Git.Ref
catFile :: Git.Branch -> FilePath -> Annex L.ByteString
catFile branch file = do
@@ -109,9 +110,6 @@ catKeyChecked needhead ref@(Ref r) =
{- From a file in the repository back to the key.
-
- - Prefixing the file with ./ makes this work even if in a subdirectory
- - of a repo.
- -
- Ideally, this should reflect the key that's staged in the index,
- not the key that's committed to HEAD. Unfortunately, git cat-file
- does not refresh the index file after it's started up, so things
@@ -134,8 +132,8 @@ catKeyChecked needhead ref@(Ref r) =
catKeyFile :: FilePath -> Annex (Maybe Key)
catKeyFile f = ifM (Annex.getState Annex.daemon)
( catKeyFileHEAD f
- , catKeyChecked True (Ref $ ":./" ++ f)
+ , catKeyChecked True $ Git.Ref.fileRef f
)
catKeyFileHEAD :: FilePath -> Annex (Maybe Key)
-catKeyFileHEAD f = catKeyChecked False (Ref $ "HEAD:./" ++ f)
+catKeyFileHEAD f = catKeyChecked False $ Git.Ref.fileFromRef Git.Ref.headRef f