webapp: When $HOME is a git repository, and has been initialized for use by git-annex, opening the webapp went ahead and ran the assistant there, annexing all files. Since this is almost certianly not desirable, especially when the user is just opening the webapp from a dekstop menu which happens to run it in $HOME, the webapp will now not treat such a $HOME git repository as a git-annex repository.
This commit is contained in:
parent
fe1628db11
commit
1010482bc7
4 changed files with 43 additions and 1 deletions
|
@ -22,6 +22,7 @@ import Utility.Daemon (checkDaemon)
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
#endif
|
#endif
|
||||||
|
import Utility.UserInfo
|
||||||
import Annex.Init
|
import Annex.Init
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
|
@ -60,7 +61,7 @@ start = start' True
|
||||||
start' :: Bool -> WebAppOptions -> CommandStart
|
start' :: Bool -> WebAppOptions -> CommandStart
|
||||||
start' allowauto o = do
|
start' allowauto o = do
|
||||||
liftIO ensureInstalled
|
liftIO ensureInstalled
|
||||||
ifM isInitialized
|
ifM (isInitialized <&&> notHome)
|
||||||
( maybe notinitialized (go <=< needsUpgrade) =<< getVersion
|
( maybe notinitialized (go <=< needsUpgrade) =<< getVersion
|
||||||
, if allowauto
|
, if allowauto
|
||||||
then liftIO $ startNoRepo o
|
then liftIO $ startNoRepo o
|
||||||
|
@ -99,6 +100,15 @@ start' allowauto o = do
|
||||||
liftIO $ cannotStartIn (Git.repoLocation g) "repository has not been initialized by git-annex"
|
liftIO $ cannotStartIn (Git.repoLocation g) "repository has not been initialized by git-annex"
|
||||||
liftIO $ firstRun o
|
liftIO $ firstRun o
|
||||||
|
|
||||||
|
{- If HOME is a git repo, even if it's initialized for git-annex,
|
||||||
|
- the user almost certianly does not want to run the assistant there. -}
|
||||||
|
notHome :: Annex Bool
|
||||||
|
notHome = do
|
||||||
|
g <- Annex.gitRepo
|
||||||
|
d <- liftIO $ absPath (Git.repoLocation g)
|
||||||
|
h <- liftIO $ absPath =<< myHomeDir
|
||||||
|
return (d /= h)
|
||||||
|
|
||||||
{- When run without a repo, start the first available listed repository in
|
{- When run without a repo, start the first available listed repository in
|
||||||
- the autostart file. If none, it's our first time being run! -}
|
- the autostart file. If none, it's our first time being run! -}
|
||||||
startNoRepo :: WebAppOptions -> IO ()
|
startNoRepo :: WebAppOptions -> IO ()
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -2,6 +2,12 @@ git-annex (6.20160413) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* smudge: Print a warning when annex.thin is set, as git's smudge
|
* smudge: Print a warning when annex.thin is set, as git's smudge
|
||||||
interface does not allow honoring that configuration.
|
interface does not allow honoring that configuration.
|
||||||
|
* webapp: When $HOME is a git repository, and has been initialized for
|
||||||
|
use by git-annex, opening the webapp went ahead and ran the assistant
|
||||||
|
there, annexing all files. Since this is almost certianly not
|
||||||
|
desirable, especially when the user is just opening the webapp from
|
||||||
|
a dekstop menu which happens to run it in $HOME, the webapp will now not
|
||||||
|
treat such a $HOME git repository as a git-annex repository.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 13 Apr 2016 13:30:32 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 13 Apr 2016 13:30:32 -0400
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,5 @@ The assistant shouldn't do anything unless I tell it to. Currently, I cannot pla
|
||||||
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
|
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
|
||||||
|
|
||||||
I use git annex for managing the image and video resources on my website and it works fine for that.
|
I use git annex for managing the image and video resources on my website and it works fine for that.
|
||||||
|
|
||||||
|
> HOME git repo guard added, [[done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 6"""
|
||||||
|
date="2016-04-13T17:43:34Z"
|
||||||
|
content="""
|
||||||
|
So, I see that you *did* tell git-annex to treat your home git repo as a
|
||||||
|
git-annex repo.
|
||||||
|
|
||||||
|
And, starting the the assistant/webapp from inside a git annex repository is
|
||||||
|
intended to start them running in that repository. This behavior makes a
|
||||||
|
lot of sense in general. It's consistent with running any other git command
|
||||||
|
inside a git repository causing that command to run on that repository.
|
||||||
|
|
||||||
|
I guess that the issue here is, opening the git-annex webapp from a menu
|
||||||
|
causes the program to run with its working directory set to HOME. But in
|
||||||
|
this case, the HOME is only incidental, the intent is not to start the
|
||||||
|
webapp/assistant in that repository.
|
||||||
|
|
||||||
|
Seems kind of hard for the assistant to determine intent though.
|
||||||
|
|
||||||
|
So, the best that can be done, I suppose, is to make starting the webapp
|
||||||
|
in the HOME git repository behave as if that git repository was not
|
||||||
|
initialized for use by git-annex.
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue