Merge branch 'th/difftool-diffall'
[gitweb.git] / t / lib-git-p4.sh
index eea46a454f44a7fc4282dfe7f788337b5b61217a..2d753ab7e118e0905e63860cc4ee6ae4932f16c4 100644 (file)
@@ -2,6 +2,10 @@
 # Library code for git p4 tests
 #
 
+# p4 tests never use the top-level repo; always build/clone into
+# a subdirectory called "$git"
+TEST_NO_CREATE_REPO=NoThanks
+
 . ./test-lib.sh
 
 if ! test_have_prereq PYTHON; then
@@ -27,7 +31,7 @@ export P4CLIENT=client
 export P4EDITOR=:
 
 db="$TRASH_DIRECTORY/db"
-cli="$TRASH_DIRECTORY/cli"
+cli=$(test-path-utils real_path "$TRASH_DIRECTORY/cli")
 git="$TRASH_DIRECTORY/git"
 pidfile="$TRASH_DIRECTORY/p4d.pid"
 
@@ -95,5 +99,19 @@ kill_p4d() {
 }
 
 cleanup_git() {
-       rm -rf "$git"
+       rm -rf "$git" &&
+       mkdir "$git"
+}
+
+marshal_dump() {
+       what=$1 &&
+       line=${2:-1} &&
+       cat >"$TRASH_DIRECTORY/marshal-dump.py" <<-EOF &&
+       import marshal
+       import sys
+       for i in range($line):
+           d = marshal.load(sys.stdin)
+       print d['$what']
+       EOF
+       "$PYTHON_PATH" "$TRASH_DIRECTORY/marshal-dump.py"
 }