Fossil Forum

Syntax question relating to ignore-glob settings
Login

Syntax question relating to ignore-glob settings

Syntax question relating to ignore-glob settings

(1) By Bumpyride on 2023-11-03 08:43:50 [link] [source]

To make the Fossil equivalent of .gitignore versionable, I followed the docs and created (on Windows) an <app root>\.fossil-settings\ignore-glob file.

Before running fossil add * and then fossil commit -m "Initial commit", I wanted to check that I used the correct glob patterns in my ignore-glob file. Most exclusions are subfolders located at <app root> and everything in them. For example, I use two lines for the IDE and same again for a dev data folder:

.idea
.idea/*
testdata
testdata/*

According to the docs, ignore-glob will only match on the entire file name.

A pattern must consume and match the entire file name to succeed. Partial matches are failed matches.

I interpret this to mean that a folder needs to be specified explicitly and I assume that just testdata/* on its own would ignore the content but still include the folder?

Is this the "Fossilic" way to do this? I'd hate to delete the Fosile repo and start again from scratch, including server settings... 😉

(2) By Florian Balmer (florian.balmer) on 2023-11-03 10:59:17 in reply to 1 [link] [source]

I'm sorry I can't answer your questions, but also see:

(3) By Florian Balmer (florian.balmer) on 2023-11-03 11:06:10 in reply to 2 [link] [source]

Oops, it seems you already read the referenced document.

(4) By Warren Young (wyoung) on 2023-11-03 11:08:32 in reply to 1 [source]

testdata/* on its own would ignore the content but still include the folder?

Fossil tracks files, not directories. You have to go well out of your way to get Fossil to create empty directories for you on check-out.

Thus, you have twice as many ignore rules as you need.

Another detail you might be missing is that in Fossil's glob processing, a wildcard doesn't stop at the next directory separator, as it does in a Unix command shell. Your .idea/* glob would match .idea/foo/bar/baz.qux.

I'd hate to delete the Fosile repo and start again from scratch, including server settings...

You're showing off your Git scars again. 😔 Nothing in Fossil would make you start over like that.

The biggest reason why not is that Fossil doesn't do blind commits to the local repo, requiring you to do surgery on it before pushing lest the error propagate. Changes are "staged" — to use the Git terminology — in the check-out directory only, allowing you to examine them before committing. In this case, saying:

  fossil status
  fossil extras

…would let you see what is about to happen, telling you which files will be committed and which won't. Another useful command is fossil changes, including its various flags, though I find that more useful in scripts, since its output doesn't depend on clever string parsing, as when using fossil status instead.

(5) By Bumpyride on 2023-11-03 17:02:41 in reply to 4 [link] [source]

Your .idea/* glob would match .idea/foo/bar/baz.qux

Understood. But would it also match just .idea (the folder)?

If I want to ignore-glob a folder and everything in it, which would be correct?

fossil ignore-glob some_folder
fossil ignore-glob some_folder/*?

(6) By Warren Young (wyoung) on 2023-11-03 17:12:15 in reply to 5 [link] [source]

Given that I've already told you that Fossil doesn't track directories, what meaning can your question have? Effectively, all directories are already on the ignore list.

The first glob has no effect since some_folder cannot cannot be a version-tracked file if it is a directory.

The second glob ignores everything inside the directory, including files in nested sub-directories beneath it, ad infinitum.