-if pack_writer and opt.blobs:
- shalist = hashsplit.split_to_blobs(pack_writer.new_blob, files,
+if pack_writer:
+ new_blob = pack_writer.new_blob
+ new_tree = pack_writer.new_tree
+elif opt.blobs or opt.tree:
+ # --noop mode
+ new_blob = lambda content: git.calc_hash(b'blob', content)
+ new_tree = lambda shalist: git.calc_hash(b'tree', git.tree_encode(shalist))
+
+sys.stdout.flush()
+out = byte_stream(sys.stdout)
+
+if opt.blobs:
+ shalist = hashsplit.split_to_blobs(new_blob, files,