On Fri, Aug 08, 2008 at 06:37:13PM -0700, Junio C Hamano wrote:
Petr Baudis [off-list ref] writes:
quoted
quoted
+ prefix="$(echo "$2" | sed -e 's/\//\\\\\//g')"
Maybe use s### ? ;-)
Personally I like '|' instead. It's much less visually distracting than #.
I'm just used to '#' more, but either is fine for me.
quoted
quoted
+
+ git config --get-all topgit.$1 2>/dev/null |
+ sed -e "s/^/$prefix /g"
+}
Won't this return an error code and terminate the script in case no
option is defined?
Exit code from upstream of a pipe does not affect the exit code from the
pipeline, and sed does not exit non-zero just because there was no
substitution.
Oh, you're right - somehow I didn't quite absorb that pipe is used late
at the night. ;-) I still don't understand the stderr redirect, though.
Petr "Pasky" Baudis