From 0ac8912f9cd7c75b8ad5e7a6395cfe901bb1c6ff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 2 Mar 2014 16:00:56 -0400 Subject: [PATCH] view: Refuse to enter a view when no branch is currently checked out. --- Command/View.hs | 10 ++++------ debian/changelog | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Command/View.hs b/Command/View.hs index 155b6057d4..93b045c393 100644 --- a/Command/View.hs +++ b/Command/View.hs @@ -45,13 +45,11 @@ paramView :: String paramView = paramPair (paramRepeating "TAG") (paramRepeating "FIELD=VALUE") mkView :: [String] -> Annex View -mkView params = do - v <- View <$> viewbranch <*> pure [] - return $ fst $ refineView v $ - map parseViewParam $ reverse params +mkView params = go =<< inRepo Git.Branch.current where - viewbranch = fromMaybe (error "not on any branch!") - <$> inRepo Git.Branch.current + go Nothing = error "not on any branch!" + go (Just b) = return $ fst $ refineView (View b []) $ + map parseViewParam $ reverse params checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup checkoutViewBranch view mkbranch = do diff --git a/debian/changelog b/debian/changelog index 6124ba1350..edbe3bab6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ git-annex (5.20140228) UNRELEASED; urgency=medium * view, vfilter: Add support for filtering tags and values out of a view, using !tag and field!=value. * vadd: Allow listing multiple desired values for a field. + * view: Refuse to enter a view when no branch is currently checked out. -- Joey Hess Fri, 28 Feb 2014 14:52:15 -0400