1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-11-07 11:03:03 +00:00

Create directories when renaming hyphae

This commit is contained in:
bouncepaw
2020-10-03 17:51:19 +05:00
parent 2add791ba9
commit 47bc6aa31c
2 changed files with 4 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ package history
import (
"fmt"
"os"
"path/filepath"
"sync"
"github.com/bouncepaw/mycorrhiza/util"
@@ -68,6 +70,7 @@ func (hop *HistoryOp) WithFilesRemoved(paths ...string) *HistoryOp {
func (hop *HistoryOp) WithFilesRenamed(pairs map[string]string) *HistoryOp {
for from, to := range pairs {
if from != "" {
os.MkdirAll(filepath.Dir(to), 0777)
hop.gitop(append([]string{"mv"}, from, to)...)
}
}