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

Re: [PATCH] Fix wrong failures in config test

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 10, 2011, 19:42 UTC
Message-ID
<20110110194242.GA11801@burratino>
In-Reply-To
<4d2b5c52.68e3cdc2.bm000@wupperonline.de>
Ingo Brückl wrote:
> As Jonathan and Junio stated,
Show 10 quoted lines
>>  envvar=value git command
>
>>  GIT_CONFIG=other-config git config anwohner.park ausweis
>
> shouldn't affect the environment of the tests.
>
> Unfortunately, I had a shell alias function named git that interfered. In
> fact it passes to the git program (command git "$@") but sadly does not know
> about the newly set PATH and (still inexplicably to me) makes the variable
> set.
For what it's worth, here's what POSIX[1] has to say:
	When a given simple command is required to be executed [...] the
	following expansions, assignments, and redirections shall all be
	performed from the beginning of the command text to the end:
[...]
	If no command name results, variable assignments shall affect
	the current execution environment. Otherwise, the variable
	assignments shall be exported for the execution environment of
	the command and shall not affect the current execution
	environment (except for special built-ins). 

I am guessing the expansion of your 'git' alias starts with a special builtin. For the future, it is probably best to guard settings for interactive use with

	if test "${PS1+set}"
	then
		CDPATH=something
		alias foo=bar
		alias baz=qux
		...
	fi
or even better,
	case $- in
	*i*)
		CDPATH=something
		...
	esac

Thanks for explaining. Jonathan

[1] http://unix.org/2008edition/
Previous: Ingo Br ücklNext: Junio C Hamano
Message 7 of 11 in “Fix wrong failures in config test”
  1. Fix wrong failures in config testIngo Br ückl, Jan 10, 2011
  2. Jonathan NiederJan 10, 2011
  3. Ingo Br ücklJan 10, 2011
  4. Jonathan NiederJan 10, 2011
  5. Junio C HamanoJan 10, 2011
  6. Ingo Br ücklJan 10, 2011
  7. Jonathan NiederJan 10, 2011
  8. Junio C HamanoJan 10, 2011
  9. Jonathan NiederJan 10, 2011
  10. Ingo Br ücklJan 10, 2011
  11. Jonathan NiederJan 10, 2011

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.