add annex.used-refspec

This commit is contained in:
Joey Hess 2015-05-14 15:44:08 -04:00
parent 86699ff861
commit 823bb8031b
5 changed files with 19 additions and 4 deletions

View file

@ -53,7 +53,9 @@ seek = withNothing start
{- Finds unused content in the annex. -} {- Finds unused content in the annex. -}
start :: CommandStart start :: CommandStart
start = do start = do
!refspec <- maybe allRefSpec (either error id . parseRefSpec) cfgrefspec <- fromMaybe allRefSpec . annexUsedRefSpec
<$> Annex.getGitConfig
!refspec <- maybe cfgrefspec (either error id . parseRefSpec)
<$> Annex.getField (optionName refSpecOption) <$> Annex.getField (optionName refSpecOption)
from <- Annex.getField (optionName unusedFromOption) from <- Annex.getField (optionName unusedFromOption)
let (name, action) = case from of let (name, action) = case from of

View file

@ -22,6 +22,7 @@ import Types.Distribution
import Types.Availability import Types.Availability
import Types.NumCopies import Types.NumCopies
import Types.Difference import Types.Difference
import Types.RefSpec
import Utility.HumanTime import Utility.HumanTime
{- Main git-annex settings. Each setting corresponds to a git-config key {- Main git-annex settings. Each setting corresponds to a git-config key
@ -59,6 +60,7 @@ data GitConfig = GitConfig
, coreSymlinks :: Bool , coreSymlinks :: Bool
, gcryptId :: Maybe String , gcryptId :: Maybe String
, annexDifferences :: Differences , annexDifferences :: Differences
, annexUsedRefSpec :: Maybe RefSpec
} }
extractGitConfig :: Git.Repo -> GitConfig extractGitConfig :: Git.Repo -> GitConfig
@ -97,6 +99,8 @@ extractGitConfig r = GitConfig
, coreSymlinks = getbool "core.symlinks" True , coreSymlinks = getbool "core.symlinks" True
, gcryptId = getmaybe "core.gcrypt-id" , gcryptId = getmaybe "core.gcrypt-id"
, annexDifferences = getDifferences r , annexDifferences = getDifferences r
, annexUsedRefSpec = either (const Nothing) Just . parseRefSpec
=<< getmaybe (annex "used-refspec")
} }
where where
getbool k d = fromMaybe d $ getmaybebool k getbool k d = fromMaybe d $ getmaybebool k

5
debian/changelog vendored
View file

@ -18,8 +18,9 @@ git-annex (5.20150508.2) UNRELEASED; urgency=medium
running at once. running at once.
* Stale transfer lock and info files will be cleaned up automatically * Stale transfer lock and info files will be cleaned up automatically
when get/unused/info commands are run. when get/unused/info commands are run.
* unused: Add --used option, which can specify a set of refs to consider * unused: Add --used option and annex.used-refspec, which can specify
used, rather than the default of considering all refs used. a set of refs to consider used, rather than the default of considering
all refs used.
-- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400 -- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400

View file

@ -36,7 +36,10 @@ For example, to move all unused data to origin:
is not in the specified refs (and not used by the work tree) will then be is not in the specified refs (and not used by the work tree) will then be
considered unused. considered unused.
# REFSPEC The git configuration annex.used-refspec can be used to configure
this in a more permanent fashion.
# REFSPEC FORMAT
The refspec format for --used-refspec is a colon-separated list of The refspec format for --used-refspec is a colon-separated list of
additions and removals of refs. For example: additions and removals of refs. For example:

View file

@ -813,6 +813,11 @@ Here are all the supported configuration settings.
When importfeed is used, it stores additional metadata from the feed, When importfeed is used, it stores additional metadata from the feed,
such as the author, title, etc. such as the author, title, etc.
* `annex.used-refspec`
This controls which refs `git-annex unused` considers to be used.
See REFSPEC FORMAT in [[git-annex-unused]](1) for details.
* `annex.queuesize` * `annex.queuesize`
git-annex builds a queue of git commands, in order to combine similar git-annex builds a queue of git commands, in order to combine similar