Don't delete dist-git files

This commit is contained in:
Mustafa Gezen 2021-03-18 18:56:47 +01:00
parent 49a37518bc
commit 7de3f16426

View File

@ -53,7 +53,7 @@ func ProcessRPM(pd *data.ProcessData) {
if pd.NoDupMode {
repo, err := git.Init(memory.NewStorage(), memfs.New())
if err != nil {
log.Fatalf("could not init git Repo: %v", err)
log.Fatalf("could not init git repo: %v", err)
}
remoteUrl := fmt.Sprintf("%s/%s/%s.git", pd.UpstreamPrefix, remotePrefix, gitlabify(md.RpmFile.Name()))
refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*")
@ -230,15 +230,14 @@ func ProcessRPM(pd *data.ProcessData) {
log.Fatalf("could not write to metadata file: %v", err)
}
path := checksum
if strContains(alreadyUploadedBlobs, path) {
if strContains(alreadyUploadedBlobs, checksum) {
continue
}
if !pd.BlobStorage.Exists(path) && !pd.NoStorageUpload {
pd.BlobStorage.Write(path, sourceFileBts)
log.Printf("wrote %s to blob storage", path)
if !pd.BlobStorage.Exists(checksum) && !pd.NoStorageUpload {
pd.BlobStorage.Write(checksum, sourceFileBts)
log.Printf("wrote %s to blob storage", checksum)
}
alreadyUploadedBlobs = append(alreadyUploadedBlobs, path)
alreadyUploadedBlobs = append(alreadyUploadedBlobs, checksum)
}
_, err = w.Add(metadataFile)
@ -257,6 +256,10 @@ func ProcessRPM(pd *data.ProcessData) {
}
}
if pd.TmpFsMode != "" {
continue
}
pd.Importer.PostProcess(md)
// show status
@ -275,10 +278,6 @@ func ProcessRPM(pd *data.ProcessData) {
}
}
if pd.TmpFsMode != "" {
continue
}
var hashes []plumbing.Hash
var pushRefspecs []config.RefSpec