MCPcopy Index your code
hub / github.com/git/git / chdir

Function chdir

git-p4.py:156–174  ·  view source on GitHub ↗

Do chdir to the given path, and set the PWD environment variable for use by P4. It does not look at getcwd() output. Since we're not using the shell, it is necessary to set the PWD environment variable explicitly. Normally, expand the path to force it to be absolute. This ad

(path, is_client_path=False)

Source from the content-addressed store, hash-verified

154
155
156def chdir(path, is_client_path=False):
157 """Do chdir to the given path, and set the PWD environment variable for use
158 by P4. It does not look at getcwd() output. Since we're not using the
159 shell, it is necessary to set the PWD environment variable explicitly.
160
161 Normally, expand the path to force it to be absolute. This addresses
162 the use of relative path names inside P4 settings, e.g.
163 P4CONFIG=.p4config. P4 does not simply open the filename as given; it
164 looks for .p4config using PWD.
165
166 If is_client_path, the path was handed to us directly by p4, and may be
167 a symbolic link. Do not call os.getcwd() in this case, because it will
168 cause p4 to think that PWD is not inside the client path.
169 """
170
171 os.chdir(path)
172 if not is_client_path:
173 path = os.getcwd()
174 os.environ['PWD'] = path
175
176
177def calcDiskFree():

Callers 15

setup_explicit_git_dirFunction · 0.85
setup_discovered_git_dirFunction · 0.85
setup_bare_git_dirFunction · 0.85
enter_repoFunction · 0.85
runMethod · 0.85
runMethod · 0.85
mainFunction · 0.85
cd_to_homedirFunction · 0.85
handle_optionsFunction · 0.85
chdir_lenFunction · 0.85
unix_sockaddr_cleanupFunction · 0.85

Calls

no outgoing calls

Tested by 1

cmd_mainFunction · 0.68