Skip to contentSkip to conversation

git-p4: fix clone @all regression

PATCH In review Pete Wyckoff 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover git-p4: fix clone @all regression

My commit e32e00dc88948a730b8b1f3b8129f30c313713e7 "git-p4: better message for "git-p4 sync" when not cloned" broke clone @all. This fixes it per Tor Arvid's patch and adds a test to make sure it doesn't happen again.

git-p4: fix clone @all regression
git-p4: test clone @all

 contrib/fast-import/git-p4 |    2 +-
 t/t9800-git-p4.sh          |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

Please queue to maint. Thanks,

		-- Pete
#1 lore raw

PATCH 1/2 git-p4: fix clone @all regression

Commit e32e00dc88948a730b8b1f3b8129f30c313713e7 "git-p4: better message for "git-p4 sync" when not cloned" broke the use of the "@all" revision specifier, e.g., "git-p4 clone //depot/xxx@all".

Fix it as per Tor Arvid's quick patch.

---
 contrib/fast-import/git-p4 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/fast-import/git-p4 +1 -1
index 2df3bb2..7cb479c 100755
@@ -1763,7 +1763,7 @@ class P4Sync(Command):
 
                 changes.sort()
             else:
-                if not self.p4BranchesInGit:
+                if not isinstance(self, P4Clone) and not self.p4BranchesInGit:
                     die("No remote p4 branches.  Perhaps you never did \"git p4 clone\" in here.");
                 if self.verbose:
                     print "Getting p4 changes for %s...%s" % (', '.join(self.depotPaths),
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 git-p4: test clone @all

In reply to Pete Wyckoff

Cloning a p4 depot by default generates a single commit. The use of the "@all" revision specifier instead tells git-p4 to import all commits. Check to make sure both these invocations work as expected.

---
 t/t9800-git-p4.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
t/t9800-git-p4.sh +16 -0
index 1969e6b..abe7c64 100755
@@ -37,11 +37,27 @@ test_expect_success 'add p4 files' '
 	echo file1 >file1 &&
 	p4 add file1 &&
 	p4 submit -d "file1" &&
+	echo file2 >file2 &&
+	p4 add file2 &&
+	p4 submit -d "file2" &&
 	cd "$TRASH_DIRECTORY"
 '
 
 test_expect_success 'basic git-p4 clone' '
 	"$GITP4" clone --dest="$git" //depot &&
+	cd "$git" &&
+	git log --oneline >lines &&
+	test_line_count = 1 lines &&
+	cd .. &&
+	rm -rf "$git" && mkdir "$git"
+'
+
+test_expect_success 'git-p4 clone @all' '
+	"$GITP4" clone --dest="$git" //depot@all &&
+	cd "$git" &&
+	git log --oneline >lines &&
+	test_line_count = 2 lines &&
+	cd .. &&
 	rm -rf "$git" && mkdir "$git"
 '
 
Signature · 1 line
1.7.4.1
#3 lore raw
In reply to Pete Wyckoff
Quoted 5 lines · Pete Wyckoff

My commit e32e00dc88948a730b8b1f3b8129f30c313713e7 "git-p4: better message for "git-p4 sync" when not cloned" broke clone @all. This fixes it per Tor Arvid's patch and adds a test to make sure it doesn't happen again.

Quoted 8 lines

git-p4: fix clone @all regression
git-p4: test clone @all

 contrib/fast-import/git-p4 |    2 +-
 t/t9800-git-p4.sh          |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)

Please queue to maint. Thanks,

The buggy e32e00d itself is not in maint, even though the branch it is on whose tip is at 3820007 (git-p4: support clone --bare, 2011-02-19) could be merged to maint if we really wanted to. But it doesn't look like that the changes on the branch are all fixes, so it is not entirely clear if we want to.

In any case, will merge the result of applying these two on top of 3820007 (git-p4: support clone --bare, 2011-02-19) to master.

Thanks.