mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'lo/repo-struct-z' into lo/repo-info-keys
* lo/repo-struct-z: repo: add -z as an alias for --format=nul to git-repo-structure repo: use [--format=... | -z] instead of [-z] in git-repo-info synopsis repo: remove blank line from Documentation/git-repo.adoc
This commit is contained in:
@@ -8,8 +8,8 @@ git-repo - Retrieve information about the repository
|
||||
SYNOPSIS
|
||||
--------
|
||||
[synopsis]
|
||||
git repo info [--format=(keyvalue|nul)] [-z] [--all | <key>...]
|
||||
git repo structure [--format=(table|keyvalue|nul)]
|
||||
git repo info [--format=(keyvalue|nul) | -z] [--all | <key>...]
|
||||
git repo structure [--format=(table|keyvalue|nul) | -z]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
@@ -19,7 +19,7 @@ THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
|
||||
|
||||
COMMANDS
|
||||
--------
|
||||
`info [--format=(keyvalue|nul)] [-z] [--all | <key>...]`::
|
||||
`info [--format=(keyvalue|nul) | -z] [--all | <key>...]`::
|
||||
Retrieve metadata-related information about the current repository. Only
|
||||
the requested data will be returned based on their keys (see "INFO KEYS"
|
||||
section below).
|
||||
@@ -44,13 +44,12 @@ supported:
|
||||
+
|
||||
`-z` is an alias for `--format=nul`.
|
||||
|
||||
`structure [--format=(table|keyvalue|nul)]`::
|
||||
`structure [--format=(table|keyvalue|nul) | -z]`::
|
||||
Retrieve statistics about the current repository structure. The
|
||||
following kinds of information are reported:
|
||||
+
|
||||
* Reference counts categorized by type
|
||||
* Reachable object counts categorized by type
|
||||
|
||||
+
|
||||
The output format can be chosen through the flag `--format`. Three formats are
|
||||
supported:
|
||||
@@ -72,6 +71,8 @@ supported:
|
||||
the delimiter between the key and value instead of '='. Unlike the
|
||||
`keyvalue` format, values containing "unusual" characters are never
|
||||
quoted.
|
||||
+
|
||||
`-z` is an alias for `--format=nul`.
|
||||
|
||||
INFO KEYS
|
||||
---------
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "utf8.h"
|
||||
|
||||
static const char *const repo_usage[] = {
|
||||
"git repo info [--format=(keyvalue|nul)] [-z] [--all | <key>...]",
|
||||
"git repo structure [--format=(table|keyvalue|nul)]",
|
||||
"git repo info [--format=(keyvalue|nul) | -z] [--all | <key>...]",
|
||||
"git repo structure [--format=(table|keyvalue|nul) | -z]",
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -529,6 +529,10 @@ static int cmd_repo_structure(int argc, const char **argv, const char *prefix,
|
||||
OPT_CALLBACK_F(0, "format", &format, N_("format"),
|
||||
N_("output format"),
|
||||
PARSE_OPT_NONEG, parse_format_cb),
|
||||
OPT_CALLBACK_F('z', NULL, &format, NULL,
|
||||
N_("synonym for --format=nul"),
|
||||
PARSE_OPT_NONEG | PARSE_OPT_NOARG,
|
||||
parse_format_cb),
|
||||
OPT_BOOL(0, "progress", &show_progress, N_("show progress")),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
@@ -101,6 +101,13 @@ test_expect_success 'keyvalue and nul format' '
|
||||
tr "\n=" "\0\n" <expect >expect_nul &&
|
||||
git repo structure --format=nul >out 2>err &&
|
||||
|
||||
test_cmp expect_nul out &&
|
||||
test_line_count = 0 err &&
|
||||
|
||||
# "-z", as a synonym to "--format=nul", participates in the
|
||||
# usual "last one wins" rule.
|
||||
git repo structure --format=table -z >out 2>err &&
|
||||
|
||||
test_cmp expect_nul out &&
|
||||
test_line_count = 0 err
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user