packages/brig: more patches

This commit is contained in:
Max Headroom 2022-06-17 22:27:15 +02:00
parent d21fa9bd00
commit d65def9009
4 changed files with 141 additions and 0 deletions

View file

@ -18,10 +18,13 @@ buildGoModule {
subPackages = ["."];
patches = [
./default-repo-location.patch
./fix-ghost-remove.patch
./fix-replay-remove-already-gone.patch
./info-no-check-cached.patch
./ls-no-check-cached.patch
./pin-ls-recursive.patch
./repin-relaxed-locking.patch
./vcs-mapper-debug-to-logger.patch
];
src = fetchFromGitHub {

View file

@ -0,0 +1,13 @@
diff --git a/catfs/vcs/mapper.go b/catfs/vcs/mapper.go
index 5568e600..bfba247d 100644
--- a/catfs/vcs/mapper.go
+++ b/catfs/vcs/mapper.go
@@ -311,7 +311,7 @@ func (ma *Mapper) mapDirectory(srcCurr *n.Directory, dstPath string, force bool)
// No sibling found for this ghost.
if aliveDstCurr == nil {
- return ma.report(srcCurr, nil, false, false, false)
+ return ma.report(srcCurr, nil, false, true, false)
}
localBackCheck, err := ma.lkrSrc.LookupNodeAt(ma.srcHead, aliveDstCurr.Path())

View file

@ -0,0 +1,15 @@
diff --git a/catfs/vcs/change.go b/catfs/vcs/change.go
index 94800b23..e454c399 100644
--- a/catfs/vcs/change.go
+++ b/catfs/vcs/change.go
@@ -234,6 +234,10 @@ func replayAddMoveMapping(lkr *c.Linker, oldPath, newPath string) error {
func replayRemove(lkr *c.Linker, ch *Change) error {
currNd, err := lkr.LookupModNode(ch.Curr.Path())
if err != nil {
+ // file doesn't exist locally, nothing to do
+ if ie.IsNoSuchFileError(err) {
+ return nil
+ }
return e.Wrapf(err, "replay: lookup: %v", ch.Curr.Path())
}

View file

@ -0,0 +1,110 @@
diff --git a/catfs/vcs/debug.go b/catfs/vcs/debug.go
deleted file mode 100644
index 18dbe736..00000000
--- a/catfs/vcs/debug.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package vcs
-
-import (
- "fmt"
-)
-
-const (
- printDebug = false
-)
-
-func debug(args ...interface{}) {
- if printDebug {
- fmt.Println(args...)
- }
-}
-
-func debugf(spec string, args ...interface{}) {
- if printDebug {
- fmt.Printf(spec, args...)
- }
-}
diff --git a/catfs/vcs/mapper.go b/catfs/vcs/mapper.go
index fb87116f..5568e600 100644
--- a/catfs/vcs/mapper.go
+++ b/catfs/vcs/mapper.go
@@ -138,7 +138,7 @@ func (ma *Mapper) report(src, dst n.ModNode, typeMismatch, isRemove, isMove bool
ma.setDstHandled(dst)
}
- debug("=> report", src, dst)
+ log.Debug("=> report", src, dst)
return ma.fn(MapPair{
Src: src,
Dst: dst,
@@ -181,7 +181,7 @@ func (ma *Mapper) mapFile(srcCurr *n.File, dstFilePath string) error {
return nil
}
- debug("map file", srcCurr.Path(), dstFilePath)
+ log.Debug("map file", srcCurr.Path(), dstFilePath)
// Remember that we visited this node.
ma.setSrcVisited(srcCurr)
@@ -669,9 +669,9 @@ func (ma *Mapper) extractLeftovers(lkr *c.Linker, root *n.Directory, srcToDst bo
}
for _, child := range children {
- debug(fmt.Sprintf("extract: %v", child.Path()))
+ log.Debug(fmt.Sprintf("extract: %v", child.Path()))
if ma.nodeIsHandled(child, srcToDst) {
- debug(fmt.Sprintf("node is handled: %v", child.Path()))
+ log.Debug(fmt.Sprintf("node is handled: %v", child.Path()))
continue
}
@@ -689,7 +689,7 @@ func (ma *Mapper) extractLeftovers(lkr *c.Linker, root *n.Directory, srcToDst bo
complete = ma.isDstComplete(dir)
}
- debug(fmt.Sprintf("is complete: %v %v", child.Path(), complete))
+ log.Debug(fmt.Sprintf("is complete: %v %v", child.Path(), complete))
if complete {
if srcToDst {
err = ma.report(dir, nil, false, false, false)
@@ -787,7 +787,7 @@ func (ma *Mapper) Map(fn func(pair MapPair) error) error {
if err != nil {
return err
}
- debug("-- Extract leftover src")
+ log.Debug("-- Extract leftover src")
// Extract things in "src" that were not mapped yet.
// These are files that can be added to our inventory,
@@ -795,7 +795,7 @@ func (ma *Mapper) Map(fn func(pair MapPair) error) error {
if err := ma.extractLeftovers(ma.lkrSrc, srcRoot, true); err != nil {
return err
}
- debug("-- Extract leftover dst")
+ log.Debug("-- Extract leftover dst")
// Check for files that we have, but dst does not.
// We call those files "missing".
diff --git a/catfs/vcs/resolve.go b/catfs/vcs/resolve.go
index 0f5e9cd6..14ca1f01 100644
--- a/catfs/vcs/resolve.go
+++ b/catfs/vcs/resolve.go
@@ -172,7 +172,7 @@ func (rv *resolver) cacheLastCommonMerge() error {
return err
}
- debugf("last merge found: %v = %s", with, srcRef)
+ log.Debugf("last merge found: %v = %s", with, srcRef)
rv.dstMergeCmt = currHead
rv.srcMergeCmt = srcHead
}
@@ -352,7 +352,7 @@ func (rv *resolver) decide(pair MapPair) error {
}
if pair.TypeMismatch {
- debugf(
+ log.Debugf(
"%s is a %s and %s a %s; ignoring",
pair.Src.Path(), pair.Src.Type(),
pair.Dst.Path(), pair.Dst.Type(),