Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan for the Fossil checkout database instead of the config or repo database #1022

Closed
michaelbartnett opened this issue Jun 28, 2016 · 5 comments

Comments

@michaelbartnett
Copy link
Contributor

michaelbartnett commented Jun 28, 2016

Same problem as #865, but I think projectile is doing the wrong thing here.

Expected behavior

Project without a VCS is able to list files when Fossil is installed, and there is a global fossil configuration database in the usual location.

Actual behavior

Projectile interprets Fossil's global configuration database as a VCS checkout since it's located at ~/.fossil:

https://www.fossil-scm.org/index.html/doc/trunk/www/tech_overview.wiki

This means that any non-VCS project created under my home directory can't list files correctly, reporting:
current directory is not within an open checkout.

Steps to reproduce the problem

  1. Install Fossil

  2. Init a fossil repo somewhere so that the configuration database will be created

    $ mkdir -p ~/fossiltest; fossil init ~/fossiltest/repo.fossil
    project-id: 868fc417a7e390fdf7e08477818fb622f20a3dcd
    server-id:  db6776f380a9a3e01dac6560e1f7ffacd8daa686
    admin-user: michaelbartnett (initial password is "3f417d")
    $ ls ~/.fossil
    /Users/michaelbartnett/.fossil
    $ rm -Rf ~/fossiltest
  3. Start a new projectile project and a file in it

$ mkdir ~/testproject
$ touch ~/testproject/.projectile
$ echo "test 1" > ~/testproject/test_1.txt
$ echo "test 2" > ~/testproject/test_2.txt
$ emacs ~/testproject/test_1.txt
  1. Try to open the other file in the project (C-c p f). Instead of a file list, you'll see this message that projectile forwards from fossil:

    current directory is not within an open checkout
    

Environment & Version information

Note: fossil installed via homebrew. Probably not relevant.

Projectile version information

Projectile version: 20160623.23

Emacs version

GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)

Operating system

MacOS 10.9.5

My Workaround

Special casing fossil in projectile-project-vcs to ignore a .fossil file if it's in the home directory worked for me. I don't know how portable using (expand-file-name "./" "~") is.

(defun projectile-project-vcs (&optional project-root)
  "Determine the VCS used by the project if any.
PROJECT-ROOT is the targeted directory.  If nil, use
`projectile-project-root'."
  (or project-root (setq project-root (projectile-project-root)))
  (cond
   ((projectile-file-exists-p (expand-file-name ".git" project-root)) 'git)
   ((projectile-file-exists-p (expand-file-name ".hg" project-root)) 'hg)
   ((projectile-file-exists-p (expand-file-name ".fossil" project-root)) 'fossil)
   ((projectile-file-exists-p (expand-file-name ".bzr" project-root)) 'bzr)
   ((projectile-file-exists-p (expand-file-name "_darcs" project-root)) 'darcs)
   ((projectile-file-exists-p (expand-file-name ".svn" project-root)) 'svn)
   ((projectile-locate-dominating-file project-root ".git") 'git)
   ((projectile-locate-dominating-file project-root ".hg") 'hg)

   ;; Changes
   ;; ((projectile-locate-dominating-file project-root ".fossil") 'fossil)
   ((let ((dominating-dir (projectile-locate-dominating-file project-root ".fossil")))
      (not (equal dominating-dir (expand-file-name "./" "~"))))
    'fossil)

   ((projectile-locate-dominating-file project-root ".bzr") 'bzr)
   ((projectile-locate-dominating-file project-root "_darcs") 'darcs)
   ((projectile-locate-dominating-file project-root ".svn") 'svn)
   (t 'none)))
@npostavs
Copy link

Shouldn't projectile be looking for _FOSSIL_ or .fslckout, instead of .fossil? See fossil_reserved_name in add.c.

@michaelbartnett
Copy link
Contributor Author

michaelbartnett commented Jul 14, 2016

That's the checkout database, which is different from the repository database.

The documentation implies that common practice is to name the repo database as "project-name.fossil": http://fossil-scm.org/index.html/doc/trunk/www/tech_overview.wiki

I don't use fossil often enough to know if people follow that convention or a different one.

@npostavs
Copy link

That's the checkout database,

Yes, exactly. The checkout, where all the code for your project is checked out. .fslckout is equivalent to the .svn directory, and ~/.fossil is like ~/.subversion.

Personally, I have my repository databases stored in one directory, as in fossil.d/project1-name.fossil, fossil.d/project2-name.fossil... That way I can run fossil serve --localauth fossil.d and get a list of all projects.

The documentation implies that common practice is to name the repo database as "project-name.fossil": http://fossil-scm.org/index.html/doc/trunk/www/tech_overview.wiki

I don't use fossil often enough to know if people follow that convention or a different one.

Regardless, I don't think anybody names it literally .fossil, as it seems projectile is searching for.

@michaelbartnett
Copy link
Contributor Author

Oh! I see now, you're totally right. It should be looking for .fslckout or _FOSSIL_. Is _FOSSIL_ the name on windows?

@npostavs
Copy link

_FOSSIL_ is the older name, it was renamed to .fslckout at some point, not sure exactly when, but existing checkouts still use the older _FOSSIL_ name regardless of fossil version.

@michaelbartnett michaelbartnett changed the title Projectile thinks the Fossil global config is a project, and it messes up non-VCS projects Scan for the Fossil checkout database instead of the config or repo database Jul 15, 2016
michaelbartnett added a commit to michaelbartnett/projectile that referenced this issue Jul 15, 2016
The fossil checkout database is named `.fslckout` or `_FOSSIL_`, not
`.fossil`. Searching for a dominating .fossil file would just find
`~/.fossil`, which is Fossil's user config database.
michaelbartnett added a commit to michaelbartnett/projectile that referenced this issue Jul 15, 2016
The fossil checkout database is named `.fslckout` or `_FOSSIL_`, not
`.fossil`. Searching for a dominating .fossil file would just find
`~/.fossil`, which is Fossil's user config database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants