From cbc061a66ec1e45d7f0126787b574549c25f9cd7 Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Thu, 26 Feb 2026 23:17:48 +0000 Subject: [PATCH 1/6] Add support for setting `--ignore-ctime` and `--ignore-inode` via environment variables --- cmd/restic/cmd_backup.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index f9b45fe51..741e49665 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -133,8 +133,23 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { f.StringArrayVar(&opts.FilesFromRaw, "files-from-raw", nil, "read the files to backup from `file` (can be combined with file args; can be specified multiple times)") f.StringVar(&opts.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)") f.BoolVar(&opts.WithAtime, "with-atime", false, "store the atime for all files and directories") - f.BoolVar(&opts.IgnoreInode, "ignore-inode", false, "ignore inode number and ctime changes when checking for modified files") - f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", false, "ignore ctime changes when checking for modified files") + + // Use environment to set the default value if available + ignoreInodeDefault := false + if v := os.Getenv("RESTIC_IGNORE_INODE"); v != "" { + if b, err := strconv.ParseBool(v); err == nil { + ignoreInodeDefault = b + } + } + ignoreCtimeDefault := false + if v := os.Getenv("RESTIC_IGNORE_CTIME"); v != "" { + if b, err := strconv.ParseBool(v); err == nil { + ignoreCtimeDefault = b + } + } + + f.BoolVar(&opts.IgnoreInode, "ignore-inode", ignoreInodeDefault, "ignore inode number and ctime changes when checking for modified files") + f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", ignoreCtimeDefault, "ignore ctime changes when checking for modified files") f.BoolVarP(&opts.DryRun, "dry-run", "n", false, "do not upload or write any data, just show what would be done") f.BoolVar(&opts.NoScan, "no-scan", false, "do not run scanner to estimate size of backup") if runtime.GOOS == "windows" { From 556349be0098597882e217a14b68a9803f7d88aa Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Thu, 26 Feb 2026 23:42:42 +0000 Subject: [PATCH 2/6] add docs --- doc/075_scripting.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/075_scripting.rst b/doc/075_scripting.rst index f0c225d84..fa5c281f0 100644 --- a/doc/075_scripting.rst +++ b/doc/075_scripting.rst @@ -41,6 +41,8 @@ environment variables, which are listed below. RESTIC_PROGRESS_FPS Frames per second by which the progress bar is updated RESTIC_PACK_SIZE Target size for pack files RESTIC_READ_CONCURRENCY Concurrency for file reads + RESTIC_IGNORE_CTIME Ignore ctime changes when comparing files (replaces --ignore-ctime) + RESTIC_IGNORE_INODE Ignore inode changes when comparing files (replaces --ignore-inode) TMPDIR Location for temporary files (except Windows) TMP Location for temporary files (only Windows) From 9f7d2de7f39c79fca001863e5d6dcc4b56ae86eb Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Fri, 27 Feb 2026 00:04:56 +0000 Subject: [PATCH 3/6] refactor to match readConcurrency --- cmd/restic/cmd_backup.go | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 741e49665..d7c8043c8 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -134,22 +134,8 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { f.StringVar(&opts.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)") f.BoolVar(&opts.WithAtime, "with-atime", false, "store the atime for all files and directories") - // Use environment to set the default value if available - ignoreInodeDefault := false - if v := os.Getenv("RESTIC_IGNORE_INODE"); v != "" { - if b, err := strconv.ParseBool(v); err == nil { - ignoreInodeDefault = b - } - } - ignoreCtimeDefault := false - if v := os.Getenv("RESTIC_IGNORE_CTIME"); v != "" { - if b, err := strconv.ParseBool(v); err == nil { - ignoreCtimeDefault = b - } - } - - f.BoolVar(&opts.IgnoreInode, "ignore-inode", ignoreInodeDefault, "ignore inode number and ctime changes when checking for modified files") - f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", ignoreCtimeDefault, "ignore ctime changes when checking for modified files") + f.BoolVar(&opts.IgnoreInode, "ignore-inode", false, "ignore inode number and ctime changes when checking for modified files") + f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", false, "ignore ctime changes when checking for modified files") f.BoolVarP(&opts.DryRun, "dry-run", "n", false, "do not upload or write any data, just show what would be done") f.BoolVar(&opts.NoScan, "no-scan", false, "do not run scanner to estimate size of backup") if runtime.GOOS == "windows" { @@ -164,6 +150,10 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { readConcurrency, _ := strconv.ParseUint(os.Getenv("RESTIC_READ_CONCURRENCY"), 10, 32) opts.ReadConcurrency = uint(readConcurrency) + // parse read inode and ctime from env, on error the default value will be used + opts.IgnoreInode, _ := strconv.ParseBool(os.Getenv("RESTIC_IGNORE_INODE")) + opts.IgnoreCtime, _ := strconv.ParseBool(os.Getenv("RESTIC_IGNORE_CTIME")) + // parse host from env, if not exists or empty the default value will be used if host := os.Getenv("RESTIC_HOST"); host != "" { opts.Host = host From 2bc03b79638163bc4799946a17280c75999b4967 Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Fri, 27 Feb 2026 00:05:31 +0000 Subject: [PATCH 4/6] remove new line --- cmd/restic/cmd_backup.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index d7c8043c8..83d10062e 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -133,7 +133,6 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { f.StringArrayVar(&opts.FilesFromRaw, "files-from-raw", nil, "read the files to backup from `file` (can be combined with file args; can be specified multiple times)") f.StringVar(&opts.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)") f.BoolVar(&opts.WithAtime, "with-atime", false, "store the atime for all files and directories") - f.BoolVar(&opts.IgnoreInode, "ignore-inode", false, "ignore inode number and ctime changes when checking for modified files") f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", false, "ignore ctime changes when checking for modified files") f.BoolVarP(&opts.DryRun, "dry-run", "n", false, "do not upload or write any data, just show what would be done") From 8b85047b6b7dfd71589ef17f1600a00f02e5ef3d Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Tue, 3 Mar 2026 20:35:15 +0000 Subject: [PATCH 5/6] fix compilation error --- cmd/restic/cmd_backup.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 83d10062e..2ef123fbe 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -150,8 +150,8 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { opts.ReadConcurrency = uint(readConcurrency) // parse read inode and ctime from env, on error the default value will be used - opts.IgnoreInode, _ := strconv.ParseBool(os.Getenv("RESTIC_IGNORE_INODE")) - opts.IgnoreCtime, _ := strconv.ParseBool(os.Getenv("RESTIC_IGNORE_CTIME")) + opts.IgnoreInode, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_INODE")) + opts.IgnoreCtime, _ = strconv.ParseBool(os.Getenv("RESTIC_IGNORE_CTIME")) // parse host from env, if not exists or empty the default value will be used if host := os.Getenv("RESTIC_HOST"); host != "" { From f1d3f7150ef4d434b2d5f7bf5f8df75755411ce7 Mon Sep 17 00:00:00 2001 From: astro-stan <36302090+astro-stan@users.noreply.github.com> Date: Tue, 3 Mar 2026 20:35:37 +0000 Subject: [PATCH 6/6] add cli docs --- cmd/restic/cmd_backup.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 2ef123fbe..a53c08cfb 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -133,8 +133,8 @@ func (opts *BackupOptions) AddFlags(f *pflag.FlagSet) { f.StringArrayVar(&opts.FilesFromRaw, "files-from-raw", nil, "read the files to backup from `file` (can be combined with file args; can be specified multiple times)") f.StringVar(&opts.TimeStamp, "time", "", "`time` of the backup (ex. '2012-11-01 22:08:41') (default: now)") f.BoolVar(&opts.WithAtime, "with-atime", false, "store the atime for all files and directories") - f.BoolVar(&opts.IgnoreInode, "ignore-inode", false, "ignore inode number and ctime changes when checking for modified files") - f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", false, "ignore ctime changes when checking for modified files") + f.BoolVar(&opts.IgnoreInode, "ignore-inode", false, "ignore inode number and ctime changes when checking for modified files (default: $RESTIC_IGNORE_INODE or false)") + f.BoolVar(&opts.IgnoreCtime, "ignore-ctime", false, "ignore ctime changes when checking for modified files (default: $RESTIC_IGNORE_CTIME or false)") f.BoolVarP(&opts.DryRun, "dry-run", "n", false, "do not upload or write any data, just show what would be done") f.BoolVar(&opts.NoScan, "no-scan", false, "do not run scanner to estimate size of backup") if runtime.GOOS == "windows" {