Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit d505134

Browse files
committed
Modifying directory equality check to account for tars
1 parent c1d1529 commit d505134

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

differs/fileDiff.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func diffImageFiles(image1, image2 utils.Image) (utils.DirDiff, error) {
5252
Image2: image2.Source,
5353
Adds: adds,
5454
Dels: dels,
55+
Mods: []string{},
5556
}
5657

5758
err = os.Remove(target1)

utils/fs_utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ type DirDiff struct {
9898
Mods []string
9999
}
100100

101+
// DiffDirectory takes the diff of two directories, assuming both are completely unpacked
101102
func DiffDirectory(d1, d2 Directory) (DirDiff, bool) {
102103
adds := GetAddedEntries(d1, d2)
103104
dels := GetDeletedEntries(d1, d2)

utils/tar_utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ func CheckTar(image string) bool {
127127
return false
128128
}
129129
if _, err := os.Stat(image); err != nil {
130+
glog.Errorf("%s does not exist", image)
130131
return false
131132
}
132133
return true

utils/tar_utils_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package utils
22

33
import (
4-
"fmt"
4+
//"fmt"
55
"errors"
66
"io"
77
"io/ioutil"
@@ -74,10 +74,10 @@ func TestUnTar(t *testing.T) {
7474
remove = false
7575
}
7676
if !dirEquals(test.expected, test.target) {
77-
d1, _ := GetDirectory(test.expected, true)
78-
fmt.Println(d1.Content)
79-
d2, _ := GetDirectory(test.target, true)
80-
fmt.Println(d2.Content)
77+
//d1, _ := GetDirectory(test.expected, true)
78+
//fmt.Println(d1.Content)
79+
//d2, _ := GetDirectory(test.target, true)
80+
//fmt.Println(d2.Content)
8181
t.Error(test.descrip, ": Directory created not correct structure.")
8282
remove = false
8383
}

0 commit comments

Comments
 (0)