From b5da4e98571b02dc106de4f9b2cb2a298489f1b1 Mon Sep 17 00:00:00 2001 From: Alberto Cortés Date: Wed, 22 Feb 2017 16:45:46 +0100 Subject: Fix issue 275 (edited) (#276) Fix #275 . It was not possible to write a test for this issue as the original fsnoder didn't support filenames with length > 1. Therefore this patch has 3 commits: add support for long filenames in fsnoder. add a test case for the issue using the new long filenames from step 1. fix the issue by comparing paths level by level instead of lexigographically over the whole path. --- utils/merkletrie/difftree.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'utils/merkletrie/difftree.go') diff --git a/utils/merkletrie/difftree.go b/utils/merkletrie/difftree.go index 1a626cd..7bea55f 100644 --- a/utils/merkletrie/difftree.go +++ b/utils/merkletrie/difftree.go @@ -249,7 +249,6 @@ package merkletrie import ( "fmt" - "strings" "srcd.works/go-git.v4/utils/merkletrie/noder" ) @@ -302,7 +301,7 @@ func diffNodes(changes *Changes, ii *doubleIter) error { var err error // compare their full paths as strings - switch strings.Compare(from.String(), to.String()) { + switch from.Compare(to) { case -1: if err = changes.AddRecursiveDelete(from); err != nil { return err -- cgit