Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

knotserver: git/merge: remove `GitRepo.Merge`

this method is not used now and should be replaced with
`MergeWithOptions`

Signed-off-by: Seongmin Lee <boltlessengineer@proton.me>

authored by

Seongmin Lee and committed by
Tangled
033886cc 3c066500

+8 -21
+7 -20
knotserver/git/merge.go
··· 160 160 return nil 161 161 } 162 162 163 - func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts *MergeOptions) error { 163 + func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts MergeOptions) error { 164 164 var stderr bytes.Buffer 165 165 var cmd *exec.Cmd 166 166 167 + exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run() 168 + 167 169 // if patch is a format-patch, apply using 'git am' 168 170 if opts.FormatPatch { 169 - amCmd := exec.Command("git", "-C", tmpDir, "am", patchFile) 170 - amCmd.Stderr = &stderr 171 - if err := amCmd.Run(); err != nil { 172 - return fmt.Errorf("patch application failed: %s", stderr.String()) 173 - } 174 - return nil 175 - } 176 - 177 - // else, apply using 'git apply' and commit it manually 178 - exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run() 179 - if opts != nil { 171 + cmd = exec.Command("git", "-C", tmpDir, "am", patchFile) 172 + } else { 173 + // else, apply using 'git apply' and commit it manually 180 174 applyCmd := exec.Command("git", "-C", tmpDir, "apply", patchFile) 181 175 applyCmd.Stderr = &stderr 182 176 if err := applyCmd.Run(); err != nil { ··· 207 213 } 208 214 209 215 cmd = exec.Command("git", commitArgs...) 210 - } else { 211 - // If no commit message specified, use git-am which automatically creates a commit 212 - cmd = exec.Command("git", "-C", tmpDir, "am", patchFile) 213 216 } 214 217 215 218 cmd.Stderr = &stderr ··· 246 255 return result 247 256 } 248 257 249 - func (g *GitRepo) Merge(patchData []byte, targetBranch string) error { 250 - return g.MergeWithOptions(patchData, targetBranch, nil) 251 - } 252 - 253 - func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts *MergeOptions) error { 258 + func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts MergeOptions) error { 254 259 patchFile, err := g.createTempFileWithPatch(patchData) 255 260 if err != nil { 256 261 return &ErrMerge{
+1 -1
knotserver/xrpc/merge.go
··· 67 67 return 68 68 } 69 69 70 - mo := &git.MergeOptions{} 70 + mo := git.MergeOptions{} 71 71 if data.AuthorName != nil { 72 72 mo.AuthorName = *data.AuthorName 73 73 }