commit ae1e948a3179529896cf69272a0c1b45ab8ced1c from: Stefan Sperling via: Thomas Adam date: Tue Sep 28 23:20:09 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 - def2f97048d39f24c4938a0ef92b6294480482c2 commit + ae1e948a3179529896cf69272a0c1b45ab8ced1c blob - 7e1da95f5c59517cd657b81619f6f8e89e5c425e blob + 9a7c3707d0e886caa6b6f3d804a1a632c1c0577e --- 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 - a3e841f3fe4b794959a4b3b7a60de73abf4e6dd0 blob + bf1b968b1dcb7b8b268250267bca14c5c8447b66 --- lib/worktree.c +++ lib/worktree.c @@ -5218,6 +5218,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++; @@ -7498,14 +7501,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, @@ -7540,7 +7535,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; @@ -7612,7 +7609,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