From: Rob Browning Date: Fri, 8 Nov 2013 17:35:44 +0000 (-0600) Subject: Only allow "index --clear" to clear the default index (BUP_DIR/bupindex). X-Git-Tag: 0.25-rc4~6 X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=98915e18605d385d7f62e024a0ae0d5e3a025023 Only allow "index --clear" to clear the default index (BUP_DIR/bupindex). For now, disallow clearing "external" indexes. Signed-off-by: Rob Browning --- diff --git a/Documentation/bup-index.md b/Documentation/bup-index.md index c5f1b61..c9621bd 100644 --- a/Documentation/bup-index.md +++ b/Documentation/bup-index.md @@ -139,7 +139,7 @@ does, due to the accommodations described above. updating. Mostly useful for automated tests. \--clear -: clear the index. +: clear the default index. -f, \--indexfile=*indexfile* : use a different index filename instead of diff --git a/cmd/index-cmd.py b/cmd/index-cmd.py index 539bc50..8521b60 100755 --- a/cmd/index-cmd.py +++ b/cmd/index-cmd.py @@ -177,7 +177,7 @@ m,modified print only added/deleted/modified files (implies -p) s,status print each filename with a status char (A/M/D) (implies -p) u,update recursively update the index entries for the given file/dir names (default if no mode is specified) check carefully check index file integrity -clear clear the index +clear clear the default index Options: H,hash print the hash for each object next to its name l,long print more information about each file @@ -205,6 +205,8 @@ if (opt.fake_valid or opt.fake_invalid) and not opt.update: o.fatal('--fake-{in,}valid are meaningless without -u') if opt.fake_valid and opt.fake_invalid: o.fatal('--fake-valid is incompatible with --fake-invalid') +if opt.clear and opt.indexfile: + o.fatal('cannot clear an external index (via -f)') # FIXME: remove this once we account for timestamp races, i.e. index; # touch new-file; index. It's possible for this to happen quickly