From ee4b9d20b14d1b856fed3889f574a4e8f0fa661f Mon Sep 17 00:00:00 2001
From: Stefan Haller <stefan@haller-berlin.de>
Date: Tue, 30 May 2023 18:54:32 +0200
Subject: [PATCH] Extract a FetchCmdObj function so that we can test it

No change in behavior.
---
 pkg/commands/git_commands/sync.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pkg/commands/git_commands/sync.go b/pkg/commands/git_commands/sync.go
index 515d0e4d8..c56422029 100644
--- a/pkg/commands/git_commands/sync.go
+++ b/pkg/commands/git_commands/sync.go
@@ -53,7 +53,7 @@ type FetchOptions struct {
 }
 
 // Fetch fetch git repo
-func (self *SyncCommands) Fetch(opts FetchOptions) error {
+func (self *SyncCommands) FetchCmdObj(opts FetchOptions) oscommands.ICmdObj {
 	cmdArgs := NewGitCmd("fetch").ToArgv()
 
 	cmdObj := self.cmd.New(cmdArgs)
@@ -62,7 +62,12 @@ func (self *SyncCommands) Fetch(opts FetchOptions) error {
 	} else {
 		cmdObj.PromptOnCredentialRequest()
 	}
-	return cmdObj.WithMutex(self.syncMutex).Run()
+	return cmdObj.WithMutex(self.syncMutex)
+}
+
+func (self *SyncCommands) Fetch(opts FetchOptions) error {
+	cmdObj := self.FetchCmdObj(opts)
+	return cmdObj.Run()
 }
 
 type PullOptions struct {