mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Staggered versioning should use current time for filename tag (fixes #994)
This commit is contained in:
parent
7cd25c919f
commit
c7e779107c
@ -289,8 +289,7 @@ func (v Staggered) Archive(filePath string) error {
|
|||||||
v.mutex.Lock()
|
v.mutex.Lock()
|
||||||
defer v.mutex.Unlock()
|
defer v.mutex.Unlock()
|
||||||
|
|
||||||
fileInfo, err := os.Stat(filePath)
|
if _, err := os.Stat(filePath); err != nil {
|
||||||
if err != nil {
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugln("not archiving nonexistent file", filePath)
|
l.Debugln("not archiving nonexistent file", filePath)
|
||||||
@ -301,8 +300,7 @@ func (v Staggered) Archive(filePath string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = os.Stat(v.versionsPath)
|
if _, err := os.Stat(v.versionsPath); err != nil {
|
||||||
if err != nil {
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugln("creating versions dir", v.versionsPath)
|
l.Debugln("creating versions dir", v.versionsPath)
|
||||||
@ -330,7 +328,7 @@ func (v Staggered) Archive(filePath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ver := taggedFilename(file, fileInfo.ModTime().Format(TimeFormat))
|
ver := taggedFilename(file, time.Now().Format(TimeFormat))
|
||||||
dst := filepath.Join(dir, ver)
|
dst := filepath.Join(dir, ver)
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugln("moving to", dst)
|
l.Debugln("moving to", dst)
|
||||||
|
Loading…
Reference in New Issue
Block a user