Fixing version specification
This commit is contained in:
parent
ea96970aa5
commit
d83c654219
@ -69,7 +69,7 @@ func (db *database) load(dir string, index int, writable bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if index >= 0 {
|
if index > 0 {
|
||||||
db.vers = db.vers[:index]
|
db.vers = db.vers[:index]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ func (db *database) lastVersion() *version {
|
|||||||
|
|
||||||
func (db *database) dump() {
|
func (db *database) dump() {
|
||||||
for index, ver := range db.vers {
|
for index, ver := range db.vers {
|
||||||
fmt.Printf("version: %d\ttime: %s\n", index, ver.timestamp.String())
|
fmt.Printf("version: %d\ttime: %s\n", index+1, ver.timestamp.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
vfs.go
4
vfs.go
@ -40,7 +40,7 @@ func usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
version := flag.Int("version", -1, "version index (specify -1 for latest)")
|
version := flag.Int("version", 0, "version index (specify 0 for latest)")
|
||||||
readonly := flag.Bool("readonly", false, "mount filesystem as readonly")
|
readonly := flag.Bool("readonly", false, "mount filesystem as readonly")
|
||||||
flag.Usage = usage
|
flag.Usage = usage
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -51,7 +51,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mount := flag.NArg() > 1
|
mount := flag.NArg() > 1
|
||||||
writable := mount && !*readonly && *version < 0
|
writable := mount && !*readonly && *version == 0
|
||||||
|
|
||||||
db, err := newDatabase(flag.Arg(0), *version, writable)
|
db, err := newDatabase(flag.Arg(0), *version, writable)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user