summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2017-10-31 12:27:17 +0900
committerDavid Pursehouse <dpursehouse@collab.net>2017-10-31 13:07:55 +0900
commitf46902a800f508061322a36b1969f51a7e95df16 (patch)
treeb0865343f7fa5702bf16c7662852b45f6119c084 /subcmds
parentc00d28b767240ef17a0402a7d55a7a6197ce2815 (diff)
downloadgit-repo-f46902a800f508061322a36b1969f51a7e95df16.tar.gz
forall: Clarify expansion of REPO_ environment values with -c
If a user executes: repo forall -c echo $REPO_PROJECT then $REPO_NAME is expanded by the user's shell first, and passed as $1 to the shell that executes echo. This will either result in no output, or output of whatever REPO_NAME is set to in the user's shell. Either way, this is an unexpected result. The correct way to do it is: repo forall -c 'echo $REPO_PROJECT' such that $REPO_NAME is passed in to the shell literally, and then expanded to the value set in the environment that was passed to the shell. Update the documentation to make this clearer. Change-Id: I713caee914172ad8d8f0fafacd27026502436f0d
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/forall.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 2c12c55f..52eb5e28 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -104,6 +104,13 @@ annotating tree details.
104shell positional arguments ($1, $2, .., $#) are set to any arguments 104shell positional arguments ($1, $2, .., $#) are set to any arguments
105following <command>. 105following <command>.
106 106
107Example: to list projects:
108
109 %prog% forall -c 'echo $REPO_PROJECT'
110
111Notice that $REPO_PROJECT is quoted to ensure it is expanded in
112the context of running <command> instead of in the calling shell.
113
107Unless -p is used, stdin, stdout, stderr are inherited from the 114Unless -p is used, stdin, stdout, stderr are inherited from the
108terminal and are not redirected. 115terminal and are not redirected.
109 116