{"thread":{"id":"35704","subject":"[PATCH 00/11] git p4 tests and a few bug fixes","startedAt":"2014-01-21T23:16:37Z","lastAt":"2014-01-22T22:47:29Z","messageCount":27,"participants":["Pete Wyckoff","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":11},"messages":[{"id":"233476","messageId":"1390346208-9207-1-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":null,"subject":"[PATCH 00/11] git p4 tests and a few bug fixes","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:37Z","receivedAt":"2014-01-21T23:16:37Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Most of this is work on tests for git p4.\n\nPatch 03 is a regression fix, found and narrowed down thanks to\nmuch work by Damien Gérard.  But it is obscure enough that I'm\nnot proposing it for a maintenance release.\n\nThere are a couple other behavior fixes, but again, these\nare quite minor and can wait for the next release.\n\nPete Wyckoff (11):\n  git p4 test: wildcards are supported\n  git p4 test: ensure p4 symlink parsing works\n  git p4: work around p4 bug that causes empty symlinks\n  git p4 test: explicitly check p4 wildcard delete\n  git p4 test: is_cli_file_writeable succeeds\n  git p4 test: run as user \"author\"\n  git p4 test: do not pollute /tmp\n  git p4: handle files with wildcards when doing RCS scrubbing\n  git p4: fix an error message when \"p4 where\" fails\n  git p4 test: examine behavior with locked (+l) files\n  git p4 doc: use two-line style for options with multiple spellings\n\n Documentation/git-p4.txt           |   6 +-\n git-p4.py                          |  17 +++--\n t/lib-git-p4.sh                    |  23 +++++-\n t/t9802-git-p4-filetype.sh         |  83 +++++++++++++++++++++\n t/t9805-git-p4-skip-submit-edit.sh |   6 +-\n t/t9807-git-p4-submit.sh           |   2 +-\n t/t9809-git-p4-client-view.sh      |  16 ++--\n t/t9812-git-p4-wildcards.sh        |  50 +++++++++++++\n t/t9813-git-p4-preserve-users.sh   |  38 ++++------\n t/t9816-git-p4-locked.sh           | 145 +++++++++++++++++++++++++++++++++++++\n 10 files changed, 342 insertions(+), 44 deletions(-)\n create mode 100755 t/t9816-git-p4-locked.sh\n\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233477","messageId":"1390346208-9207-2-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 01/11] git p4 test: wildcards are supported","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:38Z","receivedAt":"2014-01-21T23:16:38Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Since 9d57c4a (git p4: implement view spec wildcards with \"p4\nwhere\", 2013-08-30), all the wildcard types should be supported.\nChange must-fail tests to mark that they now pass.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9809-git-p4-client-view.sh | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh\nindex 77f6349..23a827f 100755\n--- a/t/t9809-git-p4-client-view.sh\n+++ b/t/t9809-git-p4-client-view.sh\n@@ -76,28 +76,28 @@ test_expect_success 'init depot' '\n '\n \n # double % for printf\n-test_expect_success 'unsupported view wildcard %%n' '\n+test_expect_success 'view wildcard %%n' '\n \tclient_view \"//depot/%%%%1/sub/... //client/sub/%%%%1/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'unsupported view wildcard *' '\n+test_expect_success 'view wildcard *' '\n \tclient_view \"//depot/*/bar/... //client/*/bar/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'wildcard ... only supported at end of spec 1' '\n+test_expect_success 'wildcard ... in the middle' '\n \tclient_view \"//depot/.../file11 //client/.../file11\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'wildcard ... only supported at end of spec 2' '\n+test_expect_success 'wildcard ... in the middle and at the end' '\n \tclient_view \"//depot/.../a/... //client/.../a/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n test_expect_success 'basic map' '\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233478","messageId":"1390346208-9207-3-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 02/11] git p4 test: ensure p4 symlink parsing works","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:39Z","receivedAt":"2014-01-21T23:16:39Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"While this happens to work, there was no test to make sure\nthat the basic importing of a symlink from p4 to git functioned.\n\nAdd a simple test to create a symlink in p4 and import it into git,\nthen verify that the symlink exists and has the correct target.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9802-git-p4-filetype.sh | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)\n\ndiff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh\nindex a82744b..94d7be9 100755\n--- a/t/t9802-git-p4-filetype.sh\n+++ b/t/t9802-git-p4-filetype.sh\n@@ -250,6 +250,23 @@ test_expect_success 'ignore apple' '\n \t)\n '\n \n+test_expect_success SYMLINKS 'create p4 symlink' '\n+\tcd \"$cli\" &&\n+\tln -s symlink-target symlink &&\n+\tp4 add symlink &&\n+\tp4 submit -d \"add symlink\"\n+'\n+\n+test_expect_success SYMLINKS 'ensure p4 symlink parsed correctly' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest -L symlink &&\n+\t\ttest $(readlink symlink) = symlink-target\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233479","messageId":"1390346208-9207-4-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 03/11] git p4: work around p4 bug that causes empty symlinks","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:40Z","receivedAt":"2014-01-21T23:16:40Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Damien Gérard highlights an interesting problem.  Some p4\nrepositories end up with symlinks that have an empty target.  It\nis not possible to create this with current p4, but they do\nindeed exist.\n\nThe effect in git p4 is that \"p4 print\" on the symlink returns an\nempty string, confusing the curret symlink-handling code.\n\nSuch broken repositories cause problems in p4 as well, even with\nno git involved.  In p4, syncing to a change that includes a\nbogus symlink causes errors:\n\n    //depot/empty-symlink - updating /home/me/p4/empty-symlink\n    rename: /home/me/p4/empty-symlink: No such file or directory\n\nand leaves no symlink.\n\nIn git, replicate the p4 behavior by ignoring these bad symlinks.\nIf, in a later p4 revision, the symlink happens to point to\nsomething non-null, the symlink will be replaced properly.\n\nAdd a big test for all this too.\n\nThis happens to be a regression introduced by 1292df1 (git-p4:\nFix occasional truncation of symlink contents., 2013-08-08) and\nappeared first in 1.8.5.  But it only shows up only in p4\nrepositories of dubious character, so can wait for a proper\nrelease.\n\nTested-by: Damien Gérard <damien@iwi.me>\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                  |  9 ++++++-\n t/t9802-git-p4-filetype.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 74 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 5ea8bb8..e798ecf 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -2075,7 +2075,14 @@ class P4Sync(Command, P4UserMap):\n             # p4 print on a symlink sometimes contains \"target\\n\";\n             # if it does, remove the newline\n             data = ''.join(contents)\n-            if data[-1] == '\\n':\n+            if not data:\n+                # Some version of p4 allowed creating a symlink that pointed\n+                # to nothing.  This causes p4 errors when checking out such\n+                # a change, and errors here too.  Work around it by ignoring\n+                # the bad symlink; hopefully a future change fixes it.\n+                print \"\\nIgnoring empty symlink in %s\" % file['depotFile']\n+                return\n+            elif data[-1] == '\\n':\n                 contents = [data[:-1]]\n             else:\n                 contents = [data]\ndiff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh\nindex 94d7be9..66d3fc9 100755\n--- a/t/t9802-git-p4-filetype.sh\n+++ b/t/t9802-git-p4-filetype.sh\n@@ -267,6 +267,72 @@ test_expect_success SYMLINKS 'ensure p4 symlink parsed correctly' '\n \t)\n '\n \n+test_expect_success SYMLINKS 'empty symlink target' '\n+\t(\n+\t\t# first create the file as a file\n+\t\tcd \"$cli\" &&\n+\t\t>empty-symlink &&\n+\t\tp4 add empty-symlink &&\n+\t\tp4 submit -d \"add empty-symlink as a file\"\n+\t) &&\n+\t(\n+\t\t# now change it to be a symlink to \"target1\"\n+\t\tcd \"$cli\" &&\n+\t\tp4 edit empty-symlink &&\n+\t\tp4 reopen -t symlink empty-symlink &&\n+\t\trm empty-symlink &&\n+\t\tln -s target1 empty-symlink &&\n+\t\tp4 add empty-symlink &&\n+\t\tp4 submit -d \"make empty-symlink point to target1\"\n+\t) &&\n+\t(\n+\t\t# Hack the p4 depot to make the symlink point to nothing;\n+\t\t# this should not happen in reality, but shows up\n+\t\t# in p4 repos in the wild.\n+\t\t#\n+\t\t# The sed expression changes this:\n+\t\t#     @@\n+\t\t#     text\n+\t\t#     @target1\n+\t\t#     @\n+\t\t# to this:\n+\t\t#     @@\n+\t\t#     text\n+\t\t#     @@\n+\t\t#\n+\t\tcd \"$db/depot\" &&\n+\t\tsed \"/@target1/{; s/target1/@/; n; d; }\" \\\n+\t\t    empty-symlink,v >empty-symlink,v.tmp &&\n+\t\tmv empty-symlink,v.tmp empty-symlink,v\n+\t) &&\n+\t(\n+\t\t# Make sure symlink really is empty.  Asking\n+\t\t# p4 to sync here will make it generate errors.\n+\t\tcd \"$cli\" &&\n+\t\tp4 print -q //depot/empty-symlink#2 >out &&\n+\t\ttest ! -s out\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\n+\t# make sure git p4 handles it without error\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\n+\t# fix the symlink, make it point to \"target2\"\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tp4 open empty-symlink &&\n+\t\trm empty-symlink &&\n+\t\tln -s target2 empty-symlink &&\n+\t\tp4 submit -d \"make empty-symlink point to target2\"\n+\t) &&\n+\tcleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest $(readlink empty-symlink) = target2\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233480","messageId":"1390346208-9207-5-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 04/11] git p4 test: explicitly check p4 wildcard delete","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:41Z","receivedAt":"2014-01-21T23:16:41Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"There was no test where p4 deleted a file with a wildcard\ncharacter.  Make sure git p4 applies the wildcard decoding\nproperly when importing a delete that includes a wildcard.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9812-git-p4-wildcards.sh | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)\n\ndiff --git a/t/t9812-git-p4-wildcards.sh b/t/t9812-git-p4-wildcards.sh\nindex 6763325..f2ddbc5 100755\n--- a/t/t9812-git-p4-wildcards.sh\n+++ b/t/t9812-git-p4-wildcards.sh\n@@ -161,6 +161,33 @@ test_expect_success 'wildcard files submit back to p4, delete' '\n \t)\n '\n \n+test_expect_success 'p4 deleted a wildcard file' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\techo \"wild delete test\" >wild@delete &&\n+\t\tp4 add -f wild@delete &&\n+\t\tp4 submit -d \"add wild@delete\"\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest_path_is_file wild@delete\n+\t) &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\t# must use its encoded name\n+\t\tp4 delete wild%40delete &&\n+\t\tp4 submit -d \"delete wild@delete\"\n+\t) &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit p4 sync &&\n+\t\tgit merge --ff-only p4/master &&\n+\t\ttest_path_is_missing wild@delete\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233481","messageId":"1390346208-9207-6-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 05/11] git p4 test: is_cli_file_writeable succeeds","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:42Z","receivedAt":"2014-01-21T23:16:42Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Commit e9df0f9 (git p4: cygwin p4 client does not mark read-only,\n2013-01-26) fixed a problem with \"test -w\" on cygwin, but mistakenly\nmarked the new test as failing.  Fix this.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9807-git-p4-submit.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\nindex 1fb7bc7..4caf36e 100755\n--- a/t/t9807-git-p4-submit.sh\n+++ b/t/t9807-git-p4-submit.sh\n@@ -17,7 +17,7 @@ test_expect_success 'init depot' '\n \t)\n '\n \n-test_expect_failure 'is_cli_file_writeable function' '\n+test_expect_success 'is_cli_file_writeable function' '\n \t(\n \t\tcd \"$cli\" &&\n \t\techo a >a &&\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233482","messageId":"1390346208-9207-7-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 06/11] git p4 test: run as user \"author\"","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:43Z","receivedAt":"2014-01-21T23:16:43Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"The tests use author@example.com as the canonical submitter,\nbut he does not have an entry in the p4 users database.\nThis causes the generated change description to complain\nthat the git and p4 users disagree.  The complaint message\nis still valid, just isn't useful in tests.  It was was\nintroduced in 848de9c (git-p4: warn if git authorship won't\nbe retained, 2011-05-13).\n\nFix t9813 to use @example.com instead of @localhost due to\nchange in p4_add_user().  Move the function into the git p4\ntest library so author can be added at initialization time.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/lib-git-p4.sh                  | 15 ++++++++++++++-\n t/t9813-git-p4-preserve-users.sh | 38 ++++++++++++++------------------------\n 2 files changed, 28 insertions(+), 25 deletions(-)\n\ndiff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\nindex ccd918e..4ff2bb1 100644\n--- a/t/lib-git-p4.sh\n+++ b/t/lib-git-p4.sh\n@@ -47,9 +47,10 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))\n \n P4PORT=localhost:$P4DPORT\n P4CLIENT=client\n+P4USER=author\n P4EDITOR=:\n unset P4CHARSET\n-export P4PORT P4CLIENT P4EDITOR P4CHARSET\n+export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET\n \n db=\"$TRASH_DIRECTORY/db\"\n cli=\"$TRASH_DIRECTORY/cli\"\n@@ -96,12 +97,24 @@ start_p4d() {\n \t\treturn 1\n \tfi\n \n+\t# build a p4 user so author@example.com has an entry\n+\tp4_add_user author\n+\n \t# build a client\n \tclient_view \"//depot/... //client/...\" &&\n \n \treturn 0\n }\n \n+p4_add_user() {\n+\tname=$1 &&\n+\tp4 user -f -i <<-EOF\n+\tUser: $name\n+\tEmail: $name@example.com\n+\tFullName: Dr. $name\n+\tEOF\n+}\n+\n kill_p4d() {\n \tpid=$(cat \"$pidfile\")\n \t# it had better exist for the first kill\ndiff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh\nindex f2e85e5..166b840 100755\n--- a/t/t9813-git-p4-preserve-users.sh\n+++ b/t/t9813-git-p4-preserve-users.sh\n@@ -19,16 +19,6 @@ test_expect_success 'create files' '\n \t)\n '\n \n-p4_add_user() {\n-\tname=$1 fullname=$2 &&\n-\tp4 user -f -i <<-EOF &&\n-\tUser: $name\n-\tEmail: $name@localhost\n-\tFullName: $fullname\n-\tEOF\n-\tp4 passwd -P secret $name\n-}\n-\n p4_grant_admin() {\n \tname=$1 &&\n \t{\n@@ -51,8 +41,8 @@ make_change_by_user() {\n \n # Test username support, submitting as user 'alice'\n test_expect_success 'preserve users' '\n-\tp4_add_user alice Alice &&\n-\tp4_add_user bob Bob &&\n+\tp4_add_user alice &&\n+\tp4_add_user bob &&\n \tp4_grant_admin alice &&\n \tgit p4 clone --dest=\"$git\" //depot &&\n \ttest_when_finished cleanup_git &&\n@@ -60,8 +50,8 @@ test_expect_success 'preserve users' '\n \t\tcd \"$git\" &&\n \t\techo \"username: a change by alice\" >>file1 &&\n \t\techo \"username: a change by bob\" >>file2 &&\n-\t\tgit commit --author \"Alice <alice@localhost>\" -m \"a change by alice\" file1 &&\n-\t\tgit commit --author \"Bob <bob@localhost>\" -m \"a change by bob\" file2 &&\n+\t\tgit commit --author \"Alice <alice@example.com>\" -m \"a change by alice\" file1 &&\n+\t\tgit commit --author \"Bob <bob@example.com>\" -m \"a change by bob\" file2 &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\tP4EDITOR=touch P4USER=alice P4PASSWD=secret git p4 commit --preserve-user &&\n \t\tp4_check_commit_author file1 alice &&\n@@ -78,7 +68,7 @@ test_expect_success 'refuse to preserve users without perms' '\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\techo \"username-noperms: a change by alice\" >>file1 &&\n-\t\tgit commit --author \"Alice <alice@localhost>\" -m \"perms: a change by alice\" file1 &&\n+\t\tgit commit --author \"Alice <alice@example.com>\" -m \"perms: a change by alice\" file1 &&\n \t\tP4EDITOR=touch P4USER=bob P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\ttest_must_fail git p4 commit --preserve-user &&\n@@ -94,9 +84,9 @@ test_expect_success 'preserve user where author is unknown to p4' '\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\techo \"username-bob: a change by bob\" >>file1 &&\n-\t\tgit commit --author \"Bob <bob@localhost>\" -m \"preserve: a change by bob\" file1 &&\n+\t\tgit commit --author \"Bob <bob@example.com>\" -m \"preserve: a change by bob\" file1 &&\n \t\techo \"username-unknown: a change by charlie\" >>file1 &&\n-\t\tgit commit --author \"Charlie <charlie@localhost>\" -m \"preserve: a change by charlie\" file1 &&\n+\t\tgit commit --author \"Charlie <charlie@example.com>\" -m \"preserve: a change by charlie\" file1 &&\n \t\tP4EDITOR=touch P4USER=alice P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\ttest_must_fail git p4 commit --preserve-user &&\n@@ -121,24 +111,24 @@ test_expect_success 'not preserving user with mixed authorship' '\n \t(\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n-\t\tp4_add_user derek Derek &&\n+\t\tp4_add_user derek &&\n \n-\t\tmake_change_by_user usernamefile3 Derek derek@localhost &&\n+\t\tmake_change_by_user usernamefile3 Derek derek@example.com &&\n \t\tP4EDITOR=cat P4USER=alice P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\tgit p4 commit |\\\n-\t\tgrep \"git author derek@localhost does not match\" &&\n+\t\tgrep \"git author derek@example.com does not match\" &&\n \n-\t\tmake_change_by_user usernamefile3 Charlie charlie@localhost &&\n+\t\tmake_change_by_user usernamefile3 Charlie charlie@example.com &&\n \t\tgit p4 commit |\\\n-\t\tgrep \"git author charlie@localhost does not match\" &&\n+\t\tgrep \"git author charlie@example.com does not match\" &&\n \n-\t\tmake_change_by_user usernamefile3 alice alice@localhost &&\n+\t\tmake_change_by_user usernamefile3 alice alice@example.com &&\n \t\tgit p4 commit |\\\n \t\ttest_must_fail grep \"git author.*does not match\" &&\n \n \t\tgit config git-p4.skipUserNameCheck true &&\n-\t\tmake_change_by_user usernamefile3 Charlie charlie@localhost &&\n+\t\tmake_change_by_user usernamefile3 Charlie charlie@example.com &&\n \t\tgit p4 commit |\\\n \t\ttest_must_fail grep \"git author.*does not match\" &&\n \n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233483","messageId":"1390346208-9207-8-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 07/11] git p4 test: do not pollute /tmp","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:44Z","receivedAt":"2014-01-21T23:16:44Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Generating the submit template for p4 uses tempfile.mkstemp(),\nwhich by default puts files in /tmp.  For a test that fails,\npossibly on purpose, this is not cleaned up.  Run with TMPDIR\npointing into the trash directory so the temp files go away\nwith the test results.\n\nTo do this required some other minor changes.  First, the editor\nis launched using system(editor + \" \" + template_file), using\nshell expansion to build the command string.  This doesn't work\nif editor has a space in it.  And is generally unwise as it's\neasy to fool the shell into doing extra work.  Exec the args\ndirectly, without shell expansion.\n\nSecond, without shell expansion, the trick of \"P4EDITOR=:\" used\nin the tests doesn't work.  Use a real command, true, as the\nnon-interactive editor for testing.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                          | 2 +-\n t/lib-git-p4.sh                    | 8 +++++++-\n t/t9805-git-p4-skip-submit-edit.sh | 6 ++++--\n 3 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex e798ecf..a4414b5 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1220,7 +1220,7 @@ class P4Submit(Command, P4UserMap):\n             editor = os.environ.get(\"P4EDITOR\")\n         else:\n             editor = read_pipe(\"git var GIT_EDITOR\").strip()\n-        system(editor + \" \" + template_file)\n+        system([editor, template_file])\n \n         # If the file was not saved, prompt to see if this patch should\n         # be skipped.  But skip this verification step if configured so.\ndiff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\nindex 4ff2bb1..5aa8adc 100644\n--- a/t/lib-git-p4.sh\n+++ b/t/lib-git-p4.sh\n@@ -48,7 +48,7 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))\n P4PORT=localhost:$P4DPORT\n P4CLIENT=client\n P4USER=author\n-P4EDITOR=:\n+P4EDITOR=true\n unset P4CHARSET\n export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET\n \n@@ -57,6 +57,12 @@ cli=\"$TRASH_DIRECTORY/cli\"\n git=\"$TRASH_DIRECTORY/git\"\n pidfile=\"$TRASH_DIRECTORY/p4d.pid\"\n \n+# git p4 submit generates a temp file, which will\n+# not get cleaned up if the submission fails.  Don't\n+# clutter up /tmp on the test machine.\n+TMPDIR=\"$TRASH_DIRECTORY\"\n+export TMPDIR\n+\n start_p4d() {\n \tmkdir -p \"$db\" \"$cli\" \"$git\" &&\n \trm -f \"$pidfile\" &&\ndiff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh\nindex ff2cc79..8931188 100755\n--- a/t/t9805-git-p4-skip-submit-edit.sh\n+++ b/t/t9805-git-p4-skip-submit-edit.sh\n@@ -17,7 +17,7 @@ test_expect_success 'init depot' '\n \t)\n '\n \n-# this works because EDITOR is set to :\n+# this works because P4EDITOR is set to true\n test_expect_success 'no config, unedited, say yes' '\n \tgit p4 clone --dest=\"$git\" //depot &&\n \ttest_when_finished cleanup_git &&\n@@ -90,7 +90,9 @@ test_expect_success 'no config, edited' '\n \t\tcd \"$git\" &&\n \t\techo line >>file1 &&\n \t\tgit commit -a -m \"change 5\" &&\n-\t\tP4EDITOR=\"\" EDITOR=\"\\\"$TRASH_DIRECTORY/ed.sh\\\"\" git p4 submit &&\n+\t\tP4EDITOR=\"$TRASH_DIRECTORY/ed.sh\" &&\n+\t\texport P4EDITOR &&\n+\t\tgit p4 submit &&\n \t\tp4 changes //depot/... >wc &&\n \t\ttest_line_count = 5 wc\n \t)\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233484","messageId":"1390346208-9207-9-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 08/11] git p4: handle files with wildcards when doing RCS scrubbing","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:45Z","receivedAt":"2014-01-21T23:16:45Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Commit 9d7d446 (git p4: submit files with wildcards, 2012-04-29)\nfixed problems with handling files that had p4 wildcard\ncharacters, like \"@\" and \"*\".  But it missed one case, that of\nRCS keyword scrubbing, which uses \"p4 fstat\" to extract type\ninformation.  Fix it by calling wildcard_encode() on the raw\nfilename.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                   |  4 ++--\n t/t9812-git-p4-wildcards.sh | 23 +++++++++++++++++++++++\n 2 files changed, 25 insertions(+), 2 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex a4414b5..26b874f 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -310,8 +310,8 @@ def split_p4_type(p4type):\n #\n # return the raw p4 type of a file (text, text+ko, etc)\n #\n-def p4_type(file):\n-    results = p4CmdList([\"fstat\", \"-T\", \"headType\", file])\n+def p4_type(f):\n+    results = p4CmdList([\"fstat\", \"-T\", \"headType\", wildcard_encode(f)])\n     return results[0]['headType']\n \n #\ndiff --git a/t/t9812-git-p4-wildcards.sh b/t/t9812-git-p4-wildcards.sh\nindex f2ddbc5..c7472cb 100755\n--- a/t/t9812-git-p4-wildcards.sh\n+++ b/t/t9812-git-p4-wildcards.sh\n@@ -188,6 +188,29 @@ test_expect_success 'p4 deleted a wildcard file' '\n \t)\n '\n \n+test_expect_success 'wildcard files requiring keyword scrub' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tcat <<-\\EOF >scrub@wild &&\n+\t\t$Id$\n+\t\tline2\n+\t\tEOF\n+\t\tp4 add -t text+k -f scrub@wild &&\n+\t\tp4 submit -d \"scrub at wild\"\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.attemptRCSCleanup true &&\n+\t\tsed \"s/^line2/line2 edit/\" <scrub@wild >scrub@wild.tmp &&\n+\t\tmv -f scrub@wild.tmp scrub@wild &&\n+\t\tgit commit -m \"scrub at wild line2 edit\" scrub@wild &&\n+\t\tgit p4 submit\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233485","messageId":"1390346208-9207-10-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 09/11] git p4: fix an error message when \"p4 where\" fails","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:46Z","receivedAt":"2014-01-21T23:16:46Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"When \"p4 where\" fails, for whatever reason, the error message tries to\nshow an undefined variable.  This minor bug applies only when using a\nclient spec, and was introduced recently in 9d57c4a (git p4: implement\nview spec wildcards with \"p4 where\", 2013-08-30).\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 26b874f..cdfa2df 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1871,7 +1871,7 @@ class View(object):\n                 # assume error is \"... file(s) not in client view\"\n                 continue\n             if \"clientFile\" not in res:\n-                die(\"No clientFile from 'p4 where %s'\" % depot_path)\n+                die(\"No clientFile in 'p4 where' output\")\n             if \"unmap\" in res:\n                 # it will list all of them, but only one not unmap-ped\n                 continue\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233486","messageId":"1390346208-9207-11-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 10/11] git p4 test: examine behavior with locked (+l) files","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:47Z","receivedAt":"2014-01-21T23:16:47Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"The p4 server can enforce file locking, so that only one user\ncan edit a file at a time.  Git p4 is unable to submit changes\nto locked files.  Currently it exits poorly.  Ideally it would\nnotice the locked condition and clean up nicely.\n\nAdd a bunch of tests that describe the problem, hoping that\nfixes appear in the future.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9816-git-p4-locked.sh | 145 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 145 insertions(+)\n create mode 100755 t/t9816-git-p4-locked.sh\n\ndiff --git a/t/t9816-git-p4-locked.sh b/t/t9816-git-p4-locked.sh\nnew file mode 100755\nindex 0000000..e71e543\n--- /dev/null\n+++ b/t/t9816-git-p4-locked.sh\n@@ -0,0 +1,145 @@\n+#!/bin/sh\n+\n+test_description='git p4 locked file behavior'\n+\n+. ./lib-git-p4.sh\n+\n+test_expect_success 'start p4d' '\n+\tstart_p4d\n+'\n+\n+# See\n+# http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html#1088563\n+# for suggestions on how to configure \"sitewide pessimistic locking\"\n+# where only one person can have a file open for edit at a time.\n+test_expect_success 'init depot' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\techo \"TypeMap: +l //depot/...\" | p4 typemap -i &&\n+\t\techo file1 >file1 &&\n+\t\tp4 add file1 &&\n+\t\tp4 submit -d \"add file1\"\n+\t)\n+'\n+\n+test_expect_success 'edit with lock not taken' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line2 >>file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"line2 in file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit\n+\t)\n+'\n+\n+test_expect_failure 'add with lock not taken' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line1 >>add-lock-not-taken &&\n+\t\tgit add file2 &&\n+\t\tgit commit -m \"add add-lock-not-taken\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+lock_in_another_client() {\n+\t# build a different client\n+\tcli2=\"$TRASH_DIRECTORY/cli2\" &&\n+\tmkdir -p \"$cli2\" &&\n+\ttest_when_finished \"p4 client -f -d client2 && rm -rf \\\"$cli2\\\"\" &&\n+\t(\n+\t\tcd \"$cli2\" &&\n+\t\tP4CLIENT=client2 &&\n+\t\tcli=\"$cli2\" &&\n+\t\tclient_view \"//depot/... //client2/...\" &&\n+\t\tp4 sync &&\n+\t\tp4 open file1\n+\t)\n+}\n+\n+test_expect_failure 'edit with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line3 >>file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"line3 in file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'delete with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit rm file1 &&\n+\t\tgit commit -m \"delete file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'chmod with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tchmod +x file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"chmod +x file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'copy with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 revert file2 && rm -f file2\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tcp file1 file2 &&\n+\t\tgit add file2 &&\n+\t\tgit commit -m \"cp file1 to file2\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.detectCopies true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'move with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync file1 && rm -f file2\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit mv file1 file2 &&\n+\t\tgit commit -m \"mv file1 to file2\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.detectRenames true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_success 'kill p4d' '\n+\tkill_p4d\n+'\n+\n+test_done\n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233487","messageId":"1390346208-9207-12-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"[PATCH 11/11] git p4 doc: use two-line style for options with multiple spellings","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-21T23:16:48Z","receivedAt":"2014-01-21T23:16:48Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"Thomas Rast noticed the docs have a mix of styles when\nit comes to options with multiple spellings.  Standardize\nthe couple in git-p4.txt that are odd.\n\nInstead of:\n  -n, --dry-run::\n\nDo this:\n  -n::\n  --dry-run::\n\nSee\nhttp://thread.gmane.org/gmane.comp.version-control.git/219936/focus=219945\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n Documentation/git-p4.txt | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex 8cba16d..6ab5f94 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -168,7 +168,8 @@ All commands except clone accept these options.\n --git-dir <dir>::\n \tSet the 'GIT_DIR' environment variable.  See linkgit:git[1].\n \n---verbose, -v::\n+-v::\n+--verbose::\n \tProvide more progress information.\n \n Sync options\n@@ -279,7 +280,8 @@ These options can be used to modify 'git p4 submit' behavior.\n \tExport tags from Git as p4 labels. Tags found in Git are applied\n \tto the perforce working directory.\n \n---dry-run, -n::\n+-n::\n+--dry-run::\n \tShow just what commits would be submitted to p4; do not change\n \tstate in Git or p4.\n \n-- \n1.8.5.2.320.g99957e5\n"},{"id":"233491","messageId":"xmqqfvogsx0o.fsf@gitster.dls.corp.google.com","threadId":"35704","inReplyTo":"1390346208-9207-1-git-send-email-pw@padd.com","subject":"Re: [PATCH 00/11] git p4 tests and a few bug fixes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-22T00:03:35Z","receivedAt":"2014-01-22T00:03:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pete Wyckoff <pw@padd.com> writes:\n\n> Most of this is work on tests for git p4.\n>\n> Patch 03 is a regression fix, found and narrowed down thanks to\n> much work by Damien Gérard.  But it is obscure enough that I'm\n> not proposing it for a maintenance release.\n>\n> There are a couple other behavior fixes, but again, these\n> are quite minor and can wait for the next release.\n\nThanks.\n\nI am inclined to say that we should queue this on a fork from\n'maint, merge the result to 'master' before 1.9-rc1 and ship the\nresult as part of the upcoming release, and then possibly merging\nthe topic to 1.8.5.x maintenance release after that.\n\nThis is primarily because I personally do not have p4 expertise to\ntest or properly judge this (iow, you are the area maintainer, the\nauthority), and I somehow have this feeling that parking in 'next'\nfor extended period of time would not give meaningfully larger\nexposure to the code.\n\nWhat do you think?\n\nIf you feel uneasy about such a fast-track, I wouldn't push it,\nthough.\n\n> Pete Wyckoff (11):\n>   git p4 test: wildcards are supported\n>   git p4 test: ensure p4 symlink parsing works\n>   git p4: work around p4 bug that causes empty symlinks\n>   git p4 test: explicitly check p4 wildcard delete\n>   git p4 test: is_cli_file_writeable succeeds\n>   git p4 test: run as user \"author\"\n>   git p4 test: do not pollute /tmp\n>   git p4: handle files with wildcards when doing RCS scrubbing\n>   git p4: fix an error message when \"p4 where\" fails\n>   git p4 test: examine behavior with locked (+l) files\n>   git p4 doc: use two-line style for options with multiple spellings\n>\n>  Documentation/git-p4.txt           |   6 +-\n>  git-p4.py                          |  17 +++--\n>  t/lib-git-p4.sh                    |  23 +++++-\n>  t/t9802-git-p4-filetype.sh         |  83 +++++++++++++++++++++\n>  t/t9805-git-p4-skip-submit-edit.sh |   6 +-\n>  t/t9807-git-p4-submit.sh           |   2 +-\n>  t/t9809-git-p4-client-view.sh      |  16 ++--\n>  t/t9812-git-p4-wildcards.sh        |  50 +++++++++++++\n>  t/t9813-git-p4-preserve-users.sh   |  38 ++++------\n>  t/t9816-git-p4-locked.sh           | 145 +++++++++++++++++++++++++++++++++++++\n>  10 files changed, 342 insertions(+), 44 deletions(-)\n>  create mode 100755 t/t9816-git-p4-locked.sh\n"},{"id":"233497","messageId":"CAPig+cTbC9HN3REb0Lib7pzUvkLSG6te2ka4zUzcA5y5bcK_hg@mail.gmail.com","threadId":"35704","inReplyTo":"1390346208-9207-4-git-send-email-pw@padd.com","subject":"Re: [PATCH 03/11] git p4: work around p4 bug that causes empty symlinks","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-01-22T01:26:16Z","receivedAt":"2014-01-22T01:26:16Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jan 21, 2014 at 6:16 PM, Pete Wyckoff <pw@padd.com> wrote:\n> Damien Gérard highlights an interesting problem.  Some p4\n> repositories end up with symlinks that have an empty target.  It\n> is not possible to create this with current p4, but they do\n> indeed exist.\n>\n> The effect in git p4 is that \"p4 print\" on the symlink returns an\n> empty string, confusing the curret symlink-handling code.\n>\n> Such broken repositories cause problems in p4 as well, even with\n> no git involved.  In p4, syncing to a change that includes a\n> bogus symlink causes errors:\n>\n>     //depot/empty-symlink - updating /home/me/p4/empty-symlink\n>     rename: /home/me/p4/empty-symlink: No such file or directory\n>\n> and leaves no symlink.\n>\n> In git, replicate the p4 behavior by ignoring these bad symlinks.\n> If, in a later p4 revision, the symlink happens to point to\n> something non-null, the symlink will be replaced properly.\n>\n> Add a big test for all this too.\n>\n> This happens to be a regression introduced by 1292df1 (git-p4:\n> Fix occasional truncation of symlink contents., 2013-08-08) and\n> appeared first in 1.8.5.  But it only shows up only in p4\n\nRedundant \"only\".\n\n> repositories of dubious character, so can wait for a proper\n> release.\n>\n> Tested-by: Damien Gérard <damien@iwi.me>\n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n"},{"id":"233498","messageId":"CAPig+cRJ+MqrBqGYsVmBTzix9baPOkRLKFHv+6J=PnsOv4vkiw@mail.gmail.com","threadId":"35704","inReplyTo":"1390346208-9207-7-git-send-email-pw@padd.com","subject":"Re: [PATCH 06/11] git p4 test: run as user \"author\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-01-22T01:26:46Z","receivedAt":"2014-01-22T01:26:46Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jan 21, 2014 at 6:16 PM, Pete Wyckoff <pw@padd.com> wrote:\n> The tests use author@example.com as the canonical submitter,\n> but he does not have an entry in the p4 users database.\n> This causes the generated change description to complain\n> that the git and p4 users disagree.  The complaint message\n> is still valid, just isn't useful in tests.  It was was\n\ns/was was/was/\n\n> introduced in 848de9c (git-p4: warn if git authorship won't\n> be retained, 2011-05-13).\n>\n> Fix t9813 to use @example.com instead of @localhost due to\n> change in p4_add_user().  Move the function into the git p4\n> test library so author can be added at initialization time.\n>\n> Signed-off-by: Pete Wyckoff <pw@padd.com>\n"},{"id":"233556","messageId":"20140122224421.GB4047@padd.com","threadId":"35704","inReplyTo":"xmqqfvogsx0o.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 00/11] git p4 tests and a few bug fixes","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:44:21Z","receivedAt":"2014-01-22T22:44:21Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"gitster@pobox.com wrote on Tue, 21 Jan 2014 16:03 -0800:\n> Pete Wyckoff <pw@padd.com> writes:\n[..]\n> > Patch 03 is a regression fix, found and narrowed down thanks to\n> > much work by Damien Gérard.  But it is obscure enough that I'm\n> > not proposing it for a maintenance release.\n> \n> Thanks.\n> \n> I am inclined to say that we should queue this on a fork from\n> 'maint, merge the result to 'master' before 1.9-rc1 and ship the\n> result as part of the upcoming release, and then possibly merging\n> the topic to 1.8.5.x maintenance release after that.\n> \n> This is primarily because I personally do not have p4 expertise to\n> test or properly judge this (iow, you are the area maintainer, the\n> authority), and I somehow have this feeling that parking in 'next'\n> for extended period of time would not give meaningfully larger\n> exposure to the code.\n> \n> What do you think?\n> \n> If you feel uneasy about such a fast-track, I wouldn't push it,\n> though.\n\nI think you're right that fast-track is the best choice, and low\nrisk.  The diffs came out identical, and it merges cleanly to\nmaster, and passes all tests in both.\n\nThanks Eric for the commit message fixes too!\n\nHere comes a v2 that is otherwise identical, but based on\norigin/maint from a couple weeks ago.\n\n\t\t-- Pete\n"},{"id":"233557","messageId":"1390430849-11436-1-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 01/11] git p4 test: wildcards are supported","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:19Z","receivedAt":"2014-01-22T22:47:19Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Since 9d57c4a (git p4: implement view spec wildcards with \"p4\nwhere\", 2013-08-30), all the wildcard types should be supported.\nChange must-fail tests to mark that they now pass.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9809-git-p4-client-view.sh | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh\nindex 77f6349..23a827f 100755\n--- a/t/t9809-git-p4-client-view.sh\n+++ b/t/t9809-git-p4-client-view.sh\n@@ -76,28 +76,28 @@ test_expect_success 'init depot' '\n '\n \n # double % for printf\n-test_expect_success 'unsupported view wildcard %%n' '\n+test_expect_success 'view wildcard %%n' '\n \tclient_view \"//depot/%%%%1/sub/... //client/sub/%%%%1/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'unsupported view wildcard *' '\n+test_expect_success 'view wildcard *' '\n \tclient_view \"//depot/*/bar/... //client/*/bar/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'wildcard ... only supported at end of spec 1' '\n+test_expect_success 'wildcard ... in the middle' '\n \tclient_view \"//depot/.../file11 //client/.../file11\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n-test_expect_success 'wildcard ... only supported at end of spec 2' '\n+test_expect_success 'wildcard ... in the middle and at the end' '\n \tclient_view \"//depot/.../a/... //client/.../a/...\" &&\n \ttest_when_finished cleanup_git &&\n-\ttest_must_fail git p4 clone --use-client-spec --dest=\"$git\" //depot\n+\tgit p4 clone --use-client-spec --dest=\"$git\" //depot\n '\n \n test_expect_success 'basic map' '\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233558","messageId":"1390430849-11436-2-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 02/11] git p4 test: ensure p4 symlink parsing works","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:20Z","receivedAt":"2014-01-22T22:47:20Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"While this happens to work, there was no test to make sure\nthat the basic importing of a symlink from p4 to git functioned.\n\nAdd a simple test to create a symlink in p4 and import it into git,\nthen verify that the symlink exists and has the correct target.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9802-git-p4-filetype.sh | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)\n\ndiff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh\nindex a82744b..94d7be9 100755\n--- a/t/t9802-git-p4-filetype.sh\n+++ b/t/t9802-git-p4-filetype.sh\n@@ -250,6 +250,23 @@ test_expect_success 'ignore apple' '\n \t)\n '\n \n+test_expect_success SYMLINKS 'create p4 symlink' '\n+\tcd \"$cli\" &&\n+\tln -s symlink-target symlink &&\n+\tp4 add symlink &&\n+\tp4 submit -d \"add symlink\"\n+'\n+\n+test_expect_success SYMLINKS 'ensure p4 symlink parsed correctly' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest -L symlink &&\n+\t\ttest $(readlink symlink) = symlink-target\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233559","messageId":"1390430849-11436-3-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 03/11] git p4: work around p4 bug that causes empty symlinks","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:21Z","receivedAt":"2014-01-22T22:47:21Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Damien Gérard highlights an interesting problem.  Some p4\nrepositories end up with symlinks that have an empty target.  It\nis not possible to create this with current p4, but they do\nindeed exist.\n\nThe effect in git p4 is that \"p4 print\" on the symlink returns an\nempty string, confusing the curret symlink-handling code.\n\nSuch broken repositories cause problems in p4 as well, even with\nno git involved.  In p4, syncing to a change that includes a\nbogus symlink causes errors:\n\n    //depot/empty-symlink - updating /home/me/p4/empty-symlink\n    rename: /home/me/p4/empty-symlink: No such file or directory\n\nand leaves no symlink.\n\nIn git, replicate the p4 behavior by ignoring these bad symlinks.\nIf, in a later p4 revision, the symlink happens to point to\nsomething non-null, the symlink will be replaced properly.\n\nAdd a big test for all this too.\n\nThis happens to be a regression introduced by 1292df1 (git-p4:\nFix occasional truncation of symlink contents., 2013-08-08) and\nappeared first in 1.8.5.  But it shows up only in p4\nrepositories of dubious character, so can wait for a proper\nrelease.\n\nTested-by: Damien Gérard <damien@iwi.me>\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                  |  9 ++++++-\n t/t9802-git-p4-filetype.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 74 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 06a3cc6..3a20d15 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -2075,7 +2075,14 @@ class P4Sync(Command, P4UserMap):\n             # p4 print on a symlink sometimes contains \"target\\n\";\n             # if it does, remove the newline\n             data = ''.join(contents)\n-            if data[-1] == '\\n':\n+            if not data:\n+                # Some version of p4 allowed creating a symlink that pointed\n+                # to nothing.  This causes p4 errors when checking out such\n+                # a change, and errors here too.  Work around it by ignoring\n+                # the bad symlink; hopefully a future change fixes it.\n+                print \"\\nIgnoring empty symlink in %s\" % file['depotFile']\n+                return\n+            elif data[-1] == '\\n':\n                 contents = [data[:-1]]\n             else:\n                 contents = [data]\ndiff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh\nindex 94d7be9..66d3fc9 100755\n--- a/t/t9802-git-p4-filetype.sh\n+++ b/t/t9802-git-p4-filetype.sh\n@@ -267,6 +267,72 @@ test_expect_success SYMLINKS 'ensure p4 symlink parsed correctly' '\n \t)\n '\n \n+test_expect_success SYMLINKS 'empty symlink target' '\n+\t(\n+\t\t# first create the file as a file\n+\t\tcd \"$cli\" &&\n+\t\t>empty-symlink &&\n+\t\tp4 add empty-symlink &&\n+\t\tp4 submit -d \"add empty-symlink as a file\"\n+\t) &&\n+\t(\n+\t\t# now change it to be a symlink to \"target1\"\n+\t\tcd \"$cli\" &&\n+\t\tp4 edit empty-symlink &&\n+\t\tp4 reopen -t symlink empty-symlink &&\n+\t\trm empty-symlink &&\n+\t\tln -s target1 empty-symlink &&\n+\t\tp4 add empty-symlink &&\n+\t\tp4 submit -d \"make empty-symlink point to target1\"\n+\t) &&\n+\t(\n+\t\t# Hack the p4 depot to make the symlink point to nothing;\n+\t\t# this should not happen in reality, but shows up\n+\t\t# in p4 repos in the wild.\n+\t\t#\n+\t\t# The sed expression changes this:\n+\t\t#     @@\n+\t\t#     text\n+\t\t#     @target1\n+\t\t#     @\n+\t\t# to this:\n+\t\t#     @@\n+\t\t#     text\n+\t\t#     @@\n+\t\t#\n+\t\tcd \"$db/depot\" &&\n+\t\tsed \"/@target1/{; s/target1/@/; n; d; }\" \\\n+\t\t    empty-symlink,v >empty-symlink,v.tmp &&\n+\t\tmv empty-symlink,v.tmp empty-symlink,v\n+\t) &&\n+\t(\n+\t\t# Make sure symlink really is empty.  Asking\n+\t\t# p4 to sync here will make it generate errors.\n+\t\tcd \"$cli\" &&\n+\t\tp4 print -q //depot/empty-symlink#2 >out &&\n+\t\ttest ! -s out\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\n+\t# make sure git p4 handles it without error\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\n+\t# fix the symlink, make it point to \"target2\"\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tp4 open empty-symlink &&\n+\t\trm empty-symlink &&\n+\t\tln -s target2 empty-symlink &&\n+\t\tp4 submit -d \"make empty-symlink point to target2\"\n+\t) &&\n+\tcleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest $(readlink empty-symlink) = target2\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233560","messageId":"1390430849-11436-4-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 04/11] git p4 test: explicitly check p4 wildcard delete","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:22Z","receivedAt":"2014-01-22T22:47:22Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"There was no test where p4 deleted a file with a wildcard\ncharacter.  Make sure git p4 applies the wildcard decoding\nproperly when importing a delete that includes a wildcard.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9812-git-p4-wildcards.sh | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)\n\ndiff --git a/t/t9812-git-p4-wildcards.sh b/t/t9812-git-p4-wildcards.sh\nindex 6763325..f2ddbc5 100755\n--- a/t/t9812-git-p4-wildcards.sh\n+++ b/t/t9812-git-p4-wildcards.sh\n@@ -161,6 +161,33 @@ test_expect_success 'wildcard files submit back to p4, delete' '\n \t)\n '\n \n+test_expect_success 'p4 deleted a wildcard file' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\techo \"wild delete test\" >wild@delete &&\n+\t\tp4 add -f wild@delete &&\n+\t\tp4 submit -d \"add wild@delete\"\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest_path_is_file wild@delete\n+\t) &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\t# must use its encoded name\n+\t\tp4 delete wild%40delete &&\n+\t\tp4 submit -d \"delete wild@delete\"\n+\t) &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit p4 sync &&\n+\t\tgit merge --ff-only p4/master &&\n+\t\ttest_path_is_missing wild@delete\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233561","messageId":"1390430849-11436-5-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 05/11] git p4 test: is_cli_file_writeable succeeds","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:23Z","receivedAt":"2014-01-22T22:47:23Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Commit e9df0f9 (git p4: cygwin p4 client does not mark read-only,\n2013-01-26) fixed a problem with \"test -w\" on cygwin, but mistakenly\nmarked the new test as failing.  Fix this.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9807-git-p4-submit.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\nindex 1fb7bc7..4caf36e 100755\n--- a/t/t9807-git-p4-submit.sh\n+++ b/t/t9807-git-p4-submit.sh\n@@ -17,7 +17,7 @@ test_expect_success 'init depot' '\n \t)\n '\n \n-test_expect_failure 'is_cli_file_writeable function' '\n+test_expect_success 'is_cli_file_writeable function' '\n \t(\n \t\tcd \"$cli\" &&\n \t\techo a >a &&\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233562","messageId":"1390430849-11436-6-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 06/11] git p4 test: run as user \"author\"","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:24Z","receivedAt":"2014-01-22T22:47:24Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"The tests use author@example.com as the canonical submitter, but\nhe does not have an entry in the p4 users database.  This causes\nthe generated change description to complain that the git and p4\nusers disagree.  The complaint message is still valid, just isn't\nuseful in tests.  It was introduced in 848de9c (git-p4: warn if\ngit authorship won't be retained, 2011-05-13).\n\nFix t9813 to use @example.com instead of @localhost due to change\nin p4_add_user().  Move the function into the git p4 test library\nso author can be added at initialization time.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/lib-git-p4.sh                  | 15 ++++++++++++++-\n t/t9813-git-p4-preserve-users.sh | 38 ++++++++++++++------------------------\n 2 files changed, 28 insertions(+), 25 deletions(-)\n\ndiff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\nindex ccd918e..4ff2bb1 100644\n--- a/t/lib-git-p4.sh\n+++ b/t/lib-git-p4.sh\n@@ -47,9 +47,10 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))\n \n P4PORT=localhost:$P4DPORT\n P4CLIENT=client\n+P4USER=author\n P4EDITOR=:\n unset P4CHARSET\n-export P4PORT P4CLIENT P4EDITOR P4CHARSET\n+export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET\n \n db=\"$TRASH_DIRECTORY/db\"\n cli=\"$TRASH_DIRECTORY/cli\"\n@@ -96,12 +97,24 @@ start_p4d() {\n \t\treturn 1\n \tfi\n \n+\t# build a p4 user so author@example.com has an entry\n+\tp4_add_user author\n+\n \t# build a client\n \tclient_view \"//depot/... //client/...\" &&\n \n \treturn 0\n }\n \n+p4_add_user() {\n+\tname=$1 &&\n+\tp4 user -f -i <<-EOF\n+\tUser: $name\n+\tEmail: $name@example.com\n+\tFullName: Dr. $name\n+\tEOF\n+}\n+\n kill_p4d() {\n \tpid=$(cat \"$pidfile\")\n \t# it had better exist for the first kill\ndiff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh\nindex f2e85e5..166b840 100755\n--- a/t/t9813-git-p4-preserve-users.sh\n+++ b/t/t9813-git-p4-preserve-users.sh\n@@ -19,16 +19,6 @@ test_expect_success 'create files' '\n \t)\n '\n \n-p4_add_user() {\n-\tname=$1 fullname=$2 &&\n-\tp4 user -f -i <<-EOF &&\n-\tUser: $name\n-\tEmail: $name@localhost\n-\tFullName: $fullname\n-\tEOF\n-\tp4 passwd -P secret $name\n-}\n-\n p4_grant_admin() {\n \tname=$1 &&\n \t{\n@@ -51,8 +41,8 @@ make_change_by_user() {\n \n # Test username support, submitting as user 'alice'\n test_expect_success 'preserve users' '\n-\tp4_add_user alice Alice &&\n-\tp4_add_user bob Bob &&\n+\tp4_add_user alice &&\n+\tp4_add_user bob &&\n \tp4_grant_admin alice &&\n \tgit p4 clone --dest=\"$git\" //depot &&\n \ttest_when_finished cleanup_git &&\n@@ -60,8 +50,8 @@ test_expect_success 'preserve users' '\n \t\tcd \"$git\" &&\n \t\techo \"username: a change by alice\" >>file1 &&\n \t\techo \"username: a change by bob\" >>file2 &&\n-\t\tgit commit --author \"Alice <alice@localhost>\" -m \"a change by alice\" file1 &&\n-\t\tgit commit --author \"Bob <bob@localhost>\" -m \"a change by bob\" file2 &&\n+\t\tgit commit --author \"Alice <alice@example.com>\" -m \"a change by alice\" file1 &&\n+\t\tgit commit --author \"Bob <bob@example.com>\" -m \"a change by bob\" file2 &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\tP4EDITOR=touch P4USER=alice P4PASSWD=secret git p4 commit --preserve-user &&\n \t\tp4_check_commit_author file1 alice &&\n@@ -78,7 +68,7 @@ test_expect_success 'refuse to preserve users without perms' '\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\techo \"username-noperms: a change by alice\" >>file1 &&\n-\t\tgit commit --author \"Alice <alice@localhost>\" -m \"perms: a change by alice\" file1 &&\n+\t\tgit commit --author \"Alice <alice@example.com>\" -m \"perms: a change by alice\" file1 &&\n \t\tP4EDITOR=touch P4USER=bob P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\ttest_must_fail git p4 commit --preserve-user &&\n@@ -94,9 +84,9 @@ test_expect_success 'preserve user where author is unknown to p4' '\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n \t\techo \"username-bob: a change by bob\" >>file1 &&\n-\t\tgit commit --author \"Bob <bob@localhost>\" -m \"preserve: a change by bob\" file1 &&\n+\t\tgit commit --author \"Bob <bob@example.com>\" -m \"preserve: a change by bob\" file1 &&\n \t\techo \"username-unknown: a change by charlie\" >>file1 &&\n-\t\tgit commit --author \"Charlie <charlie@localhost>\" -m \"preserve: a change by charlie\" file1 &&\n+\t\tgit commit --author \"Charlie <charlie@example.com>\" -m \"preserve: a change by charlie\" file1 &&\n \t\tP4EDITOR=touch P4USER=alice P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\ttest_must_fail git p4 commit --preserve-user &&\n@@ -121,24 +111,24 @@ test_expect_success 'not preserving user with mixed authorship' '\n \t(\n \t\tcd \"$git\" &&\n \t\tgit config git-p4.skipSubmitEditCheck true &&\n-\t\tp4_add_user derek Derek &&\n+\t\tp4_add_user derek &&\n \n-\t\tmake_change_by_user usernamefile3 Derek derek@localhost &&\n+\t\tmake_change_by_user usernamefile3 Derek derek@example.com &&\n \t\tP4EDITOR=cat P4USER=alice P4PASSWD=secret &&\n \t\texport P4EDITOR P4USER P4PASSWD &&\n \t\tgit p4 commit |\\\n-\t\tgrep \"git author derek@localhost does not match\" &&\n+\t\tgrep \"git author derek@example.com does not match\" &&\n \n-\t\tmake_change_by_user usernamefile3 Charlie charlie@localhost &&\n+\t\tmake_change_by_user usernamefile3 Charlie charlie@example.com &&\n \t\tgit p4 commit |\\\n-\t\tgrep \"git author charlie@localhost does not match\" &&\n+\t\tgrep \"git author charlie@example.com does not match\" &&\n \n-\t\tmake_change_by_user usernamefile3 alice alice@localhost &&\n+\t\tmake_change_by_user usernamefile3 alice alice@example.com &&\n \t\tgit p4 commit |\\\n \t\ttest_must_fail grep \"git author.*does not match\" &&\n \n \t\tgit config git-p4.skipUserNameCheck true &&\n-\t\tmake_change_by_user usernamefile3 Charlie charlie@localhost &&\n+\t\tmake_change_by_user usernamefile3 Charlie charlie@example.com &&\n \t\tgit p4 commit |\\\n \t\ttest_must_fail grep \"git author.*does not match\" &&\n \n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233563","messageId":"1390430849-11436-7-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 07/11] git p4 test: do not pollute /tmp","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:25Z","receivedAt":"2014-01-22T22:47:25Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Generating the submit template for p4 uses tempfile.mkstemp(),\nwhich by default puts files in /tmp.  For a test that fails,\npossibly on purpose, this is not cleaned up.  Run with TMPDIR\npointing into the trash directory so the temp files go away\nwith the test results.\n\nTo do this required some other minor changes.  First, the editor\nis launched using system(editor + \" \" + template_file), using\nshell expansion to build the command string.  This doesn't work\nif editor has a space in it.  And is generally unwise as it's\neasy to fool the shell into doing extra work.  Exec the args\ndirectly, without shell expansion.\n\nSecond, without shell expansion, the trick of \"P4EDITOR=:\" used\nin the tests doesn't work.  Use a real command, true, as the\nnon-interactive editor for testing.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                          | 2 +-\n t/lib-git-p4.sh                    | 8 +++++++-\n t/t9805-git-p4-skip-submit-edit.sh | 6 ++++--\n 3 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 3a20d15..f0a327d 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1220,7 +1220,7 @@ class P4Submit(Command, P4UserMap):\n             editor = os.environ.get(\"P4EDITOR\")\n         else:\n             editor = read_pipe(\"git var GIT_EDITOR\").strip()\n-        system(editor + \" \" + template_file)\n+        system([editor, template_file])\n \n         # If the file was not saved, prompt to see if this patch should\n         # be skipped.  But skip this verification step if configured so.\ndiff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh\nindex 4ff2bb1..5aa8adc 100644\n--- a/t/lib-git-p4.sh\n+++ b/t/lib-git-p4.sh\n@@ -48,7 +48,7 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))\n P4PORT=localhost:$P4DPORT\n P4CLIENT=client\n P4USER=author\n-P4EDITOR=:\n+P4EDITOR=true\n unset P4CHARSET\n export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET\n \n@@ -57,6 +57,12 @@ cli=\"$TRASH_DIRECTORY/cli\"\n git=\"$TRASH_DIRECTORY/git\"\n pidfile=\"$TRASH_DIRECTORY/p4d.pid\"\n \n+# git p4 submit generates a temp file, which will\n+# not get cleaned up if the submission fails.  Don't\n+# clutter up /tmp on the test machine.\n+TMPDIR=\"$TRASH_DIRECTORY\"\n+export TMPDIR\n+\n start_p4d() {\n \tmkdir -p \"$db\" \"$cli\" \"$git\" &&\n \trm -f \"$pidfile\" &&\ndiff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh\nindex ff2cc79..8931188 100755\n--- a/t/t9805-git-p4-skip-submit-edit.sh\n+++ b/t/t9805-git-p4-skip-submit-edit.sh\n@@ -17,7 +17,7 @@ test_expect_success 'init depot' '\n \t)\n '\n \n-# this works because EDITOR is set to :\n+# this works because P4EDITOR is set to true\n test_expect_success 'no config, unedited, say yes' '\n \tgit p4 clone --dest=\"$git\" //depot &&\n \ttest_when_finished cleanup_git &&\n@@ -90,7 +90,9 @@ test_expect_success 'no config, edited' '\n \t\tcd \"$git\" &&\n \t\techo line >>file1 &&\n \t\tgit commit -a -m \"change 5\" &&\n-\t\tP4EDITOR=\"\" EDITOR=\"\\\"$TRASH_DIRECTORY/ed.sh\\\"\" git p4 submit &&\n+\t\tP4EDITOR=\"$TRASH_DIRECTORY/ed.sh\" &&\n+\t\texport P4EDITOR &&\n+\t\tgit p4 submit &&\n \t\tp4 changes //depot/... >wc &&\n \t\ttest_line_count = 5 wc\n \t)\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233564","messageId":"1390430849-11436-8-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 08/11] git p4: handle files with wildcards when doing RCS scrubbing","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:26Z","receivedAt":"2014-01-22T22:47:26Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Commit 9d7d446 (git p4: submit files with wildcards, 2012-04-29)\nfixed problems with handling files that had p4 wildcard\ncharacters, like \"@\" and \"*\".  But it missed one case, that of\nRCS keyword scrubbing, which uses \"p4 fstat\" to extract type\ninformation.  Fix it by calling wildcard_encode() on the raw\nfilename.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py                   |  4 ++--\n t/t9812-git-p4-wildcards.sh | 23 +++++++++++++++++++++++\n 2 files changed, 25 insertions(+), 2 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex f0a327d..39a0fa0 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -310,8 +310,8 @@ def split_p4_type(p4type):\n #\n # return the raw p4 type of a file (text, text+ko, etc)\n #\n-def p4_type(file):\n-    results = p4CmdList([\"fstat\", \"-T\", \"headType\", file])\n+def p4_type(f):\n+    results = p4CmdList([\"fstat\", \"-T\", \"headType\", wildcard_encode(f)])\n     return results[0]['headType']\n \n #\ndiff --git a/t/t9812-git-p4-wildcards.sh b/t/t9812-git-p4-wildcards.sh\nindex f2ddbc5..c7472cb 100755\n--- a/t/t9812-git-p4-wildcards.sh\n+++ b/t/t9812-git-p4-wildcards.sh\n@@ -188,6 +188,29 @@ test_expect_success 'p4 deleted a wildcard file' '\n \t)\n '\n \n+test_expect_success 'wildcard files requiring keyword scrub' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tcat <<-\\EOF >scrub@wild &&\n+\t\t$Id$\n+\t\tline2\n+\t\tEOF\n+\t\tp4 add -t text+k -f scrub@wild &&\n+\t\tp4 submit -d \"scrub at wild\"\n+\t) &&\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.attemptRCSCleanup true &&\n+\t\tsed \"s/^line2/line2 edit/\" <scrub@wild >scrub@wild.tmp &&\n+\t\tmv -f scrub@wild.tmp scrub@wild &&\n+\t\tgit commit -m \"scrub at wild line2 edit\" scrub@wild &&\n+\t\tgit p4 submit\n+\t)\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233565","messageId":"1390430849-11436-9-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 09/11] git p4: fix an error message when \"p4 where\" fails","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:27Z","receivedAt":"2014-01-22T22:47:27Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"When \"p4 where\" fails, for whatever reason, the error message tries to\nshow an undefined variable.  This minor bug applies only when using a\nclient spec, and was introduced recently in 9d57c4a (git p4: implement\nview spec wildcards with \"p4 where\", 2013-08-30).\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n git-p4.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 39a0fa0..db43629 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1871,7 +1871,7 @@ class View(object):\n                 # assume error is \"... file(s) not in client view\"\n                 continue\n             if \"clientFile\" not in res:\n-                die(\"No clientFile from 'p4 where %s'\" % depot_path)\n+                die(\"No clientFile in 'p4 where' output\")\n             if \"unmap\" in res:\n                 # it will list all of them, but only one not unmap-ped\n                 continue\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233566","messageId":"1390430849-11436-10-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 10/11] git p4 test: examine behavior with locked (+l) files","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:28Z","receivedAt":"2014-01-22T22:47:28Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"The p4 server can enforce file locking, so that only one user\ncan edit a file at a time.  Git p4 is unable to submit changes\nto locked files.  Currently it exits poorly.  Ideally it would\nnotice the locked condition and clean up nicely.\n\nAdd a bunch of tests that describe the problem, hoping that\nfixes appear in the future.\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n t/t9816-git-p4-locked.sh | 145 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 145 insertions(+)\n create mode 100755 t/t9816-git-p4-locked.sh\n\ndiff --git a/t/t9816-git-p4-locked.sh b/t/t9816-git-p4-locked.sh\nnew file mode 100755\nindex 0000000..e71e543\n--- /dev/null\n+++ b/t/t9816-git-p4-locked.sh\n@@ -0,0 +1,145 @@\n+#!/bin/sh\n+\n+test_description='git p4 locked file behavior'\n+\n+. ./lib-git-p4.sh\n+\n+test_expect_success 'start p4d' '\n+\tstart_p4d\n+'\n+\n+# See\n+# http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html#1088563\n+# for suggestions on how to configure \"sitewide pessimistic locking\"\n+# where only one person can have a file open for edit at a time.\n+test_expect_success 'init depot' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\techo \"TypeMap: +l //depot/...\" | p4 typemap -i &&\n+\t\techo file1 >file1 &&\n+\t\tp4 add file1 &&\n+\t\tp4 submit -d \"add file1\"\n+\t)\n+'\n+\n+test_expect_success 'edit with lock not taken' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line2 >>file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"line2 in file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit\n+\t)\n+'\n+\n+test_expect_failure 'add with lock not taken' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line1 >>add-lock-not-taken &&\n+\t\tgit add file2 &&\n+\t\tgit commit -m \"add add-lock-not-taken\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+lock_in_another_client() {\n+\t# build a different client\n+\tcli2=\"$TRASH_DIRECTORY/cli2\" &&\n+\tmkdir -p \"$cli2\" &&\n+\ttest_when_finished \"p4 client -f -d client2 && rm -rf \\\"$cli2\\\"\" &&\n+\t(\n+\t\tcd \"$cli2\" &&\n+\t\tP4CLIENT=client2 &&\n+\t\tcli=\"$cli2\" &&\n+\t\tclient_view \"//depot/... //client2/...\" &&\n+\t\tp4 sync &&\n+\t\tp4 open file1\n+\t)\n+}\n+\n+test_expect_failure 'edit with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\techo line3 >>file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"line3 in file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'delete with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit rm file1 &&\n+\t\tgit commit -m \"delete file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'chmod with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync -f file1\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tchmod +x file1 &&\n+\t\tgit add file1 &&\n+\t\tgit commit -m \"chmod +x file1\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'copy with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 revert file2 && rm -f file2\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tcp file1 file2 &&\n+\t\tgit add file2 &&\n+\t\tgit commit -m \"cp file1 to file2\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.detectCopies true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_failure 'move with lock taken' '\n+\tlock_in_another_client &&\n+\ttest_when_finished cleanup_git &&\n+\ttest_when_finished \"cd \\\"$cli\\\" && p4 sync file1 && rm -f file2\" &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit mv file1 file2 &&\n+\t\tgit commit -m \"mv file1 to file2\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit config git-p4.detectRenames true &&\n+\t\tgit p4 submit --verbose\n+\t)\n+'\n+\n+test_expect_success 'kill p4d' '\n+\tkill_p4d\n+'\n+\n+test_done\n-- \n1.8.5.2.364.g6ac45cd\n"},{"id":"233567","messageId":"1390430849-11436-11-git-send-email-pw@padd.com","threadId":"35704","inReplyTo":"20140122224421.GB4047@padd.com","subject":"[PATCHv2 11/11] git p4 doc: use two-line style for options with multiple spellings","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-01-22T22:47:29Z","receivedAt":"2014-01-22T22:47:29Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"Thomas Rast noticed the docs have a mix of styles when\nit comes to options with multiple spellings.  Standardize\nthe couple in git-p4.txt that are odd.\n\nInstead of:\n  -n, --dry-run::\n\nDo this:\n  -n::\n  --dry-run::\n\nSee\nhttp://thread.gmane.org/gmane.comp.version-control.git/219936/focus=219945\n\nSigned-off-by: Pete Wyckoff <pw@padd.com>\n---\n Documentation/git-p4.txt | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex 8cba16d..6ab5f94 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -168,7 +168,8 @@ All commands except clone accept these options.\n --git-dir <dir>::\n \tSet the 'GIT_DIR' environment variable.  See linkgit:git[1].\n \n---verbose, -v::\n+-v::\n+--verbose::\n \tProvide more progress information.\n \n Sync options\n@@ -279,7 +280,8 @@ These options can be used to modify 'git p4 submit' behavior.\n \tExport tags from Git as p4 labels. Tags found in Git are applied\n \tto the perforce working directory.\n \n---dry-run, -n::\n+-n::\n+--dry-run::\n \tShow just what commits would be submitted to p4; do not change\n \tstate in Git or p4.\n \n-- \n1.8.5.2.364.g6ac45cd\n"}]}