summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-04-07 00:58:51 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-04-07 00:58:51 -0400
commitd8394ede7b16d9aafcc19885f31d7935250a9bb6 (patch)
tree7615d95b51844b54cd37690206b045197f86c055
parent466a2c31be0f662c3c93dd54867d2a969e01714e (diff)
fromkey, registerurl: When reading from stdin, allow the filename and url, respectively, to contain whitespace.
-rw-r--r--Command/FromKey.hs4
-rw-r--r--Command/RegisterUrl.hs4
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex-fromkey.mdwn2
-rw-r--r--doc/git-annex-registerurl.mdwn2
5 files changed, 8 insertions, 6 deletions
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index 10484b840..ebc0e6f6e 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -41,10 +41,10 @@ start _ [] = do
start _ _ = error "specify a key and a dest file"
massAdd :: CommandPerform
-massAdd = go True =<< map words . lines <$> liftIO getContents
+massAdd = go True =<< map (separate (== ' ')) . lines <$> liftIO getContents
where
go status [] = next $ return status
- go status ([keyname,f]:rest) = do
+ go status ((keyname,f):rest) | not (null keyname) && not (null f) = do
let key = fromMaybe (error $ "bad key " ++ keyname) $ file2key keyname
ok <- perform' key f
let !status' = status && ok
diff --git a/Command/RegisterUrl.hs b/Command/RegisterUrl.hs
index 3ff1becc9..d0e806597 100644
--- a/Command/RegisterUrl.hs
+++ b/Command/RegisterUrl.hs
@@ -34,10 +34,10 @@ start [] = do
start _ = error "specify a key and an url"
massAdd :: CommandPerform
-massAdd = go True =<< map words . lines <$> liftIO getContents
+massAdd = go True =<< map (separate (== ' ')) . lines <$> liftIO getContents
where
go status [] = next $ return status
- go status ([keyname,u]:rest) = do
+ go status ((keyname,u):rest) | not (null keyname) && not (null u) = do
let key = fromMaybe (error $ "bad key " ++ keyname) $ file2key keyname
ok <- perform' key u
let !status' = status && ok
diff --git a/debian/changelog b/debian/changelog
index c61222c62..624b8a413 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ git-annex (5.20150406.2) UNRELEASED; urgency=medium
* --quiet now suppresses progress displays from eg, rsync.
(Second time's the charm..)
+ * fromkey, registerurl: When reading from stdin, allow the
+ filename and url, respectively, to contain whitespace.
-- Joey Hess <id@joeyh.name> Mon, 06 Apr 2015 20:14:20 -0400
diff --git a/doc/git-annex-fromkey.mdwn b/doc/git-annex-fromkey.mdwn
index b4adc9cea..9569c4211 100644
--- a/doc/git-annex-fromkey.mdwn
+++ b/doc/git-annex-fromkey.mdwn
@@ -13,7 +13,7 @@ in the git repository to link to a specified key.
If the key and file are not specified on the command line, they are
instead read from stdin. Any number of lines can be provided in this
-mode, each containing a key and filename, sepearated by whitespace.
+mode, each containing a key and filename, sepearated by a single space.
# OPTIONS
diff --git a/doc/git-annex-registerurl.mdwn b/doc/git-annex-registerurl.mdwn
index 0b988a457..961fcbba2 100644
--- a/doc/git-annex-registerurl.mdwn
+++ b/doc/git-annex-registerurl.mdwn
@@ -15,7 +15,7 @@ No verification is performed of the url's contents.
If the key and url are not specified on the command line, they are
instead read from stdin. Any number of lines can be provided in this
-mode, each containing a key and url, separated by whitespace.
+mode, each containing a key and url, separated by a single space.
# SEE ALSO