commit 0ff8d236625b5d8329e10e9b812cbdef76917ba6 from: Stefan Sperling date: Tue Sep 28 06:59:08 2021 UTC show commit progress output when 'got merge -c' is used Otherwise no progress output is shown at all with this command. Commit progress output will also display any additional changes which resulted from conflict resolution. ok millert@ commit - 321a74a5caf6877e6bbbfb6b160763c790d79d16 commit + 0ff8d236625b5d8329e10e9b812cbdef76917ba6 blob - 2ffb4504134f26df40668893df73c7dd07c67e93 blob + f7b20149b9b681897e3a952de08646564000698f --- got/got.c +++ got/got.c @@ -10814,7 +10814,8 @@ cmd_merge(int argc, char *argv[]) goto done; } else { error = got_worktree_merge_commit(&merge_commit_id, worktree, - fileindex, author, NULL, 1, branch_tip, branch_name, repo); + fileindex, author, NULL, 1, branch_tip, branch_name, + repo, continue_merge ? print_status : NULL, NULL); if (error) goto done; error = got_worktree_merge_complete(worktree, fileindex, repo); blob - 0dcba98cb99b5350473eff9a91f3600e24b7ff91 blob + 2402196b13cc52e6f489e9fd9d985074fa7dcbfa --- include/got_worktree.h +++ include/got_worktree.h @@ -456,7 +456,8 @@ got_worktree_merge_commit(struct got_object_id **new_c struct got_worktree *worktree, struct got_fileindex *fileindex, const char *author, const char *committer, int allow_bad_symlinks, struct got_object_id *branch_tip, const char *branch_name, - struct got_repository *repo); + struct got_repository *repo, + got_worktree_status_cb status_cb, void *status_arg); /* * Complete the merge operation. blob - 0c6b89ce6d761d53511099314379119479ee725e blob + 2fab18710a8a5331db77b19986086dd87bc4820d --- lib/worktree.c +++ lib/worktree.c @@ -5220,6 +5220,9 @@ report_ct_status(struct got_commitable *ct, { const char *ct_path = ct->path; unsigned char status; + + if (status_cb == NULL) /* no commit progress output desired */ + return NULL; while (ct_path[0] == '/') ct_path++; @@ -7500,14 +7503,6 @@ merge_commit_msg_cb(struct got_pathlist_head *commitab return NULL; } -static const struct got_error * -merge_status_cb(void *arg, unsigned char status, unsigned char staged_status, - const char *path, struct got_object_id *blob_id, - struct got_object_id *staged_blob_id, struct got_object_id *commit_id, - int dirfd, const char *de_name) -{ - return NULL; -} const struct got_error * got_worktree_merge_branch(struct got_worktree *worktree, @@ -7542,7 +7537,9 @@ got_worktree_merge_commit(struct got_object_id **new_c struct got_worktree *worktree, struct got_fileindex *fileindex, const char *author, const char *committer, int allow_bad_symlinks, struct got_object_id *branch_tip, const char *branch_name, - struct got_repository *repo) + struct got_repository *repo, + got_worktree_status_cb status_cb, void *status_arg) + { const struct got_error *err = NULL, *sync_err; struct got_pathlist_head commitable_paths; @@ -7614,7 +7611,7 @@ got_worktree_merge_commit(struct got_object_id **new_c mcm_arg.branch_name = branch_name; err = commit_worktree(new_commit_id, &commitable_paths, head_commit_id, branch_tip, worktree, author, committer, - merge_commit_msg_cb, &mcm_arg, merge_status_cb, NULL, repo); + merge_commit_msg_cb, &mcm_arg, status_cb, status_arg, repo); if (err) goto done; blob - 38220a83f2af8fc1c889f9271a2cd263cbed1dad blob + d4e0cb2db7f4ccaf1b56d880da1adfd94b2707d6 --- regress/cmdline/merge.sh +++ regress/cmdline/merge.sh @@ -492,8 +492,12 @@ test_merge_continue() { local merge_commit=`git_show_head $testroot/repo` + echo "M alpha" > $testroot/stdout.expected + echo "D beta" >> $testroot/stdout.expected + echo "A epsilon/new" >> $testroot/stdout.expected + echo "M gamma/delta" >> $testroot/stdout.expected echo -n "Merged refs/heads/newbranch into refs/heads/master: " \ - > $testroot/stdout.expected + >> $testroot/stdout.expected echo $merge_commit >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -1324,8 +1328,9 @@ test_merge_interrupt() { local merge_commit=`git_show_head $testroot/repo` + echo "M alpha" > $testroot/stdout.expected echo -n "Merged refs/heads/newbranch into refs/heads/master: " \ - > $testroot/stdout.expected + >> $testroot/stdout.expected echo $merge_commit >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout