From cc0c6726974965eb556c62a60db496095253fb82 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 20 Mar 2018 14:10:13 -0700 Subject: [PATCH] Add support for dest = '.' and additional DestinationFilepath test --- pkg/util/command_util.go | 2 +- pkg/util/command_util_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/util/command_util.go b/pkg/util/command_util.go index 4e5da9626..38521231a 100644 --- a/pkg/util/command_util.go +++ b/pkg/util/command_util.go @@ -80,7 +80,7 @@ func matchSources(srcs, files []string) ([]string, error) { } func IsDestDir(path string) bool { - return strings.HasSuffix(path, "/") + return strings.HasSuffix(path, "/") || path == "." } // DestinationFilepath returns the destination filepath from the build context to the image filesystem diff --git a/pkg/util/command_util_test.go b/pkg/util/command_util_test.go index 7680dbcfd..2d96f8d2a 100644 --- a/pkg/util/command_util_test.go +++ b/pkg/util/command_util_test.go @@ -109,6 +109,13 @@ var destinationFilepathTests = []struct { dest: "/dir", expectedFilepath: "/dir/context/bar", }, + { + srcName: "context/foo", + filename: "context/foo", + cwd: "/test", + dest: ".", + expectedFilepath: "/test/foo", + }, } func Test_DestinationFilepath(t *testing.T) {