Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

git p4 test: refactor marshal_dump

This function will be useful in future tests.  Move it to
the git-p4 test library.  Let it accept an optional argument
to pick a certain marshaled object out of the input stream.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit 798d598080a68deb4958d69adacee409a23b467b 1 parent c47178d
Pete Wyckoff authored gitster committed
Showing with 13 additions and 5 deletions.
  1. +13 −0 t/lib-git-p4.sh
  2. +0 −5 t/t9800-git-p4-basic.sh
13 t/lib-git-p4.sh
View
@@ -102,3 +102,16 @@ cleanup_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"
+}
5 t/t9800-git-p4-basic.sh
View
@@ -155,11 +155,6 @@ test_expect_success 'clone bare' '
)
'
-marshal_dump() {
- what=$1
- "$PYTHON_PATH" -c 'import marshal, sys; d = marshal.load(sys.stdin); print d["'$what'"]'
-}
-
# Sleep a bit so that the top-most p4 change did not happen "now". Then
# import the repo and make sure that the initial import has the same time
# as the top-most change.
Please sign in to comment.
Something went wrong with that request. Please try again.