Skip to content

Commit 72540db

Browse files
committed
[clang-format][NFC] Reformat git-clang-format
1 parent 862e719 commit 72540db

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

clang/tools/clang-format/git-clang-format

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ import re
3232
import subprocess
3333
import sys
3434

35-
usage = (
36-
"git clang-format [OPTIONS] [<commit>] [<commit>|--staged] [--] [<file>...]"
37-
)
35+
usage = "git clang-format [OPTIONS] [<commit>] [<commit>|--staged] [--] [<file>...]"
3836

3937
desc = """
4038
If zero or one commits are given, run clang-format on all lines that differ
@@ -236,10 +234,7 @@ def main():
236234
if not opts.diff:
237235
die("--diff is required when two commits are given")
238236
elif opts.diff_from_common_commit:
239-
die(
240-
"--diff_from_common_commit is only allowed when two commits are "
241-
"given"
242-
)
237+
die("--diff_from_common_commit is only allowed when two commits are given")
243238

244239
if os.path.dirname(opts.binary):
245240
opts.binary = os.path.abspath(opts.binary)
@@ -385,10 +380,7 @@ def disambiguate_revision(value):
385380
return False
386381
if object_type in ("commit", "tag"):
387382
return True
388-
die(
389-
"`%s` is a %s, but a commit or filename was expected"
390-
% (value, object_type)
391-
)
383+
die("`%s` is a %s, but a commit or filename was expected" % (value, object_type))
392384

393385

394386
def get_object_type(value):
@@ -463,9 +455,7 @@ def extract_lines(patch_file):
463455
line_count = 1
464456
if start_line == 0:
465457
continue
466-
matches.setdefault(filename, []).append(
467-
Range(start_line, line_count)
468-
)
458+
matches.setdefault(filename, []).append(Range(start_line, line_count))
469459
return matches
470460

471461

@@ -780,13 +770,10 @@ def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
780770
.split("\0")
781771
)
782772
if not force:
783-
unstaged_files = run(
784-
"git", "diff-files", "--name-status", *changed_files
785-
)
773+
unstaged_files = run("git", "diff-files", "--name-status", *changed_files)
786774
if unstaged_files:
787775
print(
788-
"The following files would be modified but have unstaged "
789-
"changes:",
776+
"The following files would be modified but have unstaged changes:",
790777
file=sys.stderr,
791778
)
792779
print(unstaged_files, file=sys.stderr)
@@ -828,17 +815,13 @@ def run(*args, **kwargs):
828815
if p.returncode == 0:
829816
if stderr:
830817
if verbose:
831-
print(
832-
"`%s` printed to stderr:" % " ".join(args), file=sys.stderr
833-
)
818+
print("`%s` printed to stderr:" % " ".join(args), file=sys.stderr)
834819
print(stderr.rstrip(), file=sys.stderr)
835820
if strip:
836821
stdout = stdout.rstrip("\r\n")
837822
return stdout
838823
if verbose:
839-
print(
840-
"`%s` returned %s" % (" ".join(args), p.returncode), file=sys.stderr
841-
)
824+
print("`%s` returned %s" % (" ".join(args), p.returncode), file=sys.stderr)
842825
if stderr:
843826
print(stderr.rstrip(), file=sys.stderr)
844827
sys.exit(2)

0 commit comments

Comments
 (0)