git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v9 0/3]

From
Junio C Hamano <gitster@pobox.com>
Date
May 14, 2015, 20:16 UTC
Message-ID
<xmqqegmikj7z.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqvbfvj7ge.fsf@gitster.dls.corp.google.com>
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
Previous: Junio C HamanoNext: David Turner
Message 6 of 9 in “[PATCH v9 0/3]”
  1. 0/3 David Turner, May 13, 2015
  2. 1/3 tree-walk: learn get_tree_entry_follow_symlinksDavid Turner, May 13, 2015
  3. 2/3 sha1_name: get_sha1_with_context learns to follow symlinksDavid Turner, May 13, 2015
  4. 3/3 cat-file: add --follow-symlinks to --batchDavid Turner, May 13, 2015
  5. Junio C HamanoMay 14, 2015
  6. Junio C HamanoMay 14, 2015
  7. David TurnerMay 14, 2015
  8. Junio C HamanoMay 14, 2015
  9. David TurnerMay 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.