# # # patch "cmd_key_cert.cc" # from [8dcd07a96d97128da87ec9ce83eb4af2fc821e70] # to [3f83e4d78d26403f3bd1bd7678bdc9974062a382] # # patch "cmd_packet.cc" # from [98a32aaad46f8cf84693763f0e38a5bad1075018] # to [f57bd280b4fd045e3b8fbfecd1895dfadcc6c085] # # patch "keys.cc" # from [75f5f73ce24d06021d81dfcd7c9543fe20eaf45a] # to [aad56d75a7a76ff4967092c3d5b117a20b8b005e] # # patch "lua_hooks.cc" # from [0662b9925c66ea83b054c66a235724549b84f984] # to [444472cf22fb641b19b5e442837f44e70be0cbca] # # patch "lua_hooks.hh" # from [56a7bcc44bd23784e58d85e10b00c0c0baee22c9] # to [37e9103e9a88710298ca7a580019e02c9d37062f] # # patch "network/netsync_session.cc" # from [78db6255ceae5c7498ddc809ced510826d479a93] # to [d7af9e2a685303483690bfa2459f6a6a2faf49f4] # # patch "project.cc" # from [05a19fbf28d1739f79ba4b6308e8f12da4865199] # to [36af81e92ec20535f5c3eb627c324786824602b7] # # patch "project.hh" # from [92a156f9191c7078bbe9942fa9ad223e97f59898] # to [7cf24214e3b5069f0b67b297fea0ca466d298a7b] # ============================================================ --- cmd_key_cert.cc 8dcd07a96d97128da87ec9ce83eb4af2fc821e70 +++ cmd_key_cert.cc 3f83e4d78d26403f3bd1bd7678bdc9974062a382 @@ -72,7 +72,7 @@ CMD(dropkey, "dropkey", "", CMD_REF(key_ key_identity_info identity; project_t project(db, app.lua, app.opts); - project.get_key_identity(keys, app.lua, app.opts, + project.get_key_identity(keys, app.lua, typecast_vocab(idx(args, 0)), identity); @@ -119,7 +119,7 @@ CMD(passphrase, "passphrase", "", CMD_RE project_t project(db, app.lua, app.opts); key_identity_info identity; - project.get_key_identity(keys, app.lua, app.opts, + project.get_key_identity(keys, app.lua, typecast_vocab(idx(args, 0)), identity); @@ -237,7 +237,7 @@ CMD(trusted, "trusted", "", CMD_REF(key_ for (unsigned int i = 3; i != args.size(); ++i) { key_identity_info identity; - project.get_key_identity(keys, app.lua, app.opts, + project.get_key_identity(keys, app.lua, typecast_vocab(idx(args, i)), identity); signers.insert(identity); ============================================================ --- cmd_packet.cc 98a32aaad46f8cf84693763f0e38a5bad1075018 +++ cmd_packet.cc f57bd280b4fd045e3b8fbfecd1895dfadcc6c085 @@ -37,7 +37,7 @@ CMD(pubkey, "pubkey", "", CMD_REF(packet project_t project(db, app.lua, app.opts); key_identity_info identity; - project.get_key_identity(keys, app.lua, app.opts, + project.get_key_identity(keys, app.lua, typecast_vocab(idx(args, 0)), identity); bool exists(false); @@ -75,7 +75,7 @@ CMD(privkey, "privkey", "", CMD_REF(pack key_name name = typecast_vocab(idx(args, 0)); key_identity_info identity; - project.get_key_identity(app.lua, app.opts, + project.get_key_identity(app.lua, typecast_vocab(idx(args, 0)), identity); E(keys.key_pair_exists(identity.id), origin::user, ============================================================ --- keys.cc 75f5f73ce24d06021d81dfcd7c9543fe20eaf45a +++ keys.cc aad56d75a7a76ff4967092c3d5b117a20b8b005e @@ -133,7 +133,7 @@ get_user_key(options const & opts, lua_h if (!opts.signing_key().empty()) { key_identity_info identity; - project.get_key_identity(keys, lua, opts, + project.get_key_identity(keys, lua, opts.signing_key, identity); key = identity.id; } @@ -144,7 +144,7 @@ get_user_key(options const & opts, lua_h "was given with an empty argument")); } } - else if (lua.hook_get_branch_key(opts, keys, project, key)) + else if (lua.hook_get_branch_key(opts.branch, keys, project, key)) ; // the lua hook sets the key else { @@ -181,13 +181,13 @@ cache_netsync_key(options const & opts, // maybe they specifically requested no key ("--key ''") if (!opts.signing_key().empty()) { - project.get_key_identity(keys, lua, opts, + project.get_key_identity(keys, lua, opts.signing_key, identity); key = identity.id; found_key = true; } } - else if (lua.hook_get_netsync_key(host, include, exclude, keys, project, opts, key)) + else if (lua.hook_get_netsync_key(host, include, exclude, keys, project, key)) { found_key = true; } ============================================================ --- lua_hooks.cc 0662b9925c66ea83b054c66a235724549b84f984 +++ lua_hooks.cc 444472cf22fb641b19b5e442837f44e70be0cbca @@ -359,7 +359,7 @@ bool } bool -lua_hooks::hook_get_branch_key(options const & opts, +lua_hooks::hook_get_branch_key(branch_name const & branchname, key_store & keys, project_t & project, key_id & k) @@ -367,7 +367,7 @@ lua_hooks::hook_get_branch_key(options c string key; bool ok = Lua(st) .func("get_branch_key") - .push_str(opts.branch()) + .push_str(branchname()) .call(1,1) .extract_str(key) .ok(); @@ -377,7 +377,7 @@ lua_hooks::hook_get_branch_key(options c else { key_identity_info identity; - project.get_key_identity(keys, *this, opts, + project.get_key_identity(keys, *this, external_key_name(key, origin::user), identity); k = identity.id; return true; @@ -805,7 +805,6 @@ lua_hooks::hook_get_netsync_key(utf8 con globish const & exclude, key_store & keys, project_t & project, - options const & opts, key_id & k) { string name; @@ -824,7 +823,7 @@ lua_hooks::hook_get_netsync_key(utf8 con else { key_identity_info identity; - project.get_key_identity(keys, *this, opts, + project.get_key_identity(keys, *this, external_key_name(name, origin::user), identity); k = identity.id; return true; ============================================================ --- lua_hooks.hh 56a7bcc44bd23784e58d85e10b00c0c0baee22c9 +++ lua_hooks.hh 37e9103e9a88710298ca7a580019e02c9d37062f @@ -57,7 +57,7 @@ public: // cert hooks bool hook_expand_selector(string const & sel, string & exp); bool hook_expand_date(string const & sel, string & exp); - bool hook_get_branch_key(options const & opts, + bool hook_get_branch_key(branch_name const & branchname, key_store & keys, project_t & project, key_id & k); bool hook_get_passphrase(key_identity_info const & info, @@ -91,7 +91,6 @@ public: globish const & exclude, key_store & keys, project_t & project, - options const & opts, key_id & k); bool hook_get_netsync_connect_command(uri_t const & uri, globish const & include_pattern, ============================================================ --- network/netsync_session.cc 78db6255ceae5c7498ddc809ced510826d479a93 +++ network/netsync_session.cc d7af9e2a685303483690bfa2459f6a6a2faf49f4 @@ -106,7 +106,7 @@ netsync_session::netsync_session(session i != opts.keys_to_push.end(); ++i) { key_identity_info ident; - project.get_key_identity(keys, lua, opts, *i, ident); + project.get_key_identity(keys, lua, *i, ident); keys_to_push.push_back(ident.id); } } ============================================================ --- project.cc 05a19fbf28d1739f79ba4b6308e8f12da4865199 +++ project.cc 36af81e92ec20535f5c3eb627c324786824602b7 @@ -628,15 +628,15 @@ operator<<(std::ostream & os, return os; } - +branch_name const empty_branch_name; project_t::project_t(database & db) - : db(db) + : db(db), branch_option(empty_branch_name) { project_policy.reset(new policy_info()); } project_t::project_t(database & db, lua_hooks & lua, options & opts) - : db(db) + : db(db), branch_option(opts.branch) { shared_ptr bp(new policies::base_policy(opts, lua)); project_policy.reset(new policy_info(bp->empty(), bp)); @@ -1580,7 +1580,6 @@ project_t::get_key_identity(key_store * void project_t::get_key_identity(key_store * const keys, lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const { @@ -1592,13 +1591,13 @@ project_t::get_key_identity(key_store * // above throw recoverable_failure instead of unrecoverable_failure ident.made_from = input.made_from; output.id = key_id(ident); - complete_key_identity_from_id(keys, lua, opts.branch, output); + complete_key_identity_from_id(keys, lua, branch_option, output); return; } catch (recoverable_failure &) { output.official_name = typecast_vocab(input); - lookup_key_by_name(keys, lua, opts.branch, output.official_name, output.id); + lookup_key_by_name(keys, lua, branch_option, output.official_name, output.id); get_given_name_of_key(keys, output.id, output.given_name); return; } @@ -1607,20 +1606,18 @@ project_t::get_key_identity(key_store & void project_t::get_key_identity(key_store & keys, lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const { - get_key_identity(&keys, lua, opts, input, output); + get_key_identity(&keys, lua, input, output); } void project_t::get_key_identity(lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const { - get_key_identity(0, lua, opts, input, output); + get_key_identity(0, lua, input, output); } ============================================================ --- project.hh 92a156f9191c7078bbe9942fa9ad223e97f59898 +++ project.hh 7cf24214e3b5069f0b67b297fea0ca466d298a7b @@ -126,6 +126,8 @@ private: mutable std::set branches; mutable outdated_indicator indicator; + branch_name const & branch_option; + explicit project_t(database & db); public: project_t(database & db, lua_hooks & lua, options & opts); @@ -248,7 +250,6 @@ private: key_identity_info & info) const; void get_key_identity(key_store * const keys, lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const; public: @@ -261,11 +262,9 @@ public: key_identity_info & info) const; void get_key_identity(key_store & keys, lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const; void get_key_identity(lua_hooks & lua, - options const & opts, external_key_name const & input, key_identity_info & output) const; };