git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] git p4 test: make sure P4CONFIG relative path works

From
PWPete Wyckoff <pw@padd.com>
Date
Mar 7, 2013, 23:19 UTC
Message-ID
<1362698357-7334-2-git-send-email-pw@padd.com>
In-Reply-To
<1362698357-7334-1-git-send-email-pw@padd.com>

This adds a test for the fix in bf1d68f (git-p4: use absolute directory for PWD env var, 2011-12-09). It is necessary to set PWD to an absolute path so that p4 can find files referenced by non-absolute paths, like the value of the P4CONFIG environment variable.

P4 does not open files directly; it builds a path by prepending the contents of the PWD environment variable.

Signed-off-by: Pete Wyckoff <pw@padd.com>
---
 t/t9808-git-p4-chdir.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/t/t9808-git-p4-chdir.sh b/t/t9808-git-p4-chdir.sh
index dc92e60..55c5e36 100755
--- a/t/t9808-git-p4-chdir.sh
+++ b/t/t9808-git-p4-chdir.sh
@@ -42,6 +42,20 @@ test_expect_success 'P4CONFIG and relative dir clone' '
 	)
 '
 
+# Common setup using .p4config to set P4CLIENT and P4PORT breaks
+# if clone destination is relative.  Make sure that chdir() expands
+# the relative path in --dest to absolute.
+test_expect_success 'p4 client root would be relative due to clone --dest' '
+	test_when_finished cleanup_git &&
+	(
+		echo P4PORT=$P4PORT >git/.p4config &&
+		P4CONFIG=.p4config &&
+		export P4CONFIG &&
+		unset P4PORT &&
+		git p4 clone --dest="git" //depot
+	)
+'
+
 test_expect_success 'kill p4d' '
 	kill_p4d
 '
-- 
1.8.2.rc2.64.g8335025
Previous: Pete WyckoffNext: Pete Wyckoff
Message 6 of 13 in “git p4: chdir resolves symlinks only for relative paths”
  1. git p4: chdir resolves symlinks only for relative pathsMiklós Fazekas, Jan 29, 2013
  2. Pete WyckoffFeb 3, 2013
  3. Miklós FazekasMar 7, 2013
  4. John KeepingMar 7, 2013
  5. 0/3 fix git-p4 client root symlink problemsPete Wyckoff, Mar 7, 2013
  6. 1/3 git p4 test: make sure P4CONFIG relative path worksPete Wyckoff, Mar 7, 2013
  7. 2/3 git p4 test: should honor symlink in p4 client rootPete Wyckoff, Mar 7, 2013
  8. Johannes SixtMar 8, 2013
  9. 0/3 fix git-p4 client root symlink problemsPete Wyckoff, Mar 11, 2013
  10. 1/3 git p4 test: make sure P4CONFIG relative path worksPete Wyckoff, Mar 11, 2013
  11. 2/3 git p4 test: should honor symlink in p4 client rootPete Wyckoff, Mar 11, 2013
  12. 3/3 git p4: avoid expanding client paths in chdirPete Wyckoff, Mar 11, 2013
  13. 3/3 git p4: avoid expanding client paths in chdirPete Wyckoff, Mar 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.