@@ -64,7 +64,7 @@ usage()
6464 << " -followsymlinks true |(false) follow symlinks\n "
6565 << " -removeidentinode (true)| false ignore files with nonunique "
6666 " device and inode\n "
67- << " -checksum md5 |(sha1)| sha256 | sha512 | xxh128\n "
67+ << " -checksum none | md5 |(sha1)| sha256 | sha512 | xxh128\n "
6868 << indent << " checksum type\n "
6969 << indent << " xxh128 is very fast, but is noncryptographic.\n "
7070 << " -buffersize N\n "
@@ -116,6 +116,7 @@ struct Options
116116 bool usesha256 = false ; // use sha256 checksum to check for similarity
117117 bool usesha512 = false ; // use sha512 checksum to check for similarity
118118 bool usexxh128 = false ; // use xxh128 checksum to check for similarity
119+ bool nochecksum = false ; // skip using checksumming (unsafe!)
119120 bool deterministic = true ; // be independent of filesystem order
120121 bool showprogress = false ; // show progress while reading file contents
121122 std::size_t buffersize = 1 << 20 ; // chunksize to use when reading files
@@ -196,8 +197,12 @@ parseOptions(Parser& parser)
196197 " reconfigure and rebuild '--with-xxhash'\n " ;
197198 std::exit (EXIT_FAILURE);
198199#endif
200+ } else if (parser.parsed_string_is (" none" )) {
201+ std::cout
202+ << " DANGER! -checksum none given, will skip the checksumming stage\n " ;
203+ o.nochecksum = true ;
199204 } else {
200- std::cerr << " expected md5/sha1/sha256/sha512/xxh128, not \" "
205+ std::cerr << " expected none/ md5/sha1/sha256/sha512/xxh128, not \" "
201206 << parser.get_parsed_string () << " \"\n " ;
202207 std::exit (EXIT_FAILURE);
203208 }
@@ -273,8 +278,9 @@ parseOptions(Parser& parser)
273278
274279 // done with parsing of options. remaining arguments are files and dirs.
275280
276- // decide what checksum to use - if no checksum is set, force sha1!
277- if (!o.usemd5 && !o.usesha1 && !o.usesha256 && !o.usesha512 && !o.usexxh128 ) {
281+ // decide what checksum to use, default to sha1
282+ if (!o.usemd5 && !o.usesha1 && !o.usesha256 && !o.usesha512 && !o.usexxh128 &&
283+ !o.nochecksum ) {
278284 o.usesha1 = true ;
279285 }
280286 return o;
0 commit comments