Fossil Forum

fossil open: directory ... not empty
Login

fossil open: directory ... not empty

(1) By Peter MacDonald (pmacdona) on 2021-04-04 17:51:42 [source]

A recent change to fossil (2.15?) is the check for empty directory in "fossil open".

Unfortunately, we commonly put the .fossil file in this same directory, eg: Sqlite README.md

Wouldn't it make sense to exclude the single file argument to "fossil open", rather than require the "-f" flag.

(Apologies if this is a dup).

Peter

(2) By Peter MacDonald (pmacdona) on 2021-04-05 02:13:07 in reply to 1 [link] [source]

A little more info.

This feature was implemented in 2.12, where (according to the changelog) "open" now accepts a url to implicitly do the clone, which will be great when everyone is at version 2.12+.

Unfortunately,

  • using "fossil open sqlite.fossil" for version >= 2.12 will break
  • using "fossil open -f" for version < 2.12 will break
  • using "fossil open URL" for version < 2.12 will break

This makes it difficult to provide instructions that work with all fossil versions, short of putting the .fossil file out of dir, which is not convenient.

(3) By Kees Nuyt (knu) on 2021-04-05 02:41:04 in reply to 2 [link] [source]

This makes it difficult to provide instructions that work with all fossil versions, short of putting the .fossil file out of dir, which is not convenient.

Maybe you can put the .fossil file in a subdir, and exclude that subdir using the ignore-glob setting.

(untested, all my fossils live happily in ~/var/fossil/repo/)

(4) By Peter MacDonald (pmacdona) on 2021-04-05 14:09:55 in reply to 3 [link] [source]

Thanks for the suggestion, but that doesn't address the "installation instructions" problem, as evidenced in the Sqlite README.md.

(5) By Peter MacDonald (pmacdona) on 2021-04-05 15:44:27 in reply to 2 [link] [source]

I've found a solution that works for both old and new versions of fossil:

   fossil clone https://jsish.org/jsish .jsish.fossil
   fossil open .jsish.fossil

However, it is an inconsistency that:

   fossil extras
   fossil add .

ignores the .fossil file, while "open" does not.

(6) By Martin Gagnon (mgagnon) on 2021-04-05 20:48:21 in reply to 5 [link] [source]

However, it is an inconsistency that:

  fossil extras
  fossil add .
ignores the .fossil file, while "open" does not.

I think open should not necessarily behave the same way because
it can potentially generate a lot of files in the current directory and can overwrite un-managed files.

I suggest that "fossil open" only ignore the actual repository file it is opening. If any other file exist, it complain and require -f just like now.

  • Since it is a common (even if not recommended) practice to have the repository file inside the checkout, assuming there's only 1 checkout when working this way.
    (I believe this would cover normal use cases)

  • For the other cases:

    • I don't see a case where someone would want to open a repo where unrelated .fossil files are present.
    • If someone want to re-open a repo on top of a previously closed checkout, I think the requirement of the -f is a good thing.
      (The user have to think if he need to specify --keep or if he want a specific version.)

(7) By Peter MacDonald (pmacdona) on 2021-04-05 21:59:26 in reply to 6 [link] [source]

Note that I said "the .fossil file" not "all .fossil files".

And in the original message I said:

Wouldn't it make sense to exclude the single file argument to "fossil open", rather than require the "-f" flag.

So I guess we agree.

(8) By jamsek on 2021-04-05 23:31:31 in reply to 5 [link] [source]

It’s not so much an inconsistency; use the dotfiles option to not ignore dot files with extras and add.

I agree that the repository file should be ignored when it’s the only file in the directory, allowing fossil open to proceed without --force.

(9) By Martin Gagnon (mgagnon) on 2021-04-06 16:12:40 in reply to 7 [link] [source]

Yes sorry you're right, I've read this thread a bit too fast, at the end we agree 100%.

FYI: drh made the change this checkin 61132cefacba2ea1 on trunk.