Thread (18 messages) 18 messages, 4 authors, 2016-06-15

Re: [PATCH v3] parse-opt: migrate builtin-ls-files.

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:46:10

Hi,

On Thu, 8 Jan 2009, Miklos Vajna wrote:
+static int option_parse_z(const struct option *opt,
+			  const char *arg, int unset)
+{
+	if (unset)
+		line_terminator = '\n';
+	else
+		line_terminator = 0;
+	return 0;
+}
	line_terminator = unset ? '\0' : '\n';

Hmm?
+static int option_parse_exclude(const struct option *opt,
+				const char *arg, int unset)
+{
+	struct dir_struct *dir = opt->value;
+
+	exc_given = 1;
+	add_exclude(arg, "", 0, &dir->exclude_list[EXC_CMDL]);
Why is &dir->exclude_list[EXC_CMDL] not stored in opt->value directly?
+static int option_parse_ignored(const struct option *opt,
+				const char *arg, int unset)
+{
+	struct dir_struct *dir = opt->value;
+
+	dir->show_ignored = !unset;
+
+	return 0;
+}
Maybe this wants to be converted into an OPTION_BIT compatible data type?
+static int option_parse_directory(const struct option *opt,
+				  const char *arg, int unset)
+{
+	struct dir_struct *dir = opt->value;
+
+	dir->show_other_directories = !unset;
+
+	return 0;
+}
Likewise?
+static int option_parse_empty(const struct option *opt,
+				 const char *arg, int unset)
+{
+	struct dir_struct *dir = opt->value;
+
+	dir->hide_empty_directories = unset;
+
+	return 0;
+}
Maybe we need an OPT_BIT_NEG?
+static int option_parse_full_name(const struct option *opt,
+				  const char *arg, int unset)
+{
+	prefix_offset = 0;
+
+	return 0;
+}
Not that it matters much, but maybe you can guard this with an
"if (!unset)"?
+		{ OPTION_CALLBACK, 0, "full-name", NULL, NULL,
+			"make the output relative to the project top directory",
+			PARSE_OPT_NOARG, option_parse_full_name },
Maybe OPT_NONEG, and maybe SET_INT?
+	if (dir.exclude_per_dir)
+		exc_given = 1;
You could use a boolean to handle --exclude-standard, too... But you did 
not do that so that there is no regression with specific ordering of the 
exclude options, right?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help