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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 14, 2009, 20:56 UTC
Message-ID
<alpine.DEB.1.00.0902142127040.10279@pacific.mpi-cbg.de>
In-Reply-To
<1231376145-32331-1-git-send-email-vmiklos@frugalware.org>
Hi,
On Thu, 8 Jan 2009, Miklos Vajna wrote:
Show 9 quoted lines
> +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?
Show 7 quoted lines
> +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?
Show 9 quoted lines
> +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?
Show 9 quoted lines
> +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?
Show 9 quoted lines
> +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?
Show 7 quoted lines
> +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

Previous: Junio C HamanoNext: Miklos Vajna
Message 13 of 19 in “parse-opt: migrate builtin-ls-files.”
  1. parse-opt: migrate builtin-ls-files.Miklos Vajna, Jan 6, 2009
  2. Pierre HabouzitJan 6, 2009
  3. parse-opt: migrate builtin-ls-files.Miklos Vajna, Jan 7, 2009
  4. Pierre HabouzitJan 7, 2009
  5. parse-opt: migrate builtin-ls-files.Miklos Vajna, Jan 8, 2009
  6. Johannes SchindelinJan 8, 2009
  7. Miklos VajnaJan 8, 2009
  8. Miklos VajnaJan 15, 2009
  9. Junio C HamanoJan 15, 2009
  10. Miklos VajnaJan 15, 2009
  11. Miklos VajnaFeb 14, 2009
  12. Junio C HamanoFeb 14, 2009
  13. Johannes SchindelinFeb 14, 2009
  14. parse-opt: migrate builtin-ls-files.Miklos Vajna, Feb 15, 2009
  15. Johannes SchindelinFeb 15, 2009
  16. Miklos VajnaFeb 15, 2009
  17. Turn the flags in struct dir_struct into a single variableJohannes Schindelin, Feb 16, 2009
  18. Miklos VajnaFeb 16, 2009
  19. parse-opt: migrate builtin-ls-files.Miklos Vajna, Feb 17, 2009

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.