зеркало из https://github.com/golang/dep.git
Copy vendor/ when backing up and preserve .git
Replaces renaming with copying vendor/ while backing up. This keeps the original vendor/ and lets SafeWriter.Write() preserve vendor/.git if any.
This commit is contained in:
Родитель
1c168c0d47
Коммит
4470034c1a
|
@ -82,8 +82,8 @@ func BackupVendor(vpath, suffix string) (string, error) {
|
|||
vendorbak := filepath.Join(vpathDir, "_"+name+"-"+suffix)
|
||||
// Check if a directory with same name exists
|
||||
if _, err = os.Stat(vendorbak); os.IsNotExist(err) {
|
||||
// Rename existing vendor to vendor-{suffix}
|
||||
if err := fs.RenameWithFallback(vpath, vendorbak); err != nil {
|
||||
// Copy existing vendor to vendor-{suffix}
|
||||
if err := fs.CopyDir(vpath, vendorbak); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return vendorbak, nil
|
||||
|
|
|
@ -138,10 +138,6 @@ func TestBackupVendor(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Create another vendor directory. Previous vendor moved as backup.
|
||||
os.MkdirAll("vendor", 0777)
|
||||
pc.CopyFile(dummyFile, "txn_writer/badinput_fileroot")
|
||||
|
||||
// Should return error on creating backup with existing filename
|
||||
vendorbak, err = BackupVendor("vendor", "sfx")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче