git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Josef Ridky <jridky@redhat.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Feature Request: user defined suffix for temp files created by git-mergetool
Date: Thu, 06 Oct 2016 10:06:50 -0700	[thread overview]
Message-ID: <xmqq7f9lmmol.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <255814448.2197583.1475759366093.JavaMail.zimbra@redhat.com> (Josef Ridky's message of "Thu, 6 Oct 2016 09:09:26 -0400 (EDT)")

Josef Ridky <jridky@redhat.com> writes:

> +	--local=*)
> +		temp_name=${1#--local=}
> +		if [ "$temp_name" != "" ] && [ "$temp_name" != "$REMOTE_NAME" ] && [ "$temp_name" != "$BASE_NAME" ] && [ "$temp_name" != "$BACKUP_NAME" ]
> +		then
> +			LOCAL_NAME=$temp_name
> +		fi

It is not a good idea to ignore an explicit user request without
giving any indication and without giving any explanation.

You may have noticed that we do not say "[ cond ]" in this shell
script (we say "test" instead; see Documentation/CodingGuidelines).

Instead of having such a test all over the place, I'd suggest doing
it outside the loop:

    while test $# != 0
    do
	case "$1" in
	...
	--local=*)
		LOCAL_NAME=${1#--local=} ;;
	--remote=*)                
		REMOTE_NAME=${1#--local=} ;;
	...
        esac
    done
    
    # sanity check _after_ parsing the command line
    case ",$LOCAL_NAME,$REMOTE_NAME,$BASE_NAME,$BACKUP_NAME," in
    *,,*) die "You cannot set --local/remote/... to empty" ;;
    esac
    ... similarly, duplicate check comes here ...


  reply	other threads:[~2016-10-06 17:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <88486231.114620.1475474318974.JavaMail.zimbra@redhat.com>
2016-10-03  6:36 ` Feature Request: user defined suffix for temp files created by git-mergetool Josef Ridky
2016-10-03 15:18   ` Anatoly Borodin
2016-10-04  5:18     ` Josef Ridky
2016-10-05  9:47       ` David Aguilar
2016-10-05 10:19         ` Josef Ridky
2016-10-05  7:47   ` Josef Ridky
2016-10-05 16:05     ` Junio C Hamano
2016-10-06  6:47       ` Josef Ridky
2016-10-05 21:04     ` Johannes Sixt
2016-10-06  7:21       ` Josef Ridky
2016-10-06 12:43         ` [PATCH 1/2] " Josef Ridky
2016-10-06 13:09           ` [PATCH 2/2] " Josef Ridky
2016-10-06 17:06             ` Junio C Hamano [this message]
2016-10-12  8:24               ` [PATCH v2 " Josef Ridky
2016-10-12 17:59                 ` Junio C Hamano
2016-10-13  4:55                   ` David Aguilar
2016-10-13  5:13           ` [PATCH 1/2] " David Aguilar
2016-10-06 16:58         ` Junio C Hamano
2016-10-06 15:54       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7f9lmmol.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jridky@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).