Search code examples
version-controlperforcep4vperforce-integrate

Perforce error - Path '/Users/aa/Documents' is not under client's root '/Users/aa/Documents/perforce/p4_project'


I've come across many posts online, but it seems that this issue is a bit different or perhaps I'm unable to find another article that addresses the problem.

I'm encountering the error Path '/Users/aa/Documents' is not under client's root '/Users/aa/Documents/perforce/p4_project' when attempting to build a new project from terminal via p4 commands. The same commands work fine on my other machines like ubuntu or centos boxes. This error occurs only on my local Mac and I've followed these commands to create a new perforce project.

# pwd
=> /Users/aa/Documents/perforce
# mkdir p4_project
# cd p4_project
# echo "P4CLIENT=aa-p4_project" > .p4config
# p4 client -t MASTER-p4-project
=> trying to uncomment some directories and then try to do p4 sync
# p4 sync ...
=> Got this error - `Path '/Users/aa/Documents' is not under client's root '/Users/aa/Documents/perforce/p4_project' ` 

I've set the P4CONFIG variable and also ensured that I am in the same directory. See the p4 info output below

User name: aa
Client name: aa-p4_project
Client host: JYDL743YDFI
Client root: /Users/aa/Documents/perforce/p4_project    <<<----- same as current directory
Current directory: /Users/aa/Documents/perforce/p4_project
Peer address: 172.16.15.49:62849
Client address: 172.16.15.49
Server address: <server>:<port>
Server root: /p4/root
    :
    :
Case Handling: sensitive

Tried approaches mentioned on following pages (not similar issue though) :


Solution

  • @Samwise answered my question in the comments. The issue was that ".." and "..." were mapped to "cd .." and "cd ../.." respectively. The p4 command works correctly if I use an absolute path or escape the "."