skeleton smudge/clean filters
This commit is contained in:
parent
37a5e2d419
commit
20ca89dfa3
7 changed files with 137 additions and 2 deletions
|
@ -96,6 +96,8 @@ import qualified Command.Upgrade
|
||||||
import qualified Command.Forget
|
import qualified Command.Forget
|
||||||
import qualified Command.Proxy
|
import qualified Command.Proxy
|
||||||
import qualified Command.DiffDriver
|
import qualified Command.DiffDriver
|
||||||
|
import qualified Command.Smudge
|
||||||
|
import qualified Command.Clean
|
||||||
import qualified Command.Undo
|
import qualified Command.Undo
|
||||||
import qualified Command.Version
|
import qualified Command.Version
|
||||||
#ifdef WITH_ASSISTANT
|
#ifdef WITH_ASSISTANT
|
||||||
|
@ -201,6 +203,8 @@ cmds testoptparser testrunner =
|
||||||
, Command.Forget.cmd
|
, Command.Forget.cmd
|
||||||
, Command.Proxy.cmd
|
, Command.Proxy.cmd
|
||||||
, Command.DiffDriver.cmd
|
, Command.DiffDriver.cmd
|
||||||
|
, Command.Smudge.cmd
|
||||||
|
, Command.Clean.cmd
|
||||||
, Command.Undo.cmd
|
, Command.Undo.cmd
|
||||||
, Command.Version.cmd
|
, Command.Version.cmd
|
||||||
#ifdef WITH_ASSISTANT
|
#ifdef WITH_ASSISTANT
|
||||||
|
|
29
Command/Clean.hs
Normal file
29
Command/Clean.hs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{- git-annex command
|
||||||
|
-
|
||||||
|
- Copyright 2015 Joey Hess <id@joeyh.name>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
module Command.Clean where
|
||||||
|
|
||||||
|
import Common.Annex
|
||||||
|
import Command
|
||||||
|
import Annex.Content
|
||||||
|
import Annex.Link
|
||||||
|
import Git.Types
|
||||||
|
|
||||||
|
cmd :: Command
|
||||||
|
cmd = dontCheck repoExists $
|
||||||
|
command "clean" SectionPlumbing
|
||||||
|
"git clean filter"
|
||||||
|
paramFile (withParams seek)
|
||||||
|
|
||||||
|
seek :: CmdParams -> CommandSeek
|
||||||
|
seek = withWords start
|
||||||
|
|
||||||
|
start :: [String] -> CommandStart
|
||||||
|
start [file] = do
|
||||||
|
error ("clean " ++ file)
|
||||||
|
start [] = error "clean filter run without filename; upgrade git"
|
||||||
|
start _ = error "clean filter passed multiple filenames"
|
29
Command/Smudge.hs
Normal file
29
Command/Smudge.hs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{- git-annex command
|
||||||
|
-
|
||||||
|
- Copyright 2015 Joey Hess <id@joeyh.name>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
module Command.Smudge where
|
||||||
|
|
||||||
|
import Common.Annex
|
||||||
|
import Command
|
||||||
|
import Annex.Content
|
||||||
|
import Annex.Link
|
||||||
|
import Git.Types
|
||||||
|
|
||||||
|
cmd :: Command
|
||||||
|
cmd = dontCheck repoExists $
|
||||||
|
command "smudge" SectionPlumbing
|
||||||
|
"git smudge filter"
|
||||||
|
paramFile (withParams seek)
|
||||||
|
|
||||||
|
seek :: CmdParams -> CommandSeek
|
||||||
|
seek = withWords start
|
||||||
|
|
||||||
|
start :: [String] -> CommandStart
|
||||||
|
start [file] = do
|
||||||
|
error ("smudge " ++ file)
|
||||||
|
start [] = error "smudge filter run without filename; upgrade git"
|
||||||
|
start _ = error "smudge filter passed multiple filenames"
|
36
doc/git-annex-clean.mdwn
Normal file
36
doc/git-annex-clean.mdwn
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
git-annex clean - git filter driver for git-annex
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
git annex clean
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
When git-annex is used as a git filter driver, this command is run
|
||||||
|
by git commands such as `git add`. It generates a file that
|
||||||
|
is added to the git repository and points to the git-annex object
|
||||||
|
containing the content of a large file.
|
||||||
|
|
||||||
|
To configure git to use git-annex as a git filter driver, place the
|
||||||
|
following in the .gitattributes file:
|
||||||
|
|
||||||
|
* filter=annex
|
||||||
|
.* !filter
|
||||||
|
|
||||||
|
The annex.largefiles config is consulted to decide if a given file should
|
||||||
|
be added to git as-is, or if its content are large enough to need to use
|
||||||
|
git-annex.
|
||||||
|
|
||||||
|
# SEE ALSO
|
||||||
|
|
||||||
|
[[git-annex]](1)
|
||||||
|
|
||||||
|
[[git-annex-smudge]](1)
|
||||||
|
|
||||||
|
# AUTHOR
|
||||||
|
|
||||||
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
||||||
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|
31
doc/git-annex-smudge.mdwn
Normal file
31
doc/git-annex-smudge.mdwn
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
git-annex smudge - git filter driver for git-annex
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
git annex smudge
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
When git-annex is used as a git filter driver, this command is run
|
||||||
|
by git commands such as `git checkout` and outputs the content of annexed
|
||||||
|
objects that pointer files point to.
|
||||||
|
|
||||||
|
To configure git to use git-annex as a git filter driver, place the
|
||||||
|
following in the .gitattributes file:
|
||||||
|
|
||||||
|
* filter=annex
|
||||||
|
.* !filter
|
||||||
|
|
||||||
|
# SEE ALSO
|
||||||
|
|
||||||
|
[[git-annex]](1)
|
||||||
|
|
||||||
|
[[git-annex-clean]](1)
|
||||||
|
|
||||||
|
# AUTHOR
|
||||||
|
|
||||||
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
||||||
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|
|
@ -626,6 +626,12 @@ subdirectories).
|
||||||
|
|
||||||
See [[git-annex-diffdriver]](1) for details.
|
See [[git-annex-diffdriver]](1) for details.
|
||||||
|
|
||||||
|
* `smudge`, `clean`
|
||||||
|
|
||||||
|
These let git-annex be used as a git filter driver.
|
||||||
|
|
||||||
|
See [[git-annex-smudge]](1) and [[git-annex-clean]](1) for details.
|
||||||
|
|
||||||
* `remotedaemon`
|
* `remotedaemon`
|
||||||
|
|
||||||
Detects when network remotes have received git pushes and fetches from them.
|
Detects when network remotes have received git pushes and fetches from them.
|
||||||
|
|
|
@ -177,8 +177,8 @@ Configuration:
|
||||||
the annex. Other files are passed through the smudge/clean as-is and
|
the annex. Other files are passed through the smudge/clean as-is and
|
||||||
have their contents stored in git.
|
have their contents stored in git.
|
||||||
|
|
||||||
* annex.direct is repurposed to configure how the assistant adds files.
|
* annex.direct is repurposed to configure how git-annex adds files.
|
||||||
When set to true, they're added unlocked.
|
When set to false, it adds symlinks and when true it adds pointer files.
|
||||||
|
|
||||||
git-annex clean:
|
git-annex clean:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue