Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 5f4284e

Browse files
authored
Merge pull request #700 from darkowlzz/698-backup-preserve-vendor-dot-git
Copy vendor/ when backing up and preserve .git
2 parents 18ebb09 + 4470034 commit 5f4284e

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

project.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ func BackupVendor(vpath, suffix string) (string, error) {
8282
vendorbak := filepath.Join(vpathDir, "_"+name+"-"+suffix)
8383
// Check if a directory with same name exists
8484
if _, err = os.Stat(vendorbak); os.IsNotExist(err) {
85-
// Rename existing vendor to vendor-{suffix}
86-
if err := fs.RenameWithFallback(vpath, vendorbak); err != nil {
85+
// Copy existing vendor to vendor-{suffix}
86+
if err := fs.CopyDir(vpath, vendorbak); err != nil {
8787
return "", err
8888
}
8989
return vendorbak, nil

project_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ func TestBackupVendor(t *testing.T) {
138138
t.Fatal(err)
139139
}
140140

141-
// Create another vendor directory. Previous vendor moved as backup.
142-
os.MkdirAll("vendor", 0777)
143-
pc.CopyFile(dummyFile, "txn_writer/badinput_fileroot")
144-
145141
// Should return error on creating backup with existing filename
146142
vendorbak, err = BackupVendor("vendor", "sfx")
147143

0 commit comments

Comments
 (0)