@@ -16,14 +16,13 @@ push_subcommand::push_subcommand(const libgit2_object&, CLI::App& app)
1616 auto * sub = app.add_subcommand (" push" , " Update remote refs along with associated objects" );
1717
1818 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 );
2120 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+ );
2726
2827 sub->callback (
2928 [this ]()
@@ -103,12 +102,12 @@ void push_subcommand::run()
103102 auto repo_refs = repo.reference_list ();
104103 std::unordered_map<std::string, git_oid> remote_refs_before_oids;
105104 const std::string prefix = std::string (" refs/remotes/" ) + remote_name + " /" ;
106- for (const auto & r : repo_refs)
105+ for (const auto & r : repo_refs)
107106 {
108107 if (r.size () > prefix.size () && r.compare (0 , prefix.size (), prefix) == 0 )
109108 {
110109 // 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"
112111 std::string canonical_remote_ref = std::string (" refs/heads/" ) + short_name;
113112
114113 git_oid oid = repo.ref_name_to_id (r);
@@ -167,7 +166,7 @@ void push_subcommand::run()
167166 {
168167 const git_oid* target = ref_opt->target ();
169168 local_oid_opt = *target; // TODO: pas comprenu pourquoi je ne peux pas faire local_oid_opt =
170- // ref_opt->target();
169+ // ref_opt->target();
171170 }
172171
173172 if (!local_oid_opt)
@@ -183,7 +182,7 @@ void push_subcommand::run()
183182 std::string new_hex = oid_to_hex (local_oid);
184183 // TODO: check order of hex codes
185184 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;
187186 }
188187 }
189188}
0 commit comments