diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-09-27 00:52:47 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-27 00:52:47 -0700 |
commit | a17ba31b0b75365e1245e494d46abae4afc57480 (patch) | |
tree | 41c1d800c92e60d97a8b984dce086bcb3473dcc2 /git.c | |
parent | 0f729f21348c43a1c80f48faed2e753b1c923e85 (diff) | |
parent | 6d69b6f6ac27ab6f71a10da34b813ca25fd2a358 (diff) | |
download | git-a17ba31b0b75365e1245e494d46abae4afc57480.tar.gz git-a17ba31b0b75365e1245e494d46abae4afc57480.tar.xz |
Merge branch 'ph/strbuf' into kh/commit
* ph/strbuf:
Clean up stripspace a bit, use strbuf even more.
Add strbuf_read_file().
rerere: Fix use of an empty strbuf.buf
Small cache_tree_write refactor.
Make builtin-rerere use of strbuf nicer and more efficient.
Add strbuf_cmp.
strbuf_setlen(): do not barf on setting length of an empty buffer to 0
sq_quote_argv and add_to_string rework with strbuf's.
Full rework of quote_c_style and write_name_quoted.
Rework unquote_c_style to work on a strbuf.
strbuf API additions and enhancements.
nfv?asprintf are broken without va_copy, workaround them.
Fix the expansion pattern of the pseudo-static path buffer.
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -187,19 +187,13 @@ static int handle_alias(int *argcp, const char ***argv) if (alias_string) { if (alias_string[0] == '!') { if (*argcp > 1) { - int i, sz = PATH_MAX; - char *s = xmalloc(sz), *new_alias = s; + struct strbuf buf; - add_to_string(&s, &sz, alias_string, 0); + strbuf_init(&buf, PATH_MAX); + strbuf_addstr(&buf, alias_string); + sq_quote_argv(&buf, (*argv) + 1, *argcp - 1, PATH_MAX); free(alias_string); - alias_string = new_alias; - for (i = 1; i < *argcp && - !add_to_string(&s, &sz, " ", 0) && - !add_to_string(&s, &sz, (*argv)[i], 1) - ; i++) - ; /* do nothing */ - if (!sz) - die("Too many or long arguments"); + alias_string = buf.buf; } trace_printf("trace: alias to shell cmd: %s => %s\n", alias_command, alias_string + 1); |