From: Jiang Xin <worldhello.net@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Matthieu Moy <Matthieu.Moy@imag.fr>,
Git List <git@vger.kernel.org>
Cc: Jiang Xin <worldhello.net@gmail.com>
Subject: [RFC 0/2] refactor relative_path in path.c
Date: Wed, 15 May 2013 23:18:37 +0800 [thread overview]
Message-ID: <cover.1368630636.git.worldhello.net@gmail.com> (raw)
In-Reply-To: <7vvc6ldtx7.fsf@alter.siamese.dyndns.org>
2013/5/15 Junio C Hamano <gitster@pobox.com>:
> Jiang Xin <worldhello.net@gmail.com> writes:
>
>> +/*
>> + * Give path as relative to prefix.
>> + *
>> + * This function is a combination of path_relative (in quote.c) and
>> + * relative_path (in path.c)
>> + */
>> +static const char *path_relative(const char *in, const char *prefix)
>> +{
>> +...
>
> Hmph. Is it possible to reuse the public one (in path.c) here and
> in quote.c, perhaps after enhancing it a bit to serve needs of the
> callers of two existing ones and the new callers of this one?
>
These two patches enhance relative_path() in path.c, so that function
relative_path() will return real relative path, not a path strip off
the prefix.
The 2nd patch is a bit aggressive, it refactor all related functions,
remove unnecessary arguments: len and/or prefix_len.
Please review them. They will be prerequisites for the interactive
git-clean patch series.
Jiang Xin (2):
path.c: refactor relative_path(), not only strip prefix
quote.c: remove path_relative, use relative_path instead
builtin/clean.c | 18 +++++------
builtin/grep.c | 4 +--
builtin/ls-files.c | 13 ++++----
path.c | 94 ++++++++++++++++++++++++++++++++++++++++++------------
quote.c | 71 +++--------------------------------------
quote.h | 7 ++--
wt-status.c | 17 +++++-----
7 files changed, 107 insertions(+), 117 deletions(-)
--
1.8.3.rc1.404.ga32c147
next prev parent reply other threads:[~2013-05-15 15:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-14 8:45 [PATCH v9 0/9] interactive git-clean Jiang Xin
2013-05-14 8:45 ` [PATCH v9 1/9] git-clean: refactor git-clean into two phases Jiang Xin
2013-05-14 23:27 ` Junio C Hamano
2013-05-15 0:40 ` Jiang Xin
2013-05-15 15:03 ` Junio C Hamano
2013-05-15 15:07 ` Jiang Xin
2013-05-15 15:18 ` Jiang Xin [this message]
2013-05-15 18:24 ` [RFC 0/2] refactor relative_path in path.c Junio C Hamano
2013-05-15 15:18 ` [RFC 1/2] path.c: refactor relative_path(), not only strip prefix Jiang Xin
2013-05-15 15:18 ` [RFC 2/2] quote.c: remove path_relative, use relative_path instead Jiang Xin
2013-05-14 8:45 ` [PATCH v9 2/9] git-clean: add support for -i/--interactive Jiang Xin
2013-05-14 8:45 ` [PATCH v9 3/9] git-clean: show items of del_list in columns Jiang Xin
2013-05-14 8:45 ` [PATCH v9 4/9] git-clean: add colors to interactive git-clean Jiang Xin
2013-05-14 8:45 ` [PATCH v9 5/9] git-clean: use a git-add-interactive compatible UI Jiang Xin
2013-05-14 8:45 ` [PATCH v9 6/9] git-clean: add filter by pattern interactive action Jiang Xin
2013-05-14 8:45 ` [PATCH v9 7/9] git-clean: add select by numbers " Jiang Xin
2013-05-14 8:45 ` [PATCH v9 8/9] git-clean: add ask each " Jiang Xin
2013-05-14 8:45 ` [PATCH v9 9/9] git-clean: add documentation for interactive git-clean Jiang Xin
2013-05-14 23:27 ` [PATCH v9 0/9] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1368630636.git.worldhello.net@gmail.com \
--to=worldhello.net@gmail.com \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).