GitClient gitClient = gitSCM.createClient(listener, environment, build, workspace); String gitCommit = environment.getOrDefault("GIT_COMMIT", "HEAD");
GitClient git = createClient(listener, environment, project, Jenkins.getInstance(), null); GitClient git = createClient(listener, environment, project, node, workingDirectory);
/** * Allows {@link Builder}s and {@link Publisher}s to access a configured {@link GitClient} object to * perform additional git operations. * @param listener build log * @param environment environment variables to be used * @param build run context for the returned GitClient * @param workspace client workspace * @return git client for additional git operations * @throws IOException on input or output error * @throws InterruptedException when interrupted */ @NonNull public GitClient createClient(TaskListener listener, EnvVars environment, Run<?,?> build, FilePath workspace) throws IOException, InterruptedException { FilePath ws = workingDirectory(build.getParent(), workspace, environment, listener); /* ws will be null if the node which ran the build is offline */ if (ws != null) { ws.mkdirs(); // ensure it exists } return createClient(listener,environment, build.getParent(), GitUtils.workspaceToNode(workspace), ws); }
/** * Returns a Git blamer for the specified build and SCM instance. * * @param build the build to get the results for * @param scm the SCM instance * @param workspace current workspace * @param listener task listener * @return {@code true} new users can be created automatically, {@code false} otherwise */ public Blamer createBlamer(final AbstractBuild build, final SCM scm, final FilePath workspace, final TaskListener listener) { try { GitClient gitClient = asGit(scm).createClient(listener, getEnvironment(build, listener), build, workspace); String gitCommit = getEnvironment(build, listener).get("GIT_COMMIT"); return new GitBlamer(gitClient, gitCommit, listener); } catch (IOException e) { return new NullBlamer(); } catch (InterruptedException e) { return new NullBlamer(); } }
FilePath workspace = build.getWorkspace(); GitClient cli = scm.createClient(listener, environment, build, workspace);
GitClient git = createClient(listener, environment, build, workspace);
EnvVars environment = build.getEnvironment(listener); final GitClient git = gitSCM.createClient(listener, environment, build, build.getWorkspace());