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

Re: [PATCH] Add cg-printenv command.

From
SCSteven Cole <elenstev@mesatop.com>
Date
May 9, 2005, 03:25 UTC
Message-ID
<200505082125.28521.elenstev@mesatop.com>
In-Reply-To
<7vpsw115v0.fsf@assigned-by-dhcp.cox.net>
On Sunday 08 May 2005 08:38 pm, Junio C Hamano wrote:
Show 13 quoted lines
> MH> Hi Steven,
> >> The cg-printenv command will print exported git environment variables.
> SC> +echo "AUTHOR_NAME="$AUTHOR_NAME
> SC> +echo "AUTHOR_EMAIL="$AUTHOR_EMAIL
> SC> +echo "AUTHOR_DATE="$AUTHOR_DATE
> SC> +echo "COMMIT_AUTHOR_NAME="$COMMIT_AUTHOR_NAME
> SC> +echo "COMMIT_AUTHOR_EMAIL="$COMMIT_AUTHOR_EMAIL
> 
> MH> I like that idea. It is much more handy then using env and grep for the
> MH> variable names.
> 
> I wonder what this command is used for?  In a script to be
> "eval"ed?  Or just interactively by the end-user?

I had intended it only as a quick check by an end-user before doing a commit that the values had been set as desired.

Show 12 quoted lines
> 
> Even if it is just for human consumption, I think the echo
> commands I quoted above have double quotes backwards.  Wouldn't
> it make more sense to quote the variables so shell expansion
> would not lose whitespaces inside of variable values, like this?
> 
>     echo AUTHOR_NAME="$AUTHOR_NAME"
>     echo AUTHOR_EMAIL="$AUTHOR_EMAIL"
>     echo AUTHOR_DATE="$AUTHOR_DATE"
>     echo COMMIT_AUTHOR_NAME="$COMMIT_AUTHOR_NAME"
>     echo COMMIT_AUTHOR_EMAIL="$COMMIT_AUTHOR_EMAIL"
> 

My simple testing didn't result in any meaningful whitespace loss, but I only had a single blank character inside my test strings. Your method is better.

[steven@spc cogito]$ echo "AUTHOR_NAME="$AUTHOR_NAME AUTHOR_NAME=Homer Simpson [steven@spc cogito]$ echo COMMIT_AUTHOR_NAME="$COMMIT_AUTHOR_NAME" COMMIT_AUTHOR_NAME=Two Spaces Here

> If it is for eval consumption of course they have to be much
> more careful.
> 

If Petr wants to add this command, he can either move the double quotes or I can submit a modified patch.

Thanks, Steven

Previous: Junio C HamanoNext: Sean
Message 4 of 8 in “Add cg-printenv command.”
  1. Add cg-printenv command.Steven Cole, May 9, 2005
  2. Marcel HoltmannMay 9, 2005
  3. Junio C HamanoMay 9, 2005
  4. Steven ColeMay 9, 2005
  5. SeanMay 9, 2005
  6. Steven ColeMay 9, 2005
  7. Petr BaudisMay 9, 2005
  8. Steven ColeMay 9, 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.