mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Update vendored deps, including AWS SDK, openpgp, ftp, ...
This commit is contained in:
+1
-3
@@ -8,7 +8,6 @@ package storage
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type plan9FileLock struct {
|
||||
@@ -48,8 +47,7 @@ func rename(oldpath, newpath string) error {
|
||||
}
|
||||
}
|
||||
|
||||
_, fname := filepath.Split(newpath)
|
||||
return os.Rename(oldpath, fname)
|
||||
return os.Rename(oldpath, newpath)
|
||||
}
|
||||
|
||||
func syncDir(name string) error {
|
||||
|
||||
+6
-2
@@ -12,7 +12,11 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
const typeShift = 3
|
||||
const typeShift = 4
|
||||
|
||||
// Verify at compile-time that typeShift is large enough to cover all FileType
|
||||
// values by confirming that 0 == 0.
|
||||
var _ [0]struct{} = [TypeAll >> typeShift]struct{}{}
|
||||
|
||||
type memStorageLock struct {
|
||||
ms *memStorage
|
||||
@@ -143,7 +147,7 @@ func (ms *memStorage) Remove(fd FileDesc) error {
|
||||
}
|
||||
|
||||
func (ms *memStorage) Rename(oldfd, newfd FileDesc) error {
|
||||
if FileDescOk(oldfd) || FileDescOk(newfd) {
|
||||
if !FileDescOk(oldfd) || !FileDescOk(newfd) {
|
||||
return ErrInvalidFile
|
||||
}
|
||||
if oldfd == newfd {
|
||||
|
||||
+52
@@ -8,6 +8,7 @@ package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -63,3 +64,54 @@ func TestMemStorage(t *testing.T) {
|
||||
t.Fatal("expecting error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMemStorageRename(t *testing.T) {
|
||||
fd1 := FileDesc{Type: TypeTable, Num: 1}
|
||||
fd2 := FileDesc{Type: TypeTable, Num: 2}
|
||||
|
||||
m := NewMemStorage()
|
||||
w, err := m.Create(fd1)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.Create: %v", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "abc")
|
||||
w.Close()
|
||||
|
||||
rd, err := m.Open(fd1)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.Open(%v): %v", fd1, err)
|
||||
}
|
||||
rd.Close()
|
||||
|
||||
fds, err := m.List(TypeAll)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.List: %v", err)
|
||||
}
|
||||
for _, fd := range fds {
|
||||
if !FileDescOk(fd) {
|
||||
t.Errorf("Storage.List -> FileDescOk(%q)", fd)
|
||||
}
|
||||
}
|
||||
|
||||
err = m.Rename(fd1, fd2)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.Rename: %v", err)
|
||||
}
|
||||
|
||||
rd, err = m.Open(fd2)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.Open(%v): %v", fd2, err)
|
||||
}
|
||||
rd.Close()
|
||||
|
||||
fds, err = m.List(TypeAll)
|
||||
if err != nil {
|
||||
t.Fatalf("Storage.List: %v", err)
|
||||
}
|
||||
for _, fd := range fds {
|
||||
if !FileDescOk(fd) {
|
||||
t.Errorf("Storage.List -> FileDescOk(%q)", fd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user