Skip to content

Commit 33bebf0

Browse files
committed
clean code
1 parent 7d7ec31 commit 33bebf0

File tree

2 files changed

+1
-85
lines changed

2 files changed

+1
-85
lines changed

src/subcommand/merge_subcommand.cpp

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -54,60 +54,6 @@ void perform_fastforward(repository_wrapper& repo, const git_oid* target_oid, in
5454
auto new_target_ref = target_ref.new_ref(target_oid);
5555
}
5656

57-
// static void create_merge_commit(repository_wrapper repo, index_wrapper index, std::vector<std::string> m_branches_to_merge,
58-
// std::vector<annotated_commit_wrapper> commits_to_merge)
59-
// {
60-
// auto head_ref = repo.head();
61-
// auto merge_ref = repo.find_reference_dwim(m_branches_to_merge.front());
62-
// // if (ref)
63-
// // {
64-
// // auto merge_ref = std::move(ref).value();
65-
// // }
66-
// auto merge_commit = repo.resolve_local_ref(m_branches_to_merge.front()).value();
67-
68-
// size_t annotated_count = commits_to_merge.size();
69-
// std::vector<commit_wrapper> parents_list;
70-
// parents_list.reserve(annotated_count + 1);
71-
// parents_list.push_back(std::move(head_ref.peel<commit_wrapper>()));
72-
// for (size_t i=0; i<annotated_count; ++i)
73-
// {
74-
// parents_list.push_back(repo.find_commit(commits_to_merge[i].oid()));
75-
// }
76-
// auto parents = commit_list_wrapper(std::move(parents_list));
77-
78-
// auto author_committer_sign = signature_wrapper::get_default_signature_from_env(repo);
79-
// std::string author_name;
80-
// author_name = author_committer_sign.first.name();
81-
// std::string author_email;
82-
// author_email = author_committer_sign.first.email();
83-
// auto author_committer_sign_now = signature_wrapper::signature_now(author_name, author_email, author_name, author_email);
84-
85-
// std::string msg_target = NULL;
86-
// if (merge_ref)
87-
// {
88-
// msg_target = merge_ref->short_name();
89-
// }
90-
// else
91-
// {
92-
// msg_target = git_oid_tostr_s(&(merge_commit.oid()));
93-
// }
94-
95-
// std::string msg;
96-
// msg = "Merge ";
97-
// if (merge_ref)
98-
// {
99-
// msg.append("branch ");
100-
// }
101-
// else
102-
// {
103-
// msg.append("commit ");
104-
// }
105-
// msg.append(msg_target);
106-
// std::cout << msg << std::endl;
107-
108-
// repo.create_commit(author_committer_sign_now, msg, std::optional<commit_list_wrapper>(std::move(parents)));
109-
// }
110-
11157
void merge_subcommand::run()
11258
{
11359
auto directory = get_current_git_path();
@@ -151,32 +97,4 @@ void merge_subcommand::run()
15197
assert(num_commits_to_merge == 1);
15298
perform_fastforward(repo, target_oid, (analysis & GIT_MERGE_ANALYSIS_UNBORN));
15399
}
154-
// else if (analysis & GIT_MERGE_ANALYSIS_NORMAL)
155-
// {
156-
// git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;
157-
// git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
158-
159-
// merge_opts.flags = 0;
160-
// merge_opts.file_flags = GIT_MERGE_FILE_STYLE_DIFF3;
161-
162-
// checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE|GIT_CHECKOUT_ALLOW_CONFLICTS;
163-
164-
// if (preference & GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY)
165-
// {
166-
// std::cout << "Fast-forward is preferred, but only a merge is possible\n" << std::endl;
167-
// // how to break ?
168-
// }
169-
170-
// git_merge(repo,
171-
// (const git_annotated_commit **)opts.annotated, opts.annotated_count,
172-
// &merge_opts, &checkout_opts);
173-
}
174-
175-
// if (git_index_has_conflicts(index)) {
176-
// /* Handle conflicts */
177-
// output_conflicts(index);
178-
// } else if (!opts.no_commit) {
179-
// create_merge_commit(repo, index, &opts);
180-
// printf("Merge made\n");
181-
// }
182-
// }
100+
}

test/test_merge.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def test_merge_fast_forward(xtl_clone, git_config, git2cpp_path, tmp_path, monke
3333
)
3434
assert p_checkout_2.returncode == 0
3535

36-
time.sleep(2)
37-
3836
merge_cmd = [git2cpp_path, "merge", "foregone"]
3937
p_merge = subprocess.run(merge_cmd, capture_output=True, cwd=xtl_path, text=True)
4038
assert p_merge.returncode == 0

0 commit comments

Comments
 (0)