@@ -157,6 +157,7 @@ func (w *GitTreeWalker) determineRoots(args []string) error {
157157// while still supporting explicit $ prefixes when needed.
158158func (w * GitTreeWalker ) processRootArg (arg string ) error {
159159 path := arg
160+ displayName := arg
160161
161162 // Match $VAR or '$VAR' patterns (explicit environment variable reference)
162163 envVarPattern := regexp .MustCompile (`^(?:'\$[a-zA-Z_]\w*'|\$[a-zA-Z_]\w*)$` )
@@ -167,6 +168,8 @@ func (w *GitTreeWalker) processRootArg(arg string) error {
167168 return fmt .Errorf ("environment variable '%s' is undefined" , arg )
168169 }
169170 path = envValue
171+ // Keep the display name with $ prefix
172+ displayName = "$" + varName
170173 } else {
171174 // Check if arg looks like an environment variable name (alphanumeric/underscore only)
172175 // If so, try to expand it as an environment variable (implicit reference)
@@ -176,6 +179,8 @@ func (w *GitTreeWalker) processRootArg(arg string) error {
176179 if envValue != "" {
177180 // Environment variable exists, use its value
178181 path = envValue
182+ // Add $ prefix to display name since it's an environment variable
183+ displayName = "$" + arg
179184 }
180185 // If environment variable doesn't exist, treat arg as a literal path
181186 }
@@ -192,7 +197,7 @@ func (w *GitTreeWalker) processRootArg(arg string) error {
192197 }
193198 absPaths = append (absPaths , absPath )
194199 }
195- w .RootMap [arg ] = absPaths
200+ w .RootMap [displayName ] = absPaths
196201 }
197202
198203 return nil
0 commit comments