add: Stage symlinks the same as git add would, even if they are not a link to annexed content.
This commit is contained in:
parent
772dd88ae9
commit
81ad277a85
5 changed files with 34 additions and 7 deletions
|
@ -66,10 +66,13 @@ startSmall :: FilePath -> CommandStart
|
||||||
startSmall file = do
|
startSmall file = do
|
||||||
showStart "add" file
|
showStart "add" file
|
||||||
showNote "non-large file; adding content to git repository"
|
showNote "non-large file; adding content to git repository"
|
||||||
next $ do
|
next $ performAdd file
|
||||||
params <- forceParams
|
|
||||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
performAdd :: FilePath -> CommandPerform
|
||||||
next $ return True
|
performAdd file = do
|
||||||
|
params <- forceParams
|
||||||
|
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
||||||
|
next $ return True
|
||||||
|
|
||||||
{- The add subcommand annexes a file, generating a key for it using a
|
{- The add subcommand annexes a file, generating a key for it using a
|
||||||
- backend, and then moving it into the annex directory and setting up
|
- backend, and then moving it into the annex directory and setting up
|
||||||
|
@ -81,11 +84,13 @@ start file = ifAnnexed file addpresent add
|
||||||
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
||||||
case ms of
|
case ms of
|
||||||
Nothing -> stop
|
Nothing -> stop
|
||||||
Just s
|
Just s
|
||||||
| isSymbolicLink s || not (isRegularFile s) -> stop
|
| not (isRegularFile s) && not (isSymbolicLink s) -> stop
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
showStart "add" file
|
showStart "add" file
|
||||||
next $ perform file
|
next $ if isSymbolicLink s
|
||||||
|
then performAdd file
|
||||||
|
else perform file
|
||||||
addpresent key = ifM isDirect
|
addpresent key = ifM isDirect
|
||||||
( do
|
( do
|
||||||
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -23,6 +23,8 @@ git-annex (5.20150618) UNRELEASED; urgency=medium
|
||||||
shared libraries including libyaml.
|
shared libraries including libyaml.
|
||||||
* import: Fix failure of cross-device import on Windows.
|
* import: Fix failure of cross-device import on Windows.
|
||||||
* merge: Avoid creating the synced/master branch.
|
* merge: Avoid creating the synced/master branch.
|
||||||
|
* add: Stage symlinks the same as git add would, even if they are not a
|
||||||
|
link to annexed content.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 02 Jul 2015 12:31:14 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 02 Jul 2015 12:31:14 -0400
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ If annex.largefiles is configured, and does not match a file that is being
|
||||||
added, `git annex add` will behave the same as `git add` and add the
|
added, `git annex add` will behave the same as `git add` and add the
|
||||||
non-large file directly to the git repository, instead of to the annex.
|
non-large file directly to the git repository, instead of to the annex.
|
||||||
|
|
||||||
|
This command can also be used to add symbolic links, both symlinks to
|
||||||
|
annexed content, and other symlinks.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
* `--include-dotfiles`
|
* `--include-dotfiles`
|
||||||
|
|
|
@ -6,3 +6,5 @@ Is there already a good way of adding symlinks in direct mode? If not, I would f
|
||||||
|
|
||||||
Best regards,
|
Best regards,
|
||||||
T.
|
T.
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 3"""
|
||||||
|
date="2015-07-07T20:02:02Z"
|
||||||
|
content="""
|
||||||
|
Recently, `git annex add` started adding files
|
||||||
|
to git, if annex.largefiles didn't match them.
|
||||||
|
|
||||||
|
So, it's possible to use that to add eg, source files. But it currently
|
||||||
|
skips symlinks (unless they're git-annex symlinks).
|
||||||
|
|
||||||
|
What I think makes sense to do is make it also process
|
||||||
|
symlinks, and always check them into git as-is. So, git-annex add becomes
|
||||||
|
like git-add except smart about adding large files to the annex.
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue