Home Explore Blog CI



git

7th chunk of `Documentation/git-p4.adoc`
bcf7cb4eefe56f7ac760aaf3df6ee87a4a4500f5535ba29d0000000100000fa6
 config git-p4.branchList main:branch1
git p4 clone --detect-branches //depot@all .
----


PERFORMANCE
-----------
The fast-import mechanism used by 'git p4' creates one pack file for
each invocation of 'git p4 sync'.  Normally, Git garbage compression
(linkgit:git-gc[1]) automatically compresses these to fewer pack files,
but explicit invocation of 'git repack -adf' may improve performance.


CONFIGURATION VARIABLES
-----------------------
The following config settings can be used to modify 'git p4' behavior.
They all are in the 'git-p4' section.

General variables
~~~~~~~~~~~~~~~~~
git-p4.user::
	User specified as an option to all p4 commands, with '-u <user>'.
	The environment variable `P4USER` can be used instead.

git-p4.password::
	Password specified as an option to all p4 commands, with
	'-P <password>'.
	The environment variable `P4PASS` can be used instead.

git-p4.port::
	Port specified as an option to all p4 commands, with
	'-p <port>'.
	The environment variable `P4PORT` can be used instead.

git-p4.host::
	Host specified as an option to all p4 commands, with
	'-h <host>'.
	The environment variable `P4HOST` can be used instead.

git-p4.client::
	Client specified as an option to all p4 commands, with
	'-c <client>', including the client spec.

git-p4.retries::
	Specifies the number of times to retry a p4 command (notably,
	'p4 sync') if the network times out. The default value is 3.
	Set the value to 0 to disable retries or if your p4 version
	does not support retries (pre 2012.2).

Clone and sync variables
~~~~~~~~~~~~~~~~~~~~~~~~
git-p4.syncFromOrigin::
	Because importing commits from other Git repositories is much faster
	than importing them from p4, a mechanism exists to find p4 changes
	first in Git remotes.  If branches exist under 'refs/remote/origin/p4',
	those will be fetched and used when syncing from p4.  This
	variable can be set to 'false' to disable this behavior.

git-p4.branchUser::
	One phase in branch detection involves looking at p4 branches
	to find new ones to import.  By default, all branches are
	inspected.  This option limits the search to just those owned
	by the single user named in the variable.

git-p4.branchList::
	List of branches to be imported when branch detection is
	enabled.  Each entry should be a pair of branch names separated
	by a colon (:).  This example declares that both branchA and
	branchB were created from main:
+
-------------
git config       git-p4.branchList main:branchA
git config --add git-p4.branchList main:branchB
-------------

git-p4.ignoredP4Labels::
	List of p4 labels to ignore. This is built automatically as
	unimportable labels are discovered.

git-p4.importLabels::
	Import p4 labels into git, as per --import-labels.

git-p4.labelImportRegexp::
	Only p4 labels matching this regular expression will be imported. The
	default value is '[a-zA-Z0-9_\-.]+$'.

git-p4.useClientSpec::
	Specify that the p4 client spec should be used to identify p4
	depot paths of interest.  This is equivalent to specifying the
	option `--use-client-spec`.  See the "CLIENT SPEC" section above.
	This variable is a boolean, not the name of a p4 client.

git-p4.pathEncoding::
	Perforce keeps the encoding of a path as given by the originating OS.
	Git expects paths encoded as UTF-8. Use this config to tell git-p4
	what encoding Perforce had used for the paths. This encoding is used
	to transcode the paths to UTF-8. As an example, Perforce on Windows
	often uses "cp1252" to encode path names. If this option is passed
	into a p4 clone request, it is persisted in the resulting new git
	repo.

git-p4.metadataDecodingStrategy::
	Perforce keeps the encoding of a changelist descriptions and user
	full names as stored by the client on a given OS. The p4v client
	uses the OS-local encoding, and so different users can end up storing
	different changelist descriptions or user full names in different
	encodings, in the same depot.
	Git tolerates inconsistent/incorrect encodings in commit messages
	and author

Title: Git-p4 Configuration Variables and Performance
Summary
The git-p4 tool provides various configuration variables to modify its behavior, including settings for user, password, port, and branch relationships. The tool also uses a fast-import mechanism that creates one pack file for each invocation of 'git p4 sync', and provides options to improve performance, such as explicit invocation of 'git repack -adf'. Additionally, git-p4 allows for customization of branch detection, label import, and path encoding.