Skip to content

Commit

Permalink
Revert "fix(turborepo): SCM tests and renaming (vercel#4462)"
Browse files Browse the repository at this point in the history
This reverts commit 1cbba83.
  • Loading branch information
NicholasLYang committed Apr 17, 2023
1 parent ab676c5 commit 38d23b6
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 449 deletions.
14 changes: 7 additions & 7 deletions cli/internal/ffi/ffi.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ func stringToRef(s string) *string {
}

// ChangedFiles returns the files changed in between two commits, the workdir and the index, and optionally untracked files
func ChangedFiles(gitRoot string, turboRoot string, fromCommit string, toCommit string) ([]string, error) {
func ChangedFiles(repoRoot string, monorepoRoot string, fromCommit string, toCommit string) ([]string, error) {
fromCommitRef := stringToRef(fromCommit)
toCommitRef := stringToRef(toCommit)

req := ffi_proto.ChangedFilesReq{
GitRoot: gitRoot,
FromCommit: fromCommitRef,
ToCommit: toCommitRef,
TurboRoot: turboRoot,
RepoRoot: repoRoot,
FromCommit: fromCommitRef,
ToCommit: toCommitRef,
MonorepoRoot: monorepoRoot,
}

reqBuf := Marshal(&req)
Expand All @@ -144,9 +144,9 @@ func ChangedFiles(gitRoot string, turboRoot string, fromCommit string, toCommit
}

// PreviousContent returns the content of a file at a previous commit
func PreviousContent(gitRoot, fromCommit, filePath string) ([]byte, error) {
func PreviousContent(repoRoot, fromCommit, filePath string) ([]byte, error) {
req := ffi_proto.PreviousContentReq{
GitRoot: gitRoot,
RepoRoot: repoRoot,
FromCommit: fromCommit,
FilePath: filePath,
}
Expand Down
176 changes: 88 additions & 88 deletions cli/internal/ffi/proto/messages.pb.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions cli/internal/scm/git_go.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go || !rust
// +build go !rust

// Package scm abstracts operations on various tools like git
// Currently, only git is supported.
//
Expand Down
28 changes: 0 additions & 28 deletions cli/internal/scm/git_rust.go

This file was deleted.

8 changes: 4 additions & 4 deletions crates/turborepo-ffi/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ message GlobRespList {
}

message ChangedFilesReq {
string git_root = 1;
string turbo_root = 2;
string repo_root = 1;
string monorepo_root = 2;
optional string from_commit = 3;
string to_commit = 4;
optional string to_commit = 4;
}

message ChangedFilesResp {
Expand All @@ -42,7 +42,7 @@ message ChangedFilesList {
}

message PreviousContentReq {
string git_root = 1;
string repo_root = 1;
string from_commit = 2;
string file_path = 3;
}
Expand Down
10 changes: 5 additions & 5 deletions crates/turborepo-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ pub extern "C" fn changed_files(buffer: Buffer) -> Buffer {
}
};

let commit_range = req.from_commit.as_deref().zip(req.to_commit.as_deref());
let response = match turborepo_scm::git::changed_files(
req.git_root.into(),
req.turbo_root.into(),
req.from_commit.as_deref(),
&req.to_commit,
req.repo_root.into(),
req.monorepo_root.into(),
commit_range,
) {
Ok(files) => {
let files: Vec<_> = files.into_iter().collect();
Expand Down Expand Up @@ -108,7 +108,7 @@ pub extern "C" fn previous_content(buffer: Buffer) -> Buffer {
};

let response = match turborepo_scm::git::previous_content(
req.git_root.into(),
req.repo_root.into(),
&req.from_commit,
PathBuf::from(req.file_path),
) {
Expand Down
Loading

0 comments on commit 38d23b6

Please sign in to comment.