MCPcopy
hub / github.com/rclone/rclone / runInRepo

Method runInRepo

cmd/gitannex/e2e_test.go:156–168  ·  view source on GitHub ↗

runInRepo runs the given command from within the ephemeral repo directory. To prevent accidental changes in the real home directory, it sets the HOME variable to a subdirectory of the temp directory. It also ensures that the git-annex-remote-rclone-builtin symlink will be found by extending the PATH

(t *testing.T, command string, args ...string)

Source from the content-addressed store, hash-verified

154// variable to a subdirectory of the temp directory. It also ensures that the
155// git-annex-remote-rclone-builtin symlink will be found by extending the PATH.
156func (e *e2eTestingContext) runInRepo(t *testing.T, command string, args ...string) {
157 if testing.Verbose() {
158 t.Logf("Running %s %v\n", command, args)
159 }
160 cmd := exec.Command(command, args...)
161 cmd.Dir = e.ephemeralRepoDir
162 cmd.Env = []string{
163 "HOME=" + e.homeDir,
164 "PATH=" + os.Getenv("PATH") + ":" + e.binDir,
165 }
166 buf, err := cmd.CombinedOutput()
167 require.NoError(t, err, fmt.Sprintf("+ %s %v failed:\n%s\n", command, args, buf))
168}
169
170// createGitRepo creates an empty git repository in the ephemeral repo
171// directory. It makes "global" config changes that are ultimately scoped to the

Callers 4

createGitRepoMethod · 0.95
TestEndToEndFunction · 0.80
TestEndToEndMigrationFunction · 0.80

Calls 2

LogfMethod · 0.80
CommandMethod · 0.65

Tested by

no test coverage detected