On 21 March 2011 23:33, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: >> Oh, I should have been paying a bit more attention. I've been assuming >> that we were turning "!anything" into { "sh", "-c", "anything", "-" } >> followed by the user supplied arguments. > > The attached quick hack gives > > $ git config alias.silly > !echo hello $1; echo $# args, bye! > $ GIT_TRACE=1 ./git silly world funny > trace: exec: 'git-silly' 'world' 'funny' > trace: run_command: 'git-silly' 'world' 'funny' > trace: run_command: 'sh' '-c' 'echo hello $1; echo $# args, bye'\!'' '-' 'world' 'funny' > trace: exec: 'sh' '-c' 'echo hello $1; echo $# args, bye'\!'' > '-' 'world' 'funny' > hello world > 2 args, bye! That would IMHO be The Right Way to do it. Since the documentation for aliases promises to to pass my alias to a shell if I prefix it with "!", I shouldn't have to add the "sh -c ... -" myself... > but it would penalize a properly written alias that uses "sh -c <it> -" > trick itself by double forking, which is not very nice and I am unhappy > about. A properly written alias that uses a trick? I guess that sums up the problem... :-) Anyway, doesn't the existing way potentially break when passing funky arguments containing spaces/quotes/something? We currently pass the arguments to the alias command as a single quoted string. Passing them as seperate elements on argv seems a lot more robust... Do we risk breaking any existing "!sh -c ... -" aliases by applying this? /Lasse -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html