/* * ======== dbll_init ======== */ bool dbll_init(void) { DBC_REQUIRE(refs >= 0); if (refs == 0) gh_init(); refs++; return true; }
int main(int argc, char * argv[]) { try { cmdline args(cmdline_entries, std::end(cmdline_entries), argc - 1, argv + 1); bool profile = args.pop_switch(gh_opts::time); std::string cmd = args.pop_string(gh_opts::cmd); int profile_repeat = atoi(args.pop_string(gh_opts::profile).c_str()); int r = 1; for (int i = 0; i < profile_repeat; ++i) { timer tmr(profile); cmdline subargs = args; if (cmd == "init") { r = gh_init(subargs); } else if (cmd == "test-checkout") { subargs.set_subparser(gh_subparser::test_checkout); gitdb db0; db0.open(subargs.pop_string(gh_opts::repo, ".")); object_id head_oid = db0.get_ref(subargs.pop_string(gh_opts::ref)); gitdb::commit_t cc = db0.get_commit(head_oid); checkout_tree(db0, subargs.pop_string(gh_opts::wd_dir), db0.get_tree(cc.tree_oid)); r = 0; } else if (cmd == "st" || cmd == "status") { r = gh_status(subargs); } } return r; } catch (std::exception const & e) { std::cerr << "error: " << e.what() << "\n"; return 1; } return 0; }