| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 07a6ea8 commit edadaee
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,14 +16,13 @@ push_subcommand::push_subcommand(const libgit2_object&, CLI::App& app) | |||
| 16 | 16 | auto* sub = app.add_subcommand("push", "Update remote refs along with associated objects"); | |
| 17 | 17 | ||
| 18 | 18 | sub->add_option("<remote>", m_remote_name, "The remote to push to")->default_val("origin"); | |
| 19 | - sub->add_option("<refspec>", m_refspecs, "The refspec(s) to push") | ||
| 20 | - ->expected(0,-1); | ||
| 19 | + sub->add_option("<refspec>", m_refspecs, "The refspec(s) to push")->expected(0, -1); | ||
| 21 | 20 | sub->add_flag( | |
| 22 | - "--all,--branches", | ||
| 23 | - m_branches_flag, | ||
| 24 | - "Push all branches (i.e. refs under " + ansi_code::bold + "refs/heads/" + ansi_code::reset | ||
| 25 | - + "); cannot be used with other <refspec>." | ||
| 26 | - ); | ||
| 21 | + "--all,--branches", | ||
| 22 | + m_branches_flag, | ||
| 23 | + "Push all branches (i.e. refs under " + ansi_code::bold + "refs/heads/" + ansi_code::reset | ||
| 24 | + + "); cannot be used with other <refspec>." | ||
| 25 | + ); | ||
| 27 | 26 | ||
| 28 | 27 | sub->callback( | |
| 29 | 28 | [this]() | |
@@ -103,12 +102,12 @@ void push_subcommand::run() | |||
| 103 | 102 | auto repo_refs = repo.reference_list(); | |
| 104 | 103 | std::unordered_map<std::string, git_oid> remote_refs_before_oids; | |
| 105 | 104 | const std::string prefix = std::string("refs/remotes/") + remote_name + "/"; | |
| 106 | - for (const auto &r : repo_refs) | ||
| 105 | + for (const auto& r : repo_refs) | ||
| 107 | 106 | { | |
| 108 | 107 | if (r.size() > prefix.size() && r.compare(0, prefix.size(), prefix) == 0) | |
| 109 | 108 | { | |
| 110 | 109 | // r is like "refs/remotes/origin/main" | |
| 111 | - std::string short_name = r.substr(prefix.size()); // "main" or "feature/x" | ||
| 110 | + std::string short_name = r.substr(prefix.size()); // "main" or "feature/x" | ||
| 112 | 111 | std::string canonical_remote_ref = std::string("refs/heads/") + short_name; | |
| 113 | 112 | ||
| 114 | 113 | git_oid oid = repo.ref_name_to_id(r); | |
@@ -167,7 +166,7 @@ void push_subcommand::run() | |||
| 167 | 166 | { | |
| 168 | 167 | const git_oid* target = ref_opt->target(); | |
| 169 | 168 | local_oid_opt = *target; // TODO: pas comprenu pourquoi je ne peux pas faire local_oid_opt = | |
| 170 | - // ref_opt->target(); | ||
| 169 | + // ref_opt->target(); | ||
| 171 | 170 | } | |
| 172 | 171 | ||
| 173 | 172 | if (!local_oid_opt) | |
@@ -183,7 +182,7 @@ void push_subcommand::run() | |||
| 183 | 182 | std::string new_hex = oid_to_hex(local_oid); | |
| 184 | 183 | // TODO: check order of hex codes | |
| 185 | 184 | std::cout << " " << old_hex.substr(0, 7) << ".." << new_hex.substr(0, 7) << " " | |
| 186 | - << local_short_name << " -> " << local_short_name << std::endl; | ||
| 185 | + << local_short_name << " -> " << local_short_name << std::endl; | ||
| 187 | 186 | } | |
| 188 | 187 | } | |
| 189 | 188 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments