I got interested in why tester.tcl's repo_init command was failing to
keep the transient repositories used by test cases out of my fossil all
list, despite the fact that it deliberately sets $HOME to prevent that.
That led to the question of where are the environment variables used by
fossil documented, which led to the related question for global command
line options, of which there seem to be about 19 that are stripped out
in main() before the individual command is dispatched.
So I decided that rather than gripe about it, it would be a good use of
my tech-writing hat to just write the missing document.
The global command line options are easily identified by looking for
calls to find_option() starting at the top of main(), and tracing into a
few of the procedures like expand_args_option(). Figuring out what each
is actually for will require some research. A few are well described by
comments in the code, which helps.
Grepping for "getenv" quickly turns up fossil_getenv() as well as
similar wrappers specific to the JSON and SQLite libraries.
As I worked my way through all calls to fossil_getenv(), I fairly
quickly tripped over the likely reason for repo_init getting it wrong:
db_open_config() in db.c, if compiled for Windows, checks in order
FOSSIL_HOME, LOCALAPPDATA, APPDATA, HOMEDRIVE and HOMEPATH, then finally
HOME. In effect, the code in repo_init set an environment variable which
on Windows will never be read since all four of the Windows only
variables are set in an interactive Windows session.
So I can just fix repo_init by setting FOSSIL_HOME, right?
Well, probably. In shell.c, we have find_home_dir(), which is unaware of
FOSSIL_HOME. That only affects the fossil sqlite3 command, so that
difference is probably harmless.
I'm going to tweak repo_init to set both FOSSIL_HOME and HOME and push
that change, then go back to documenting options and environment
variables, and see what else turns up. With that change in place, it
appears that tester.tcl is no longer adding lots of repos and checkout
to fossil all on Windows. That change is now on trunk, at [dc72fd96].
My intent is to add a new embedded document titled Environment Variables
and Global Options. See the branch ross-doc-env for the work in
progress, which the skeleton of it has been added in www/env-opts.md and
included in the document index via mkindex.tcl.
--
Ross Berteig r...@cheshireeng.com
Cheshire Engineering Corp. http://www.CheshireEng.com/
+1 626 303 1602
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev