# # # patch "cmd_ws_commit.cc" # from [c0319758a2916fcc143034a54b5e99f886714a94] # to [78d1bd0388216eb6432592e8ab13d9e324e130e3] # # patch "keys.cc" # from [c422791c7c491e8cd0360ddc4f93f2a59b8651ae] # to [5386aa43615c285d97e17fdd21b03cd5b09c07c9] # # patch "keys.hh" # from [f48a9a4a28dd60cc8b89cb4f0fc9ecf0dd8613c9] # to [35604a1e63822b6016658e0ce80516ac38b2e8a9] # # patch "tests/wrong_options_override_workspace_options/__driver__.lua" # from [62b4258966df10f7a9073b00bc0c2d621a19128b] # to [2eca2a366ffcfaf6b8cf9d33b52ca06e55c4fa7c] # ============================================================ --- cmd_ws_commit.cc c0319758a2916fcc143034a54b5e99f886714a94 +++ cmd_ws_commit.cc 78d1bd0388216eb6432592e8ab13d9e324e130e3 @@ -780,8 +780,8 @@ CMD(status, "status", "", CMD_REF(inform key_store keys(app); key_identity_info key; - get_user_key(app.opts, app.lua, db, keys, project, key.id); - project.complete_key_identity(app.lua, key); + get_user_key(app.opts, app.lua, db, keys, project, key.id, false); + project.complete_key_identity(keys, app.lua, key); if (!app.lua.hook_get_author(app.opts.branch, key, author)) author = key.official_name(); @@ -1380,8 +1380,8 @@ CMD(commit, "commit", "ci", CMD_REF(work if (author.empty()) { key_identity_info key; - get_user_key(app.opts, app.lua, db, keys, project, key.id); - project.complete_key_identity(app.lua, key); + get_user_key(app.opts, app.lua, db, keys, project, key.id, false); + project.complete_key_identity(keys, app.lua, key); if (!app.lua.hook_get_author(app.opts.branch, key, author)) author = key.official_name(); ============================================================ --- keys.cc c422791c7c491e8cd0360ddc4f93f2a59b8651ae +++ keys.cc 5386aa43615c285d97e17fdd21b03cd5b09c07c9 @@ -118,7 +118,8 @@ get_user_key(options const & opts, lua_h void get_user_key(options const & opts, lua_hooks & lua, database & db, key_store & keys, - project_t & project, key_id & key) + project_t & project, key_id & key, + bool const cache) { if (keys.have_signing_key()) { @@ -149,7 +150,8 @@ get_user_key(options const & opts, lua_h get_only_key(keys, true, key); } - check_and_save_chosen_key(db, keys, key); + if (cache) + check_and_save_chosen_key(db, keys, key); } void ============================================================ --- keys.hh f48a9a4a28dd60cc8b89cb4f0fc9ecf0dd8613c9 +++ keys.hh 35604a1e63822b6016658e0ce80516ac38b2e8a9 @@ -26,11 +26,12 @@ class globish; // big and this stuff "feels" different, imho. // Find the key to be used for signing certs. If possible, ensure the -// database and the key_store agree on that key, and cache it in decrypted -// form, so as not to bother the user for their passphrase later. +// database and the key_store agree on that key, and optionally cache it in +// decrypted form, so as not to bother the user for their passphrase later. void get_user_key(options const & opts, lua_hooks & lua, database & db, key_store & keys, - project_t & project, key_id & key); + project_t & project, key_id & key, + bool const cache = true); // As above, but does not report which key has been selected; for use when // the important thing is to have selected one and cached the decrypted key. ============================================================ --- tests/wrong_options_override_workspace_options/__driver__.lua 62b4258966df10f7a9073b00bc0c2d621a19128b +++ tests/wrong_options_override_workspace_options/__driver__.lua 2eca2a366ffcfaf6b8cf9d33b52ca06e55c4fa7c @@ -27,9 +27,7 @@ writefile("not_a_dir", "bla") check(mtn_ws_opts("attr", "set", ".", "foo", "bar"), 0, false, false) writefile("not_a_dir", "bla") --- status needs to be able to get the key to display an Author: header but is --- unable to do so with a bad key dir -check(mtn_ws_opts("status", "--keydir", "not_a_dir"), 1, false, false) +check(mtn_ws_opts("status", "--keydir", "not_a_dir"), 0, false, false) check(mtn_ws_opts("commit", "-m", "another test"), 0, false, false)