From 8e07bbfaccde543721505b366f1849697b009022 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 7 Apr 2018 15:04:44 -0500 Subject: [PATCH] split: don't require a repo unless we need it This can be handy if you just want to test split performance, e.g. time ./bup split --noop whatever etc. Signed-off-by: Rob Browning Tested-by: Rob Browning --- cmd/split-cmd.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/split-cmd.py b/cmd/split-cmd.py index fd8a99c..71e365e 100755 --- a/cmd/split-cmd.py +++ b/cmd/split-cmd.py @@ -42,11 +42,11 @@ fanout= average number of blobs in a single tree bwlimit= maximum bytes/sec to transmit to server #,compress= set compression level to # (0-9, 9 is highest) [1] """ +handle_ctrl_c() + o = options.Options(optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) -handle_ctrl_c() -git.check_repo_or_die() if not (opt.blobs or opt.tree or opt.commit or opt.name or opt.noop or opt.copy): o.fatal("use one or more of -b, -t, -c, -n, --noop, --copy") @@ -100,15 +100,18 @@ start_time = time.time() if opt.name and not valid_save_name(opt.name): o.fatal("'%s' is not a valid branch name." % opt.name) refname = opt.name and 'refs/heads/%s' % opt.name or None + if opt.noop or opt.copy: cli = pack_writer = oldref = None elif opt.remote or is_reverse: + git.check_repo_or_die() cli = client.Client(opt.remote) oldref = refname and cli.read_ref(refname) or None pack_writer = cli.new_packwriter(compression_level=opt.compress, max_pack_size=max_pack_size, max_pack_objects=max_pack_objects) else: + git.check_repo_or_die() cli = None oldref = refname and git.read_ref(refname) or None pack_writer = git.PackWriter(compression_level=opt.compress, -- 2.39.2