From 0e35cea72ab126eedff824fd509651300ea872bc Mon Sep 17 00:00:00 2001 From: Shinku <17696928+Shinku-Chen@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:55:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=20git=20clean=20reset?= =?UTF-8?q?=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vcs/git.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vcs/git.go b/vcs/git.go index 3ed5a4570..1c0a26ab8 100644 --- a/vcs/git.go +++ b/vcs/git.go @@ -3,9 +3,7 @@ package vcs import ( "github.com/apex/log" "github.com/crawlab-team/crawlab/trace" - "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" - "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" @@ -220,13 +218,13 @@ func (c *GitClient) Reset(opts ...GitResetOption) (err error) { return err } - // reset - if err := wt.Reset(o); err != nil { + // clean + if err := wt.Clean(&git.CleanOptions{Dir: true}); err != nil { return err } - // clean - if err := wt.Clean(&git.CleanOptions{Dir: true}); err != nil { + // reset + if err := wt.Reset(o); err != nil { return err } From f1915b982f267fe642f1833716d45bfbbecf39a9 Mon Sep 17 00:00:00 2001 From: Shinku <17696928+Shinku-Chen@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:07:17 +0800 Subject: [PATCH 2/2] Update git.go --- vcs/git.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/git.go b/vcs/git.go index 1c0a26ab8..5a0d682ea 100644 --- a/vcs/git.go +++ b/vcs/git.go @@ -3,7 +3,9 @@ package vcs import ( "github.com/apex/log" "github.com/crawlab-team/crawlab/trace" + "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" + "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object"