avih [off-list ref] writes:
Generalized solution (without namespace-ification):
I think you are over-engineering this. We do not have immediate
need for such facility to be used by other scripts. On the other
hand, we know exactly what git-prompt wants to see available, and
you already implemented them.
So just losing "make assignment asuming $'blah' works, and then
reassign based on what printf gave us" and always using the printf
thing is what we want to see here.
assign_as_fmt \
__git_SOH='\1' __git_STX='\2' __git_ESC='\33' \
__git_LF='\n' __git_CRLF='\r\n'
Are you sure that everybody's implementation of printf(1) is happy
with \d and \dd? I am an old timer who learnt in a distant past to
always spell octals as \ddd without omitting any leading 0-digit,
because some was unhappy.
Thanks.