aboutsummaryrefslogtreecommitdiff
path: root/t/t9811-git-p4-label-import.sh
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2015-08-27 08:18:56 +0100
committerJunio C Hamano <gitster@pobox.com>2015-08-28 12:02:50 -0700
commit62a3c4848ec4d51e3a9f1a6be6ad0ef75a7df67e (patch)
treed18a7a822b2081dffa4ab7e8f394181de50ee25b /t/t9811-git-p4-label-import.sh
parent3a9835bf65d07321924f2d60686a194e9d257d20 (diff)
downloadgit-62a3c4848ec4d51e3a9f1a6be6ad0ef75a7df67e.tar.gz
git-62a3c4848ec4d51e3a9f1a6be6ad0ef75a7df67e.tar.xz
git-p4: failing test for ignoring invalid p4 labels
When importing a label which references a commit that git-p4 does not know about, git-p4 should skip it and go on to process other labels that can be imported. Instead it crashes when attempting to find the missing commit in the git history. This test demonstrates the problem. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9811-git-p4-label-import.sh')
-rwxr-xr-xt/t9811-git-p4-label-import.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t9811-git-p4-label-import.sh b/t/t9811-git-p4-label-import.sh
index 095238fff..22d1fd3e3 100755
--- a/t/t9811-git-p4-label-import.sh
+++ b/t/t9811-git-p4-label-import.sh
@@ -214,6 +214,51 @@ test_expect_success 'use git config to enable import/export of tags' '
)
'
+p4_head_revision() {
+ p4 changes -m 1 "$@" | awk '{print $2}'
+}
+
+# Importing a label that references a P4 commit that
+# has not been seen. The presence of a label on a commit
+# we haven't seen should not cause git-p4 to fail. It should
+# merely skip that label, and still import other labels.
+test_expect_failure 'importing labels with missing revisions' '
+ test_when_finished cleanup_git &&
+ (
+ rm -fr "$cli" "$git" &&
+ mkdir "$cli" &&
+ P4CLIENT=missing-revision &&
+ client_view "//depot/missing-revision/... //missing-revision/..." &&
+ cd "$cli" &&
+ >f1 && p4 add f1 && p4 submit -d "start" &&
+
+ p4 tag -l TAG_S0 ... &&
+
+ >f2 && p4 add f2 && p4 submit -d "second" &&
+
+ startrev=$(p4_head_revision //depot/missing-revision/...) &&
+
+ >f3 && p4 add f3 && p4 submit -d "third" &&
+
+ p4 edit f2 && date >f2 && p4 submit -d "change" f2 &&
+
+ endrev=$(p4_head_revision //depot/missing-revision/...) &&
+
+ p4 tag -l TAG_S1 ... &&
+
+ # we should skip TAG_S0 since it is before our startpoint,
+ # but pick up TAG_S1.
+
+ git p4 clone --dest="$git" --import-labels -v \
+ //depot/missing-revision/...@$startrev,$endrev &&
+ (
+ cd "$git" &&
+ git rev-parse TAG_S1 &&
+ ! git rev-parse TAG_S0
+ )
+ )
+'
+
test_expect_success 'kill p4d' '
kill_p4d