func PreserveTrailingDotOrSeparator(cleanedPath, originalPath string) string {
	cleanedPath = normalizePath(cleanedPath)
	originalPath = normalizePath(originalPath)
	if !specifiesCurrentDir(cleanedPath) && specifiesCurrentDir(originalPath) {
		if !hasTrailingPathSeparator(cleanedPath) {
			cleanedPath += string(filepath.Separator)
		}
		cleanedPath += "."
	}
	if !hasTrailingPathSeparator(cleanedPath) && hasTrailingPathSeparator(originalPath) {
		cleanedPath += string(filepath.Separator)
	}
	return cleanedPath
}
PreserveTrailingDotOrSeparator returns the given cleaned path (after
processing using any utility functions from the path or filepath stdlib
packages) and appends a trailing `/.` or `/` if its corresponding  original
path (from before being processed by utility functions from the path or
filepath stdlib packages) ends with a trailing `/.` or `/`. If the cleaned
path already ends in a `.` path segment, then another is not added. If the
clean path already ends in a path separator, then another is not added.
package archive
import (
	"archive/tar"
	"errors"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/docker/docker/pkg/system"
	"github.com/sirupsen/logrus"
)
var (
	ErrNotDirectory      = errors.New("not a directory")
	ErrDirNotExists      = errors.New("no such directory")
	ErrCannotCopyDir     = errors.New("cannot copy directory")
	ErrInvalidCopySource = errors.New("invalid copy source content")
)