summaryrefslogtreecommitdiff
path: root/Annex/AdjustedBranch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-29 13:26:06 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-29 13:26:06 -0400
commit86c10bc681bb12936bc12c612d6a91096bc41f7b (patch)
tree5291fac68a6e2e505690e33a65a7575d28ee4eb9 /Annex/AdjustedBranch.hs
parentc079545a6a3a85f92fbf592229b5f90dbb2da856 (diff)
git annex add in adjusted unlocked branch
Cached the current branch lookup just because it seems unnecessary overhead to run an extra git command per add to query the current branch.
Diffstat (limited to 'Annex/AdjustedBranch.hs')
-rw-r--r--Annex/AdjustedBranch.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 357e70e2f..b2ca7dbf6 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -12,6 +12,7 @@ module Annex.AdjustedBranch (
originalToAdjusted,
adjustedToOriginal,
fromAdjustedBranch,
+ getAdjustment,
enterAdjustedBranch,
updateAdjustedBranch,
propigateAdjustedCommits,
@@ -45,7 +46,7 @@ data Adjustment
| LockAdjustment
| HideMissingAdjustment
| ShowMissingAdjustment
- deriving (Show)
+ deriving (Show, Eq)
reverseAdjustment :: Adjustment -> Adjustment
reverseAdjustment UnlockAdjustment = LockAdjustment
@@ -122,6 +123,9 @@ adjustedToOriginal b
bs = fromRef b
prefixlen = length adjustedBranchPrefix
+getAdjustment :: Branch -> Maybe Adjustment
+getAdjustment = fmap fst . adjustedToOriginal
+
fromAdjustedBranch :: Branch -> OrigBranch
fromAdjustedBranch b = maybe b snd (adjustedToOriginal b)