git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org, viniciusalexandre@gmail.com,
	"Romain Merland" <merlorom@yahoo.fr>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Vitor Antunes" <vitor.hda@gmail.com>,
	amazo@checkvideo.com, aoakley@roku.com
Cc: Luke Diamand <luke@diamand.org>
Subject: [PATCH 1/2] git-p4: add failing test for shelved CL update involving move
Date: Sun, 13 Jan 2019 13:58:14 +0000	[thread overview]
Message-ID: <20190113135815.11286-2-luke@diamand.org> (raw)
In-Reply-To: <20190113135815.11286-1-luke@diamand.org>

Updating a shelved P4 changelist where one or more of the files have
been moved does not work. Add a test for this.

Signed-off-by: Luke Diamand <luke@diamand.org>
---
 t/t9807-git-p4-submit.sh | 53 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 50 insertions(+), 3 deletions(-)

diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index 2325599ee6..08dc8d2caf 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -500,6 +500,12 @@ test_expect_success 'submit --shelve' '
 	)
 '
 
+last_shelve() {
+	change=$(p4 -G changes -s shelved -m 1 //depot/... | \
+		marshal_dump change)
+	echo $change
+}
+
 make_shelved_cl() {
 	test_commit "$1" >/dev/null &&
 	git p4 submit --origin HEAD^ --shelve >/dev/null &&
@@ -533,12 +539,53 @@ test_expect_success 'submit --update-shelve' '
 	) &&
 	(
 		cd "$cli" &&
-		change=$(p4 -G changes -s shelved -m 1 //depot/... | \
-			 marshal_dump change) &&
+		change=$(last_shelve) &&
 		p4 unshelve -c $change -s $change &&
 		grep -q updated-line shelf.t &&
 		p4 describe -S $change | grep added-file.t &&
-		test_path_is_missing shelved-change-1.t
+		test_path_is_missing shelved-change-1.t &&
+		p4 revert ...
+	)
+'
+
+test_expect_failure 'update a shelve involving a moved file' '
+	test_when_finished cleanup_git &&
+	(
+		cd "$cli" &&
+		: >file_to_move &&
+		p4 add file_to_move &&
+		p4 submit -d "change1" &&
+		p4 edit file_to_move &&
+		echo change >>file_to_move &&
+		p4 submit -d "change2" &&
+		p4 opened
+	) &&
+	git p4 clone --dest="$git" //depot &&
+	(
+		cd "$git" &&
+		git config git-p4.skipSubmitEdit true &&
+		mkdir moved &&
+		git mv file_to_move moved/ &&
+		git commit -m "rename a file" &&
+		git p4 submit -M --shelve --origin HEAD^ &&
+		: >new_file &&
+		git add new_file &&
+		git commit --amend &&
+		git show --stat HEAD &&
+		change=$(last_shelve) &&
+		git p4 submit -M --update-shelve $change --commit HEAD
+	) &&
+	(
+		cd "$cli" &&
+		change=$(last_shelve) &&
+		echo change=$change &&
+		p4 unshelve -s $change &&
+		p4 submit -d "Testing update-shelve" &&
+		test_path_is_file moved/file_to_move &&
+		test_path_is_missing file_to_move &&
+		test_path_is_file new_file &&
+		echo "unshelved and submitted change $change" &&
+		p4 changes moved/file_to_move | grep "Testing update-shelve"
 	)
 '
 
-- 
2.20.1.100.g9ee79a14a8


  reply	other threads:[~2019-01-13 13:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-13 13:58 [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Luke Diamand
2019-01-13 13:58 ` Luke Diamand [this message]
2019-01-13 13:58   ` [PATCH 2/2] git-p4: handle update of moved files when updating a shelve Luke Diamand
2019-01-13 21:57   ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Eric Sunshine
2019-01-14 19:03     ` Junio C Hamano
2019-01-14 18:56 ` [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve 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=20190113135815.11286-2-luke@diamand.org \
    --to=luke@diamand.org \
    --cc=amazo@checkvideo.com \
    --cc=aoakley@roku.com \
    --cc=git@vger.kernel.org \
    --cc=merlorom@yahoo.fr \
    --cc=szeder.dev@gmail.com \
    --cc=viniciusalexandre@gmail.com \
    --cc=vitor.hda@gmail.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).