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

Re: [PATCH] perl: add new module Git::Config for cached 'git config' access

From
Frank Lichtenheld <frank@lichtenheld.de>
Date
Apr 6, 2009, 09:29 UTC
Message-ID
<20090406092942.GW17706@mail-vs.djpig.de>
In-Reply-To
<1238975176-14354-1-git-send-email-sam.vilain@catalyst.net.nz>
On Mon, Apr 06, 2009 at 11:46:15AM +1200, Sam Vilain wrote:
Show 19 quoted lines
> +	my ($fh, $c) = $git->command_output_pipe(
> +		'config', ( $which ? ("--$which") : () ),
> +		'--list',
> +	       );
> +	my $read_state = {};
> +
> +	while (<$fh>) {
> +		my ($item, $value) = m{(.*?)=(.*)};
> +		my $sl = \( $read_state->{$item} );
> +		if (!defined $$sl) {
> +			$$sl = $value;
> +		}
> +		elsif (!ref $$sl) {
> +			$$sl = [ $$sl, $value ];
> +		}
> +		else {
> +			push @{ $$sl }, $value;
> +		}
> +	}

Any reason why you don't use --null here? The output of --list without --null is not reliably parsable, since people can put newlines in values.

Gruesse,
-- 
Frank Lichtenheld <frank@lichtenheld.de>
www: http://www.djpig.de/
Previous: Sam VilainNext: Sam Vilain
Message 3 of 13 in “perl: add new module Git::Config for cached 'git config' access”
  1. perl: add new module Git::Config for cached 'git config' accessSam Vilain, Apr 5, 2009
  2. perl: make Git.pm use new Git::Config moduleSam Vilain, Apr 5, 2009
  3. Frank LichtenheldApr 6, 2009
  4. Sam VilainApr 6, 2009
  5. Jakub NarebskiApr 7, 2009
  6. Sam VilainApr 8, 2009
  7. Jakub NarebskiApr 8, 2009
  8. Sam VilainApr 8, 2009
  9. Jakub NarebskiApr 8, 2009
  10. Junio C HamanoApr 8, 2009
  11. Sam VilainApr 8, 2009
  12. Junio C HamanoApr 8, 2009
  13. Petr BaudisApr 8, 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.