@@ -17,14 +17,13 @@ push_subcommand::push_subcommand(const libgit2_object&, CLI::App& app)
1717 auto * sub = app.add_subcommand (" push" , " Update remote refs along with associated objects" );
1818
1919 sub->add_option (" <remote>" , m_remote_name, " The remote to push to" )->default_val (" origin" );
20- sub->add_option (" <refspec>" , m_refspecs, " The refspec(s) to push" )
21- ->expected (0 ,-1 );
20+ sub->add_option (" <refspec>" , m_refspecs, " The refspec(s) to push" )->expected (0 , -1 );
2221 sub->add_flag (
23- " --all,--branches" ,
24- m_branches_flag,
25- " Push all branches (i.e. refs under " + ansi_code::bold + " refs/heads/" + ansi_code::reset
26- + " ); cannot be used with other <refspec>."
27- );
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+ );
2827
2928 sub->callback (
3029 [this ]()
@@ -95,12 +94,12 @@ void push_subcommand::run()
9594 auto repo_refs = repo.reference_list ();
9695 std::unordered_map<std::string, git_oid> remote_refs_before_oids;
9796 const std::string prefix = std::string (" refs/remotes/" ) + remote_name + " /" ;
98- for (const auto & r : repo_refs)
97+ for (const auto & r : repo_refs)
9998 {
10099 if (r.size () > prefix.size () && r.compare (0 , prefix.size (), prefix) == 0 )
101100 {
102101 // r is like "refs/remotes/origin/main"
103- std::string short_name = r.substr (prefix.size ()); // "main" or "feature/x"
102+ std::string short_name = r.substr (prefix.size ()); // "main" or "feature/x"
104103 std::string canonical_remote_ref = std::string (" refs/heads/" ) + short_name;
105104
106105 git_oid oid = repo.ref_name_to_id (r);
@@ -174,7 +173,7 @@ void push_subcommand::run()
174173 std::string new_hex = oid_to_hex (local_oid);
175174 // TODO: check order of hex codes
176175 std::cout << " " << old_hex.substr (0 , 7 ) << " .." << new_hex.substr (0 , 7 ) << " "
177- << local_short_name << " -> " << local_short_name << std::endl;
176+ << local_short_name << " -> " << local_short_name << std::endl;
178177 }
179178 }
180179}
0 commit comments