diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-03-08 21:29:56 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-08 21:29:56 -0800 |
commit | 175f5595511b047a320e5c6163c642ac1fc34681 (patch) | |
tree | f66169a0750929b474716969b2ba5b7a885a0ebc /wt-status.c | |
parent | 0ae496ccd85e121c01bddfdfc1a68aced04f79ff (diff) | |
parent | 5b7570cfb41c34ce585ede3fc1e45fa48febbd8f (diff) | |
download | git-175f5595511b047a320e5c6163c642ac1fc34681.tar.gz git-175f5595511b047a320e5c6163c642ac1fc34681.tar.xz |
Merge branch 'dp/clean-fix'
* dp/clean-fix:
git-clean: add tests for relative path
git-clean: correct printing relative path
Make private quote_path() in wt-status.c available as quote_path_relative()
Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec())
Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes)
Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)
get_pathspec(): die when an out-of-tree path is given
Diffstat (limited to 'wt-status.c')
-rw-r--r-- | wt-status.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/wt-status.c b/wt-status.c index 32d780af1..701d13da7 100644 --- a/wt-status.c +++ b/wt-status.c @@ -7,6 +7,7 @@ #include "diff.h" #include "revision.h" #include "diffcore.h" +#include "quote.h" int wt_status_relative_paths = 1; int wt_status_use_color = -1; @@ -82,51 +83,7 @@ static void wt_status_print_trailer(struct wt_status *s) color_fprintf_ln(s->fp, color(WT_STATUS_HEADER), "#"); } -static char *quote_path(const char *in, int len, - struct strbuf *out, const char *prefix) -{ - if (len < 0) - len = strlen(in); - - strbuf_grow(out, len); - strbuf_setlen(out, 0); - if (prefix) { - int off = 0; - while (prefix[off] && off < len && prefix[off] == in[off]) - if (prefix[off] == '/') { - prefix += off + 1; - in += off + 1; - len -= off + 1; - off = 0; - } else - off++; - - for (; *prefix; prefix++) - if (*prefix == '/') - strbuf_addstr(out, "../"); - } - - for ( ; len > 0; in++, len--) { - int ch = *in; - - switch (ch) { - case '\n': - strbuf_addstr(out, "\\n"); - break; - case '\r': - strbuf_addstr(out, "\\r"); - break; - default: - strbuf_addch(out, ch); - continue; - } - } - - if (!out->len) - strbuf_addstr(out, "./"); - - return out->buf; -} +#define quote_path quote_path_relative static void wt_status_print_filepair(struct wt_status *s, int t, struct diff_filepair *p) |