* [PATCH] Add cg-printenv command. @ 2005-05-09 1:11 Steven Cole 2005-05-09 1:19 ` Marcel Holtmann 0 siblings, 1 reply; 8+ messages in thread From: Steven Cole @ 2005-05-09 1:11 UTC (permalink / raw) To: Petr Baudis; +Cc: git The cg-printenv command will print exported git environment variables. Signed-off-by: Steven Cole <elenstev@mesatop•com> Index: Makefile =================================================================== --- 3974261da777f55a7a11aff6e02f584bbfe2b475/Makefile (mode:100644) +++ uncommitted/Makefile (mode:100644) @@ -48,7 +48,8 @@ SCRIPT= commit-id tree-id parent-id cg-add cg-admin-lsobj cg-admin-uncommit \ cg-branch-add cg-branch-ls cg-cancel cg-clone cg-commit cg-diff \ cg-export cg-help cg-init cg-log cg-ls cg-merge cg-mkpatch cg-patch \ - cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update + cg-printenv cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls \ + cg-update LIB_SCRIPT=cg-Xlib cg-Xdiffdo cg-Xmergefile Index: cg-help =================================================================== --- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-help (mode:100755) +++ uncommitted/cg-help (mode:100755) @@ -35,6 +35,7 @@ cg-merge [-c] [-b BASE_ID] FROM_ID cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] cg-patch < patch on stdin + cg-printenv cg-pull [BNAME] cg-restore [FILE]... cg-rm FILE... Index: cg-printenv =================================================================== --- /dev/null (tree:3974261da777f55a7a11aff6e02f584bbfe2b475) +++ uncommitted/cg-printenv (mode:100755) @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Print exported git environment variables +# Copyright (c) Steven Cole 2005 +# +#These git environment variables are used in case +#values other than that returned by getpwuid(getuid()) +#are desired when performing a commit. +# +#AUTHOR_NAME Author's name +#AUTHOR_EMAIL Author's e-mail address +#AUTHOR_DATE Date, perhaps from a patch e-mail +#COMMIT_AUTHOR_NAME Committer's name +#COMMIT_AUTHOR_EMAIL Committer's e-mail address +# +# Takes no parameters. +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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 1:11 [PATCH] Add cg-printenv command Steven Cole @ 2005-05-09 1:19 ` Marcel Holtmann 2005-05-09 2:38 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Marcel Holtmann @ 2005-05-09 1:19 UTC (permalink / raw) To: Steven Cole; +Cc: Petr Baudis, git Hi Steven, > The cg-printenv command will print exported git environment variables. I like that idea. It is much more handy then using env and grep for the variable names. Regards Marcel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 1:19 ` Marcel Holtmann @ 2005-05-09 2:38 ` Junio C Hamano 2005-05-09 3:25 ` Steven Cole 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2005-05-09 2:38 UTC (permalink / raw) To: Marcel Holtmann; +Cc: Steven Cole, Petr Baudis, git 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? 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" If it is for eval consumption of course they have to be much more careful. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 2:38 ` Junio C Hamano @ 2005-05-09 3:25 ` Steven Cole 2005-05-09 3:40 ` Sean 0 siblings, 1 reply; 8+ messages in thread From: Steven Cole @ 2005-05-09 3:25 UTC (permalink / raw) To: Junio C Hamano; +Cc: Marcel Holtmann, Petr Baudis, git On Sunday 08 May 2005 08:38 pm, Junio C Hamano wrote: > 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. > > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 3:25 ` Steven Cole @ 2005-05-09 3:40 ` Sean 2005-05-09 3:59 ` Steven Cole 0 siblings, 1 reply; 8+ messages in thread From: Sean @ 2005-05-09 3:40 UTC (permalink / raw) To: Steven Cole; +Cc: Junio C Hamano, Marcel Holtmann, Petr Baudis, git On Sun, May 8, 2005 11:25 pm, Steven Cole said: > 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. Hey Steven, Rather than creating a separate command, perhaps the values could automatically be added to the initial commit message in a few "CG:" lines? Sean ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 3:40 ` Sean @ 2005-05-09 3:59 ` Steven Cole 2005-05-09 7:24 ` Petr Baudis 0 siblings, 1 reply; 8+ messages in thread From: Steven Cole @ 2005-05-09 3:59 UTC (permalink / raw) To: Sean; +Cc: Junio C Hamano, Marcel Holtmann, Petr Baudis, git On Sunday 08 May 2005 09:40 pm, Sean wrote: > On Sun, May 8, 2005 11:25 pm, Steven Cole said: > > > 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. > > Hey Steven, > > Rather than creating a separate command, perhaps the values could > automatically be added to the initial commit message in a few "CG:" lines? > > Sean A secondary reason for adding the cg-printenv capability was that a user would see this command in the cg-help list, and cg-help printenv would give: Print exported git environment variables Copyright (c) Steven Cole 2005 <--- Petr, my early version of cg-help stripped (c) lines. These git environment variables are used in case values other than that returned by getpwuid(getuid()) are desired when performing a commit. AUTHOR_NAME Author's name AUTHOR_EMAIL Author's e-mail address AUTHOR_DATE Date, perhaps from a patch e-mail COMMIT_AUTHOR_NAME Committer's name COMMIT_AUTHOR_EMAIL Committer's e-mail address Takes no parameters. ------------- Yes, I know that the environment variables are documented in Documentation/core-git.txt, but having this usage right up front like this may help those who only RTFM as a last resort. If others feel that the more obscure environment variables should be exposed here, feel free to submit patches. Here is a patch with Junio's improved version: -------------------------------------------------------------------------------------- The cg-printenv command will print exported git environment variables. Signed-off-by: Steven Cole <elenstev@mesatop•com> Index: Makefile =================================================================== --- 3974261da777f55a7a11aff6e02f584bbfe2b475/Makefile (mode:100644) +++ uncommitted/Makefile (mode:100644) @@ -48,7 +48,8 @@ SCRIPT= commit-id tree-id parent-id cg-add cg-admin-lsobj cg-admin-uncommit \ cg-branch-add cg-branch-ls cg-cancel cg-clone cg-commit cg-diff \ cg-export cg-help cg-init cg-log cg-ls cg-merge cg-mkpatch cg-patch \ - cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update + cg-printenv cg-pull cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls \ + cg-update LIB_SCRIPT=cg-Xlib cg-Xdiffdo cg-Xmergefile Index: cg-help =================================================================== --- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-help (mode:100755) +++ uncommitted/cg-help (mode:100755) @@ -35,6 +35,7 @@ cg-merge [-c] [-b BASE_ID] FROM_ID cg-mkpatch [-s] [-r FROM_ID[:TO_ID]] cg-patch < patch on stdin + cg-printenv cg-pull [BNAME] cg-restore [FILE]... cg-rm FILE... Index: cg-printenv =================================================================== --- /dev/null (tree:3974261da777f55a7a11aff6e02f584bbfe2b475) +++ uncommitted/cg-printenv (mode:100755) @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Print exported git environment variables +# Copyright (c) Steven Cole 2005 +# +#These git environment variables are used in case +#values other than that returned by getpwuid(getuid()) +#are desired when performing a commit. +# +#AUTHOR_NAME Author's name +#AUTHOR_EMAIL Author's e-mail address +#AUTHOR_DATE Date, perhaps from a patch e-mail +#COMMIT_AUTHOR_NAME Committer's name +#COMMIT_AUTHOR_EMAIL Committer's e-mail address +# +# Takes no parameters. +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" ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 3:59 ` Steven Cole @ 2005-05-09 7:24 ` Petr Baudis 2005-05-09 13:35 ` Steven Cole 0 siblings, 1 reply; 8+ messages in thread From: Petr Baudis @ 2005-05-09 7:24 UTC (permalink / raw) To: Steven Cole; +Cc: Sean, Junio C Hamano, Marcel Holtmann, git Dear diary, on Mon, May 09, 2005 at 05:59:59AM CEST, I got a letter where Steven Cole <elenstev@mesatop•com> told me that... > On Sunday 08 May 2005 09:40 pm, Sean wrote: > > On Sun, May 8, 2005 11:25 pm, Steven Cole said: > > > > > 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. > > > > Hey Steven, > > > > Rather than creating a separate command, perhaps the values could > > automatically be added to the initial commit message in a few "CG:" lines? I was already thinking about this and I think Sean's way makes more sense. Also, I actually believe you should add this functionality to commit-tree instead (commit-tree -n (dry-run), perhaps?) - so that the user can actually check the default values commit-tree is going to use too. *That* would be useful. > A secondary reason for adding the cg-printenv capability was that a user would > see this command in the cg-help list, and cg-help printenv would give: No, I think this sucks. You should just list the variables in cg-commit documentation if anything. That's where they matter anyway and where the user could possibly look for them anyway. I think the command is otherwise pretty useless, and the important thing is, the command slots are precious (well, there are free cg-admin slots but I think this one does not qualify there neither) - have too many useless (or barely useful) commands and you end up as GNU Arch. So I'm willing to add commands only when I'm convinced they will really help the user. -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Add cg-printenv command. 2005-05-09 7:24 ` Petr Baudis @ 2005-05-09 13:35 ` Steven Cole 0 siblings, 0 replies; 8+ messages in thread From: Steven Cole @ 2005-05-09 13:35 UTC (permalink / raw) To: Petr Baudis; +Cc: Sean, Junio C Hamano, Marcel Holtmann, git Petr Baudis wrote: > Dear diary, on Mon, May 09, 2005 at 05:59:59AM CEST, I got a letter > where Steven Cole <elenstev@mesatop•com> told me that... > >>On Sunday 08 May 2005 09:40 pm, Sean wrote: >> >>>On Sun, May 8, 2005 11:25 pm, Steven Cole said: >>> >>> >>>>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. >>> >>>Hey Steven, >>> >>>Rather than creating a separate command, perhaps the values could >>>automatically be added to the initial commit message in a few "CG:" lines? > > > I was already thinking about this and I think Sean's way makes more > sense. Also, I actually believe you should add this functionality to > commit-tree instead (commit-tree -n (dry-run), perhaps?) - so that the > user can actually check the default values commit-tree is going to use > too. *That* would be useful. I agree that having a --dry-run option here would be useful. I frequently use the 't' option when untarring an unfamiliar tarball. > > >>A secondary reason for adding the cg-printenv capability was that a user would >>see this command in the cg-help list, and cg-help printenv would give: > > > No, I think this sucks. You should just list the variables in cg-commit > documentation if anything. That's where they matter anyway and where the > user could possibly look for them anyway. OK. David has done a good job of documenting this in the git-commit-tree section of Documentation/core-git.txt, and here is the information again in the comment header for cg-commit. That's the way of open source. Post an idea, and any number of superior implementations come rolling in. -------- Add comments to cg-commit to point out usage of git environment variables. Signed-off-by: Steven Cole <elenstev@mesatop•com> =================================================================== --- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-commit (mode:100755) +++ uncommitted/cg-commit (mode:100755) @@ -13,6 +13,16 @@ # appended to a single commit message, each as separate paragraph. # -e forces the editor to be brought up even when -m parameters were # passed to cg-commit. +# +#These git environment variables are used in case +#values other than that returned by getpwuid(getuid()) +#are desired when performing a commit. +# +#AUTHOR_NAME Author's name +#AUTHOR_EMAIL Author's e-mail address +#AUTHOR_DATE Date, perhaps from a patch e-mail +#COMMIT_AUTHOR_NAME Committer's name +#COMMIT_AUTHOR_EMAIL Committer's e-mail address . ${COGITO_LIB}cg-Xlib ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-05-09 13:28 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-05-09 1:11 [PATCH] Add cg-printenv command Steven Cole 2005-05-09 1:19 ` Marcel Holtmann 2005-05-09 2:38 ` Junio C Hamano 2005-05-09 3:25 ` Steven Cole 2005-05-09 3:40 ` Sean 2005-05-09 3:59 ` Steven Cole 2005-05-09 7:24 ` Petr Baudis 2005-05-09 13:35 ` Steven Cole
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox