Re: [PATCH v9 0/3]
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> David Turner <dturner@twopensource.com> writes:
>
>> Oops, forgot to ammend commit before patch v8. This patch *really*
>> includes the switch and type casting fixes.
>
> Thanks. Will replace.
I've placed the attached change on top as a suggested fix-up.
The reasons for the first two hunks should be obvious.
The last hunk is because:
* "--follow-symlinks" (currently) works only with "--batch{-check}",
so it flows more natural to show it after them. * "in-repo" is a wrong phrase, I think. For a symbolic link
HEAD:dir/link, you cannot give "$(git rev-parse HEAD:dir):link"
to this machinery if its value is "../toplevel-file", even though
the target is "in-repo", and the reason why you can't is because
it is outside the tree "$(git rev-parse HEAD:dir)".
* OPT_SET_INT() is very old fashioned ;-) kn/cat-file-literally
topic, which I expect would graduate to 'master' before this
series would, updates all the existing ones to OPT_BOOL(), and
following suit to match it would reduce the need to do an evil
merge later.
builtin/cat-file.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 095554b..43338bb 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -243,7 +243,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
result = get_sha1_with_context(obj_name, flags, data->sha1, &ctx);
if (result != FOUND) {
- switch(result) {
+ switch (result) {
case MISSING_OBJECT:
printf("%s missing\n", obj_name);
break;
@@ -358,7 +358,7 @@ static int batch_objects(struct batch_options *opt)
static const char * const cat_file_usage[] = {
N_("git cat-file (-t | -s | -e | -p | <type> | --textconv) <object>"),
- N_("git cat-file (--batch | --batch-check) < <list-of-objects>"),
+ N_("git cat-file (--batch | --batch-check) [--follow-symlinks] < <list-of-objects>"),
NULL
};
@@ -402,15 +402,14 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
OPT_SET_INT('p', NULL, &opt, N_("pretty-print object's content"), 'p'),
OPT_SET_INT(0, "textconv", &opt,
N_("for blob objects, run textconv on object's content"), 'c'),
- OPT_SET_INT(0, "follow-symlinks", &batch.follow_symlinks,
- N_("follow in-repo symlinks; report out-of-repo symlinks (requires --batch or --batch-check)"),
- 1),
{ OPTION_CALLBACK, 0, "batch", &batch, "format",
N_("show info and content of objects fed from the standard input"),
PARSE_OPT_OPTARG, batch_option_callback },
{ OPTION_CALLBACK, 0, "batch-check", &batch, "format",
N_("show info about objects fed from the standard input"),
PARSE_OPT_OPTARG, batch_option_callback },
+ OPT_BOOL(0, "follow-symlinks", &batch.follow_symlinks,
+ N_("follow in-tree symlinks (used with --batch or --batch-check)")),
OPT_END()
};
--
2.4.1-366-g03a772b