mirror of
https://github.com/schollz/croc.git
synced 2025-10-10 21:01:02 +02:00
fix
This commit is contained in:
parent
dfcd032af5
commit
e8758f6a94
4 changed files with 49 additions and 52 deletions
|
@ -4,7 +4,7 @@
|
|||
src="https://user-images.githubusercontent.com/6550035/46709024-9b23ad00-cbf6-11e8-9fb2-ca8b20b7dbec.jpg"
|
||||
width="408px" border="0" alt="croc">
|
||||
<br>
|
||||
<a href="https://github.com/schollz/croc/releases/latest"><img src="https://img.shields.io/badge/version-v10.2.0-brightgreen.svg?style=flat-square" alt="Version"></a>
|
||||
<a href="https://github.com/schollz/croc/releases/latest"><img src="https://img.shields.io/badge/version-v10.2.1-brightgreen.svg?style=flat-square" alt="Version"></a>
|
||||
<a href="https://github.com/schollz/croc/actions/workflows/ci.yml"><img
|
||||
src="https://github.com/schollz/croc/actions/workflows/ci.yml/badge.svg" alt="Build
|
||||
Status"></a>
|
||||
|
|
|
@ -36,7 +36,7 @@ func Run() (err error) {
|
|||
app := cli.NewApp()
|
||||
app.Name = "croc"
|
||||
if Version == "" {
|
||||
Version = "v10.2.0"
|
||||
Version = "v10.2.1"
|
||||
}
|
||||
app.Version = Version
|
||||
app.Compiled = time.Now()
|
||||
|
@ -431,6 +431,49 @@ Or you can go back to the classic croc behavior by enabling classic mode:
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
minimalFileInfosInclude := []croc.FileInfo{}
|
||||
exclusions := []string{}
|
||||
for _, exclude := range crocOptions.Exclude {
|
||||
exclusions = append(exclusions, strings.ToLower(exclude))
|
||||
}
|
||||
for _, f := range minimalFileInfos {
|
||||
exclude := false
|
||||
for _, exclusion := range exclusions {
|
||||
if strings.Contains(path.Join(strings.ToLower(f.FolderRemote), strings.ToLower(f.Name)), exclusion) {
|
||||
exclude = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !exclude {
|
||||
minimalFileInfosInclude = append(minimalFileInfosInclude, f)
|
||||
}
|
||||
}
|
||||
emptyFoldersToTransferInclude := []croc.FileInfo{}
|
||||
for _, f := range emptyFoldersToTransfer {
|
||||
exclude := false
|
||||
for _, exclusion := range exclusions {
|
||||
if strings.Contains(path.Join(strings.ToLower(f.FolderRemote), strings.ToLower(f.Name)), exclusion) {
|
||||
exclude = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !exclude {
|
||||
emptyFoldersToTransferInclude = append(emptyFoldersToTransferInclude, f)
|
||||
}
|
||||
}
|
||||
|
||||
totalNumberFolders = 0
|
||||
folderMap := make(map[string]bool)
|
||||
for _, f := range minimalFileInfosInclude {
|
||||
folderMap[f.FolderRemote] = true
|
||||
log.Tracef("zxvc file: %+v", f)
|
||||
// is folder
|
||||
}
|
||||
for _, f := range emptyFoldersToTransferInclude {
|
||||
log.Tracef("zxvc folder: %+v", f)
|
||||
}
|
||||
totalNumberFolders = len(folderMap)
|
||||
log.Debugf("zxvc total number of folders: %d", totalNumberFolders)
|
||||
|
||||
cr, err := croc.New(crocOptions)
|
||||
if err != nil {
|
||||
|
@ -440,7 +483,7 @@ Or you can go back to the classic croc behavior by enabling classic mode:
|
|||
// save the config
|
||||
saveConfig(c, crocOptions)
|
||||
|
||||
err = cr.Send(minimalFileInfos, emptyFoldersToTransfer, totalNumberFolders)
|
||||
err = cr.Send(minimalFileInfosInclude, emptyFoldersToTransferInclude, totalNumberFolders)
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -423,21 +423,6 @@ func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool, exclusions []
|
|||
TempFile: true,
|
||||
IsIgnored: ignoredPaths[absPath],
|
||||
}
|
||||
// check if exclusions apply to this file
|
||||
if len(exclusions) > 0 && !fInfo.IsIgnored {
|
||||
allFiles, _ := recursiveFiles(absPath)
|
||||
for _, exclusion := range exclusions {
|
||||
for _, file := range allFiles {
|
||||
if strings.Contains(strings.ToLower(file), strings.ToLower(exclusion)) {
|
||||
fInfo.IsIgnored = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored {
|
||||
continue
|
||||
}
|
||||
|
@ -470,23 +455,7 @@ func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool, exclusions []
|
|||
TempFile: false,
|
||||
IsIgnored: ignoredPaths[pathName],
|
||||
}
|
||||
// check if exclusions apply to this file
|
||||
if len(exclusions) > 0 && !fInfo.IsIgnored {
|
||||
allFiles, _ := recursiveFiles(pathName)
|
||||
for _, exclusion := range exclusions {
|
||||
for _, file := range allFiles {
|
||||
log.Tracef("ignoring test: %s %s %v", strings.ToLower(file), strings.ToLower(exclusion), strings.Contains(strings.ToLower(file), strings.ToLower(exclusion)))
|
||||
if strings.Contains(strings.ToLower(file), strings.ToLower(exclusion)) {
|
||||
fInfo.IsIgnored = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored && (ignoreGit || len(exclusions) > 0) {
|
||||
if fInfo.IsIgnored && ignoreGit {
|
||||
return nil
|
||||
} else {
|
||||
filesInfo = append(filesInfo, fInfo)
|
||||
|
@ -522,22 +491,7 @@ func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool, exclusions []
|
|||
TempFile: false,
|
||||
IsIgnored: ignoredPaths[absPath],
|
||||
}
|
||||
if len(exclusions) > 0 && !fInfo.IsIgnored {
|
||||
allFiles, _ := recursiveFiles(absPath)
|
||||
for _, exclusion := range exclusions {
|
||||
for _, file := range allFiles {
|
||||
log.Tracef("ignoring test: %s %s %v", strings.ToLower(file), strings.ToLower(exclusion), strings.Contains(strings.ToLower(file), strings.ToLower(exclusion)))
|
||||
if strings.Contains(strings.ToLower(file), strings.ToLower(exclusion)) {
|
||||
fInfo.IsIgnored = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if fInfo.IsIgnored && (ignoreGit || len(exclusions) > 0) {
|
||||
if fInfo.IsIgnored && ignoreGit {
|
||||
continue
|
||||
} else {
|
||||
filesInfo = append(filesInfo, fInfo)
|
||||
|
|
|
@ -528,7 +528,7 @@ main() {
|
|||
local autocomplete_install_rcode
|
||||
|
||||
croc_bin_name="croc"
|
||||
croc_version="10.2.0"
|
||||
croc_version="10.2.1"
|
||||
croc_dl_ext="tar.gz"
|
||||
croc_base_url="https://github.com/schollz/croc/releases/download"
|
||||
prefix="${1}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue