Skip to content

Commit acf7828

Browse files
avargitster
authored andcommitted
built-ins: consistently add "\n" between "usage" and options
Change commands in the "diff" family and "rev-list" to separate the usage information and option listing with an empty line. In the case of "git diff -h" we did this already (but let's use a consistent "\n" pattern there), for the rest these are now consistent with how the parse_options() API would emit usage. As we'll see in a subsequent commit this also helps to make the "git <cmd> -h" output more easily machine-readable, as we can assume that the usage information is separated from the options by an empty line. Note that "COMMON_DIFF_OPTIONS_HELP" starts with a "\n", so the seeming omission of a "\n" here is correct, the second one is provided by the macro. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6df5494 commit acf7828

File tree

5 files changed

+6
-1
lines changed

5 files changed

+6
-1
lines changed

builtin/diff-files.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
static const char diff_files_usage[] =
1717
"git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]"
18+
"\n"
1819
COMMON_DIFF_OPTIONS_HELP;
1920

2021
int cmd_diff_files(int argc, const char **argv, const char *prefix)

builtin/diff-index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
static const char diff_cache_usage[] =
1212
"git diff-index [-m] [--cached] "
1313
"[<common-diff-options>] <tree-ish> [<path>...]"
14+
"\n"
1415
COMMON_DIFF_OPTIONS_HELP;
1516

1617
int cmd_diff_index(int argc, const char **argv, const char *prefix)

builtin/diff-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ static int diff_tree_stdin(char *line)
8585
static const char diff_tree_usage[] =
8686
"git diff-tree [--stdin] [-m] [-c | --cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
8787
"[<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n"
88+
"\n"
8889
" -r diff recursively\n"
8990
" -c show combined diff for merge commits\n"
9091
" --cc show combined diff for merge commits removing uninteresting hunks\n"

builtin/diff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ static const char builtin_diff_usage[] =
3030
" or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n"
3131
" or: git diff [<options>] <commit>...<commit> [--] [<path>...]\n"
3232
" or: git diff [<options>] <blob> <blob>\n"
33-
" or: git diff [<options>] --no-index [--] <path> <path>\n"
33+
" or: git diff [<options>] --no-index [--] <path> <path>"
34+
"\n"
3435
COMMON_DIFF_OPTIONS_HELP;
3536

3637
static const char *blob_path(struct object_array_entry *entry)

builtin/rev-list.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
static const char rev_list_usage[] =
2323
"git rev-list [<options>] <commit-id>... [-- <path>...]\n"
24+
"\n"
2425
" limiting output:\n"
2526
" --max-count=<n>\n"
2627
" --max-age=<epoch>\n"

0 commit comments

Comments
 (0)