Fossil User Forum

fossil close: argument and --hard flag
Login

fossil close: argument and --hard flag

fossil close: argument and --hard flag

(1) By PoolloverNathan (poollovernathan) on 2025-03-23 04:05:29 [link] [source]

I have two feature requests for the fossil close command:

  • Make it optionally take a directory name to close.
    This allows quickly closing many checkouts without entering each checkout individually. Additionally, the command will error when passed a revision, which helps users that confuse fossil close and fossil amend --close.
  • --hard flag to delete the checkout entirely.
    This flag, which mirrors fossil mv --hard and fossil rm --hard, will delete the entire checkout after closing, like rm -rf. If the directory name was given, it will delete the directory as well, otherwise it will leave it empty.

(2) By Stephan Beal (stephan) on 2025-03-23 04:53:59 in reply to 1 [link] [source]

Make it optionally take a directory name to close.

"close" is unnecessary - simply rm the .fslckout file (or _FOSSIL_ on Windows).

--hard flag to delete the checkout entirely

Similarly, just rm -fr the dir.

"close" is arguably fossil's least useful command.

(3) By Florian Balmer (florian.balmer) on 2025-03-23 06:14:30 in reply to 1 [link] [source]

Make it optionally take a directory name to close.

This is indeed handy, and already there! Try:

fossil close --chdir <DIRECTORY>

(4) By Florian Balmer (florian.balmer) on 2025-03-23 06:20:15 in reply to 2 [link] [source]

"close" is unnecessary - simply rm the .fslckout file (or _FOSSIL_ on Windows).

I think fossil close also updates the bookkeeping of global repositories and check-outs, so that commands like fossil all close etc. know what to do.

The same is probably valid when just deleting a check-out directory entirely, without closing it first, maybe fossil all server still lists the deleted repository? (Not sure.)

(5) By Florian Balmer (florian.balmer) on 2025-03-23 06:21:00 in reply to 2 [link] [source]

Plus, close warns about uncommitted changes!

(6) By Florian Balmer (florian.balmer) on 2025-03-23 06:40:47 in reply to 1 [link] [source]

BTW: fossil close is one of the Fossil commands with a reliable exit code, i.e. returns 0 if closing the repository was successful, and 1 if there are uncommitted modifications. So writing a script or alias to close and remove the check-out tree in one go is easy. (I also have it).

(7) By Stephan Beal (stephan) on 2025-03-23 11:14:26 in reply to 4 [link] [source]

I think fossil close also updates the bookkeeping of global repositories and check-outs, so that commands like fossil all close etc. know what to do.

It does, but that bookkeeping is updated automatically as needed. Failing to close a repo has, in effect, no side effects on fossil's behavior.

maybe fossil all server still lists the deleted repository? (Not sure.)

Nope. Fossil sees that it's not there and ignores it. IIRC (but i'm on a tablet so won't confirm this), it also cleans up such entires automatically when it comes across them.

(8) By Florian Balmer (florian.balmer) on 2025-03-23 18:35:00 in reply to 5 [source]

Plus, close warns about a non-empty stash!