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

Re: Feature Request: user defined suffix for temp files created by git-mergetool

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 5, 2016, 16:05 UTC
Message-ID
<xmqqponerdaw.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1499287628.1324571.1475653631366.JavaMail.zimbra@redhat.com>
Josef Ridky <jridky@redhat.com> writes:
Show 8 quoted lines
> Hi, 
>
> I have just realize, that my attachment has been cut off from my previous message.
> Below you can find patch with requested change.
>
> Add support for user defined suffix part of name of temporary files
> created by git mergetool
> ---

The first two paragraphs above do not look like they are meant for the commit log for this change.

Please sign-off your patch.
Show 12 quoted lines
> -USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [file to merge] ...'
> +USAGE='[--tool=tool] [--tool-help] [-y|--no-prompt|--prompt] [--local=name] [--remote=name] [--backup=name] [--base=name] [file to merge] ...'
>  SUBDIRECTORY_OK=Yes
>  NONGIT_OK=Yes
>  OPTIONS_SPEC=
>  TOOL_MODE=merge
> +
> +#optional name space convention
> +local_name=""
> +remote_name=""
> +base_name=""
> +backup_name=""

If you initialize these to LOCAL, REMOTE, etc. instead of empty, wouldn't it make the remainder of the code a lot simpler? For example,

Show 6 quoted lines
> +	if [ "$local_name" != "" ]  && [ "$local_name" != "$remote_name" ] && [ "$local_name" != "$backup_name" ] && [ "$local_name" != "$base_name" ]
> +	then
> +		LOCAL="$MERGETOOL_TMPDIR/${BASE}_${local_name}_$$$ext"
> +	else
> +		LOCAL="$MERGETOOL_TMPDIR/${BASE}_LOCAL_$$$ext"
> +	fi
This can just be made an unconditional
	LOCAL="$MERGETOOL_TMPDIR/${BASE}_${local_name}_$$$ext"
without any "if" check in front.  The same for all others.

The conditional you added is doing two unrelated things. It is trying to switch between an unset $local_name and default LOCAL, while it tries to make sure the user did not give the same string for two different things (which is a nonsense). It is probably better to check for nonsense just once just before all these assuments of LOCAL, REMOTE, etc. begins, not at each point where they are set like this patch does.

Previous: Josef RidkyNext: Josef Ridky
Message 7 of 19 in “Feature Request: user defined suffix for temp files created by git-mergetool”
  1. Josef RidkyOct 3, 2016
  2. Anatoly BorodinOct 3, 2016
  3. Josef RidkyOct 4, 2016
  4. David AguilarOct 5, 2016
  5. Josef RidkyOct 5, 2016
  6. Josef RidkyOct 5, 2016
  7. Junio C HamanoOct 5, 2016
  8. Josef RidkyOct 6, 2016
  9. Johannes SixtOct 5, 2016
  10. Josef RidkyOct 6, 2016
  11. 1/2 Feature Request: user defined suffix for temp files created by git-mergetoolJosef Ridky, Oct 6, 2016
  12. 2/2 Feature Request: user defined suffix for temp files created by git-mergetoolJosef Ridky, Oct 6, 2016
  13. Junio C HamanoOct 6, 2016
  14. Josef RidkyOct 12, 2016
  15. Junio C HamanoOct 12, 2016
  16. David AguilarOct 13, 2016
  17. David AguilarOct 13, 2016
  18. Junio C HamanoOct 6, 2016
  19. Junio C HamanoOct 6, 2016

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.