Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(git): Again use the Git CLI to perform the actual reset #8199

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions plugins/version-control-systems/git/src/main/kotlin/Git.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.apache.logging.log4j.kotlin.logger

import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.LsRemoteCommand
import org.eclipse.jgit.api.ResetCommand
import org.eclipse.jgit.api.errors.GitAPIException
import org.eclipse.jgit.errors.UnsupportedCredentialItem
import org.eclipse.jgit.lib.Constants
Expand Down Expand Up @@ -242,7 +241,7 @@ class Git : VersionControlSystem(), CommandLineTool {
logger.warn { "Failed to fetch everything: ${it.collectMessages()}" }
}.mapCatching { fetchResult ->
// TODO: Migrate this to JGit once sparse checkout (https://bugs.eclipse.org/bugs/show_bug.cgi?id=383772) is
// implemented.
// implemented. Also see the "reset" call below.
run("checkout", revision, workingDir = workingTree.workingDir)

// In case of a non-fixed revision (branch or tag) reset the working tree to ensure that the previously
Expand All @@ -267,7 +266,7 @@ class Git : VersionControlSystem(), CommandLineTool {
"Requested revision '$revision' not found in refs advertised by the server."
}

git.reset().setMode(ResetCommand.ResetType.HARD).setRef(resolvedRevision).call()
run("reset", "--hard", resolvedRevision, workingDir = workingTree.workingDir)
}

revision
Expand Down
Loading