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

Re: [PATCH] Remove gitenv macro hack

From
Junio C Hamano <junkio@cox.net>
Date
May 19, 2005, 23:41 UTC
Message-ID
<7vd5rmyea0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.62.0505191800280.16809@mirrorlynx.com>
Please do not do this.

I believe we have that in quite a few places. IIRC, it is one of the Linus-approved GCC extensions and also used extensively in the kernel source.

./cache.h:39:#define gitenv(e) (getenv(e) ? : gitenv_bc(e)) ./commit-tree.c:149: commitgecos = gitenv("GIT_COMMITTER_NAME") ? : realgecos; ./commit-tree.c:150: commitemail = gitenv("GIT_COMMITTER_EMAIL") ? : realemail; ./commit-tree.c:151: gecos = gitenv("GIT_AUTHOR_NAME") ? : realgecos; ./commit-tree.c:152: email = gitenv("GIT_AUTHOR_EMAIL") ? : realemail; ./fsck-cache.c:359: char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT; ./diff.c:35: diff_opts = gitenv("GIT_DIFF_OPTS") ? : diff_opts; ./diff.c:358: prepare_temp_file(other ? : name, &temp[1], two); ./diff.c:398: builtin_diff(name, other ? : name, temp); ./diff.c:717: diff_rename_minimum_score = minimum_score_ ? : MINIMUM_SCORE; ./sha1_file.c:203: const char *alt = gitenv(ALTERNATE_DB_ENVIRONMENT) ? : ""; ./sha1_file.c:215: cp = strchr(last, ':') ? : last + strlen(last);

Previous: Dan Weber
Message 2 of 2 in “Remove gitenv macro hack”
  1. Remove gitenv macro hackDan Weber, May 19, 2005
  2. Junio C HamanoMay 19, 2005

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.