# # # patch "key_store.cc" # from [080dbb1a5cfa82f7c593bd47bf1d67e9ac1a5d70] # to [55878f97b03349c66d95398799780f43ae63165b] # # patch "lua_hooks.cc" # from [a0fdf89d1ea4d98296b17c758fd7b8e4b5bb8045] # to [a747d898e036539c69beba100f6a67e1491b6f96] # # patch "monotone.cc" # from [e7cb1f117494c4853f3320a4add02474b6a2ff6c] # to [266c0426128307bdcaf51fe1f8dd24cb8729b070] # # patch "options_list.hh" # from [3f798d9ddb7d778a6590afda9c371856feed5bcb] # to [78fbe7c5728513ee672b75d6dcefbc2f508ba915] # # patch "tests/commit_use_workspace_keydir/__driver__.lua" # from [8498a70d3c7d9d7c5c0e93ef159c97fbdb4484d4] # to [8b47f36be4add593ca4f7757385214f52f1f7eb0] # # patch "work.cc" # from [02fb2acdcae6902c334a4228807c141898af2d21] # to [9c9fd46396607ec971ccf77b6dbdfe54934b9ec5] # ============================================================ --- key_store.cc 080dbb1a5cfa82f7c593bd47bf1d67e9ac1a5d70 +++ key_store.cc 55878f97b03349c66d95398799780f43ae63165b @@ -59,7 +59,12 @@ struct key_store_state key_store_state(app_state & app) : key_dir(app.opts.key_dir), ssh_sign_mode(app.opts.ssh_sign), have_read(false), lua(app.lua) - {} + { + N(app.opts.key_dir_given + || app.opts.conf_dir_given + || !app.opts.no_default_confdir, + F("No available keystore found")); + } // internal methods void get_key_file(rsa_keypair_id const & ident, system_path & file); ============================================================ --- lua_hooks.cc a0fdf89d1ea4d98296b17c758fd7b8e4b5bb8045 +++ lua_hooks.cc a747d898e036539c69beba100f6a67e1491b6f96 @@ -64,9 +64,15 @@ extern "C" map::iterator i = map_of_lua_to_app.find(L); if (i != map_of_lua_to_app.end()) { - system_path dir = i->second->opts.conf_dir; - string confdir = dir.as_external(); - lua_pushstring(L, confdir.c_str()); + if (i->second->opts.conf_dir_given + || !i->second->opts.no_default_confdir) + { + system_path dir = i->second->opts.conf_dir; + string confdir = dir.as_external(); + lua_pushstring(L, confdir.c_str()); + } + else + lua_pushnil(L); } else lua_pushnil(L); @@ -198,7 +204,10 @@ lua_hooks::load_rcfiles(options & opts) if (!opts.norc) { - load_rcfile(opts.conf_dir / "monotonerc", false); + if (opts.conf_dir_given || !opts.no_default_confdir) + { + load_rcfile(opts.conf_dir / "monotonerc", false); + } load_rcfile(bookkeeping_root / "monotonerc", false); } ============================================================ --- monotone.cc e7cb1f117494c4853f3320a4add02474b6a2ff6c +++ monotone.cc 266c0426128307bdcaf51fe1f8dd24cb8729b070 @@ -242,7 +242,7 @@ cpp_main(int argc, char ** argv) global_sanity.set_dump_path(system_path(dump_path, false) .as_external()); } - else + else if (app.opts.conf_dir_given || !app.opts.no_default_confdir) global_sanity.set_dump_path((app.opts.conf_dir / "dump") .as_external()); ============================================================ --- options_list.hh 3f798d9ddb7d778a6590afda9c371856feed5bcb +++ options_list.hh 78fbe7c5728513ee672b75d6dcefbc2f508ba915 @@ -143,6 +143,14 @@ GOPT(conf_dir, "confdir", system_path, g } #endif +GOPT(no_default_confdir, "no-default-confdir", bool, false, + gettext_noop("forbid use of the default confdir")) +#ifdef option_bodies +{ + no_default_confdir = true; +} +#endif + OPT(date, "date", date_t, , gettext_noop("override date/time for commit")) #ifdef option_bodies ============================================================ --- tests/commit_use_workspace_keydir/__driver__.lua 8498a70d3c7d9d7c5c0e93ef159c97fbdb4484d4 +++ tests/commit_use_workspace_keydir/__driver__.lua 8b47f36be4add593ca4f7757385214f52f1f7eb0 @@ -13,7 +13,8 @@ function mtn_default_keydir(...) err("'mtn' environment variable not set") end end - return {monotone_path, "--norc", "--root=" .. test.root, "--db", "test.db", + return {monotone_path, "--no-default-confdir", + "--norc", "--root=" .. test.root, "--db", "test.db", "--rcfile", test.root .. "/test_hooks.lua", "address@hidden", unpack(arg)} end ============================================================ --- work.cc 02fb2acdcae6902c334a4228807c141898af2d21 +++ work.cc 9c9fd46396607ec971ccf77b6dbdfe54934b9ec5 @@ -460,6 +460,7 @@ workspace::get_ws_options(options & opts if (!opts.key_dir_given && !opts.conf_dir_given) { opts.key_dir = keydir_option; + opts.key_dir_given = true; } if (opts.branchname().empty() && !branch_option().empty())