git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] mergetool(vimdiff): allow paths to contain spaces again

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 14, 2022, 16:27 UTC
Message-ID
<xmqqy1wv7j7u.fsf@gitster.g>
In-Reply-To
<pull.1287.v2.git.1657809063728.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 18 quoted lines
>  	if $base_present
>  	then
> -		eval "$merge_tool_path" \
> -			-f "$FINAL_CMD" "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
> +		eval '"$merge_tool_path"' \
> +			-f "$FINAL_CMD" '"$LOCAL"' '"$BASE"' '"$REMOTE"' '"$MERGED"'
>  	else
>  		# If there is no BASE (example: a merge conflict in a new file
>  		# with the same name created in both braches which didn't exist
> @@ -424,8 +424,8 @@ merge_cmd () {
>  		FINAL_CMD=$(echo "$FINAL_CMD" | \
>  			sed -e 's:2b:quit:g' -e 's:3b:2b:g' -e 's:4b:3b:g')
>  
> -		eval "$merge_tool_path" \
> -			-f "$FINAL_CMD" "$LOCAL" "$REMOTE" "$MERGED"
> +		eval '"$merge_tool_path"' \
> +			-f "$FINAL_CMD" '"$LOCAL"' '"$REMOTE"' '"$MERGED"'
>  	fi

If there were another syntactic fix we need in the future, we may by mistake fix one but not the other, and the test we add in this patch checks only one side but not the other. In a follow-up we may want to unify the two eval invocations to make the testing of this part more robust.

But as a minimum and obvious fix, stopping at the above is appropriate for this patch.

> + ...
> +	diff -u expect actual || at_least_one_ko=true

I wonder if we still should care about platforms that need to set GIT_TEST_CMP_USE_COPIED_CONTEXT while running our tests. If we use "diff -u" hardcoded like this here, we are declaring that they are now unwelcome to run our tests.

It might be just the matter of using "cmp -s" here (or run "diff" without any option). Do we care about emitting the difference in the output? I doubt it.

>  	if test "$at_least_one_ko" = "true"
>  	then
>  		return 255
Thanks.
Previous: Johannes Schindelin via GitGitGadget
Message 13 of 13 in “mergetool(vimdiff): allow paths to contain spaces again”
  1. mergetool(vimdiff): allow paths to contain spaces againJohannes Schindelin via GitGitGadget, Jul 13, 2022
  2. Junio C HamanoJul 13, 2022
  3. Fernando RamosJul 13, 2022
  4. Junio C HamanoJul 13, 2022
  5. Junio C HamanoJul 13, 2022
  6. Fernando RamosJul 13, 2022
  7. Junio C HamanoJul 13, 2022
  8. Junio C HamanoJul 13, 2022
  9. Fernando RamosJul 13, 2022
  10. Fernando RamosJul 13, 2022
  11. Junio C HamanoJul 13, 2022
  12. mergetool(vimdiff): allow paths to contain spaces againJohannes Schindelin via GitGitGadget, Jul 14, 2022
  13. Junio C HamanoJul 14, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.