-
-
Save fd0/fcaf7a0cbc35b4e0bebc901fbacd3860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go | |
index 4e78a153..76303f85 100644 | |
--- a/cmd/restic/cmd_backup.go | |
+++ b/cmd/restic/cmd_backup.go | |
@@ -255,10 +255,13 @@ func readBackupFromStdin(opts BackupOptions, gopts GlobalOptions, args []string) | |
return err | |
} | |
- lock, err := lockRepo(repo) | |
- defer unlockRepo(lock) | |
- if err != nil { | |
- return err | |
+ if !gopts.NoLock { | |
+ Warnf("WARNING: No lock file is being created, this may lead to data loss!\n") | |
+ lock, err := lockRepo(repo) | |
+ defer unlockRepo(lock) | |
+ if err != nil { | |
+ return err | |
+ } | |
} | |
err = repo.LoadIndex(gopts.ctx) | |
@@ -393,10 +396,13 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error { | |
return err | |
} | |
- lock, err := lockRepo(repo) | |
- defer unlockRepo(lock) | |
- if err != nil { | |
- return err | |
+ if !gopts.NoLock { | |
+ Warnf("WARNING: No lock file is being created, this may lead to data loss!\n") | |
+ lock, err := lockRepo(repo) | |
+ defer unlockRepo(lock) | |
+ if err != nil { | |
+ return err | |
+ } | |
} | |
// exclude restic cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment