Thread (1 message) 1 message, 1 author, 2020-02-20

Re: [PATCH v8 10/15] bugreport: add config values from safelist

From: Junio C Hamano <hidden>
Date: 2020-02-20 20:47:28

Emily Shaffer [off-list ref] writes:
quoted hunk
@@ -94,6 +120,7 @@ int cmd_main(int argc, const char **argv)
 	char *option_output = NULL;
 	char *option_suffix = "%F-%H%M";
 	struct stat statbuf;
+	int nongit_ok = 0;
 
 	const struct option bugreport_options[] = {
 		OPT_STRING('o', "output-directory", &option_output, N_("path"),
@@ -102,6 +129,10 @@ int cmd_main(int argc, const char **argv)
 			   N_("specify a strftime format suffix for the filename")),
 		OPT_END()
 	};
+
+	/* Prerequisite for hooks and config checks */
+	setup_git_directory_gently(&nongit_ok);
Now this starts to break "-o" option when the command is run from a
subdirectory of a git working tree, I suspect.

The setup() will discover that you are in a Git controlled working
tree, goes up to the top-level of the working tree, so a user may
expect

	cd t && git bugreport -o frotz

to create a new directory t/frotz, but it would instead create the
directory frotz next to t/, no?

Using OPT_FILENAME and feeding correct prefix to parse_options()
will correct this.
 	argc = parse_options(argc, argv, "", bugreport_options,
 			     bugreport_usage, 0);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help