Brian
Brian

Reputation: 3334

How can I set line ending setting for perforce workspace using p4 from command line?

I cannot find documentation of how exactly to set the line ending settings for a workspace using p4 from the command line. I know how to do this from p4v but I need to do it programmatically in a script and so using p4v isn't an option.

I know I can query the current state using the command

p4 client -o

I have found documentation about a setting LineEnd and the different values it can be set to of local, unix, mac, win, and share but I can't figure out or find documentation telling me how to actually issue the command to pass a new value.

Any help would be much appreciated.

Upvotes: 0

Views: 630

Answers (1)

Samwise
Samwise

Reputation: 71517

The basic idea is you do "p4 client -o" to get the current client spec, modify it, and then pass the modified version to "p4 client -i".

p4 client -o | sed -e "s/LineEnd:.*/LineEnd: unix/" | p4 client -i

Substitute your own value of LineEnd and/or your own sed replacement.

Upvotes: 2

Related Questions