git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Luke Diamand <luke@diamand.org>
Cc: git@vger.kernel.org, Pete Wyckoff <pw@padd.com>
Subject: Re: [PATCH] git-p4: warn if git authorship won't be retained
Date: Tue, 10 May 2011 15:51:37 -0700	[thread overview]
Message-ID: <7vhb92i2yu.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1305055653-5133-2-git-send-email-luke@diamand.org> (Luke Diamand's message of "Tue, 10 May 2011 20:27:33 +0100")

Luke Diamand <luke@diamand.org> writes:

> diff --git a/t/t9800-git-p4.sh b/t/t9800-git-p4.sh
> index 4fb0e24..d6c7d13 100755
> --- a/t/t9800-git-p4.sh
> +++ b/t/t9800-git-p4.sh
> @@ -160,6 +160,15 @@ p4_check_commit_author() {
>      fi
>  }
>  
> +make_change_by_user() {
> +	file=$1
> +	name=$2
> +	email=$3

	file=$1 name=$2 email=$3 &&

> +	echo "username: a change by $name" >> $file &&
> ...
> @@ -213,6 +222,43 @@ test_expect_success 'preserve user where author is unknown to p4' '
>  	rm -rf "$git" && mkdir "$git"
>  '
>  
> +# If we're *not* using --preserve-user, git-p4 should warn if we're submitting
> +# changes that are not all ours.
> +# Test: user in p4 and user unknown to p4.
> +# Test: warning disabled and user is the same.
> +test_expect_success 'not preserving user with mixed authorship' '
> +	"$GITP4" clone --dest="$git" //depot &&
> +	cd "$git" &&
> +	git config git-p4.skipSubmitEditCheck true
> +	p4_add_user derek Derek &&
> + ...
> +	p4_check_commit_author usernamefile3 alice &&
> +	cd "$TRASH_DIRECTORY" &&
> +	rm -rf "$git" && mkdir "$git"
> +'

When the commands in the && chain fails after 'cd "$git"' near the top but
not before 'cd "$TRASH_DIRECTORY"' near the end, you would end up starting
the next test from somewhere different from "$TRASH_DIRECTORY".

Do it like this instead:

	"$GITP4" clone --dest="$git" //depot &&
        (
        	cd "$git" &&
                ...
	) &&
        rm -fr "$git"

  parent reply	other threads:[~2011-05-10 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 19:27 [PATCH/RFC v3] git-p4: warn if git authorship won't be retained Luke Diamand
2011-05-10 19:27 ` [PATCH] " Luke Diamand
2011-05-10 22:11   ` Luke Diamand
2011-05-10 22:51   ` Junio C Hamano [this message]
2011-05-11  7:50     ` Luke Diamand
2011-05-10 23:38   ` 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

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

  git send-email \
    --in-reply-to=7vhb92i2yu.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=luke@diamand.org \
    --cc=pw@padd.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.
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 NNTP newsgroup(s).