Skip to content

Commit

Permalink
Revert "Revert rust scm usage (#4277)"
Browse files Browse the repository at this point in the history
This reverts commit 995aae2.
  • Loading branch information
NicholasLYang committed Apr 4, 2023
1 parent 1fb6062 commit cbfc563
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/internal/scm/git_go.go
@@ -1,3 +1,6 @@
//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: 28 additions & 0 deletions cli/internal/scm/git_rust.go
@@ -0,0 +1,28 @@
// Package scm abstracts operations on various tools like git
// Currently, only git is supported.
//
// Adapted from https://github.com/thought-machine/please/tree/master/src/scm
// Copyright Thought Machine, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//go:build rust
// +build rust

package scm

import (
"github.com/vercel/turbo/cli/internal/ffi"
)

// git implements operations on a git repository.
type git struct {
repoRoot string
}

// ChangedFiles returns a list of modified files since the given commit, optionally including untracked files.
func (g *git) ChangedFiles(fromCommit string, toCommit string, monorepoRoot string) ([]string, error) {
return ffi.ChangedFiles(g.repoRoot, monorepoRoot, fromCommit, toCommit)
}

func (g *git) PreviousContent(fromCommit string, filePath string) ([]byte, error) {
return ffi.PreviousContent(g.repoRoot, fromCommit, filePath)
}

0 comments on commit cbfc563

Please sign in to comment.