public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: David Turner <dturner@twopensource•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v9 0/3]
Date: Thu, 14 May 2015 13:16:48 -0700	[thread overview]
Message-ID: <xmqqegmikj7z.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqvbfvj7ge.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 14 May 2015 12:16:17 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> 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

  reply	other threads:[~2015-05-14 20:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 18:23 [PATCH v9 0/3] David Turner
2015-05-13 18:23 ` [PATCH 1/3] tree-walk: learn get_tree_entry_follow_symlinks David Turner
2015-05-13 18:23 ` [PATCH 2/3] sha1_name: get_sha1_with_context learns to follow symlinks David Turner
2015-05-13 18:23 ` [PATCH 3/3] cat-file: add --follow-symlinks to --batch David Turner
2015-05-14 19:16 ` [PATCH v9 0/3] Junio C Hamano
2015-05-14 20:16   ` Junio C Hamano [this message]
2015-05-14 20:31     ` David Turner
2015-05-14 21:07       ` Junio C Hamano
2015-05-14 21:17         ` David Turner
  -- strict thread matches above, loose matches on Subject: below --
2018-09-27 15:13 [PATCH] branch: colorize branches checked out in a linked working tree the same way as the current branch is colorized Nickolai Belakovski
2019-03-16  1:38 ` [PATCH v9 0/3] nbelakovski
2019-03-18  5:30   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqegmikj7z.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=dturner@twopensource$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox