summaryrefslogtreecommitdiff
path: root/gitweb/gitweb.cgi
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-07-31 05:56:05 -0700
committerJunio C Hamano <gitster@pobox.com>2026-07-31 08:52:16 -0700
commit94cf62176ec5e416b7748d60b59bf8f6aa6dd7b3 (patch)
treedf0bb583d539a7489a791c333819b7ab16d21de1 /gitweb/gitweb.cgi
parent341ce9229e9b5619b686ed9d169b54e33b29f594 (diff)
add: introduce '--resolved' option
During a conflicted merge, rebase, or cherry-pick, 'git add -u' is a handy way to add modified paths to the index. However, '-u' indiscriminately adds all modified tracked paths, including unmerged paths that may still contain unresolved conflict markers. It also adds tracked files modified in the worktree that are not involved in the ongoing merge. The latter is not a huge problem for "git rebase", which refuses to start with any local changes, but is a problem for "git merge", which is often run with local changes in maintainer workflows. Introduce 'git add --resolved' to add only unmerged paths, limited by an optional pathspec, where no conflict markers remain in the working tree. Before modifying the index, scan unmerged regular files for leftover conflict markers using a new helper, has_conflict_markers(), defined in merge-ll.c in terms of the is_conflict_marker_line() helper we introduced earlier. If any unmerged path still contains conflict markers, show an error listing the conflicted paths and abort without updating the index. Otherwise, add these unmerged paths that do not have conflict markers to the index. Note that unmerged paths without conflict markers (such as binary files and deletions) are added as resolved using add_file_to_index() and remove_file_from_index_with_flags(). Tracked files that were not in a conflicted state are ignored by '--resolved'. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.cgi')
0 files changed, 0 insertions, 0 deletions