Stefan Beller <sbeller@xxxxxxxxxx> writes: >> This looks nicer here in the script, but doesn't test exactly what users >> type most of the time, I suppose. >> >> So how about this? > > Looks good to me, though I had a nagging feeling at first that the > regex could be made more concise. > Why do we need the optional "[^ ]" inside \1 ? > >> + sed -e "s/^ \([^ ]* repo\) .*/-\1/" <actual >expect && At that position there's 40-hex object name. If we want to go looser, you could say "s/^ \(.* repo\) .*/-\1/" and if you want to go more strict, you could say "s/^ \($_x40 repo\) (heads\/master)$/-\1/" I think "Here between the leading SP and SP before the pathname 'repo', we expect an object name which should be a run of non SP bytes" is a reasonable mid-point that is stricter than "anything goes" and is still concise.