Skip to content

Commit

Permalink
mergetools: vscode: new tool
Browse files Browse the repository at this point in the history
VSCode has supported three-way merges since 2022, see
<microsoft/vscode#5770 (comment)>.

Although the program binary is located at /usr/bin/code, name the
mergetool "vscode" because the word "code" is too generic and would lead
to confusion. The name "vscode" also matches Git's existing
contrib/vscode directory.

On Windows, VSCode adds the directory that contains code.cmd to %PATH%,
so there is no need to invoke mergetool_find_win32_cmd to search for the
program.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
alexhenrie authored and gitster committed Sep 2, 2024
1 parent 4590f2e commit 6b77283
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mergetools/vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff_cmd () {
"$merge_tool_path" --wait --diff "$LOCAL" "$REMOTE"
}

diff_cmd_help () {
echo "Use Visual Studio Code (requires a graphical session)"
}

merge_cmd () {
"$merge_tool_path" --wait --merge "$REMOTE" "$LOCAL" "$BASE" "$MERGED"
}

merge_cmd_help () {
echo "Use Visual Studio Code (requires a graphical session)"
}

translate_merge_tool_path () {
echo code
}

0 comments on commit 6b77283

Please sign in to comment.