From: Junio C Hamano <gitster@pobox.com>
To: Sebastian Schuberth <sschuberth@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH v2] Fix safe_create_leading_directories() for Windows
Date: Thu, 02 Jan 2014 14:12:24 -0800 [thread overview]
Message-ID: <xmqqsit6nid3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqzjnenjcd.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 02 Jan 2014 13:51:14 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> This has a bit of conflict with another topic in flight; I think I
>> resolved it correctly, but please double check. The following is
>> how it would apply on top of 'pu'.
>>
>> sha1_file.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/sha1_file.c b/sha1_file.c
>> index 131ca97..9e686eb 100644
>> --- a/sha1_file.c
>> +++ b/sha1_file.c
>> @@ -113,11 +113,12 @@ int safe_create_leading_directories(char *path)
>>
>> while (!retval && next_component) {
>> struct stat st;
>> - char *slash = strchr(next_component, '/');
>> -
>> - if (!slash)
>> + char *slash = next_component;
>> + while (!is_dir_sep(*slash))
>
> Gaah; we need to check for the end of string here, i.e.
>
> while (*slash && !is_dir_sep(*slash))
>
> will be what I'll queue on 'pu' for today.
>
>> + ++slash;
>> + if (!*slash)
>> return 0;
>> - while (*(slash + 1) == '/')
>> + while (is_dir_sep(*(slash + 1)))
>> slash++;
>> next_component = slash + 1;
>> if (!*next_component)
Another thing I noticed (but I won't fix it up myself today, as I am
deep into today's integration cycle already) is that we temporarily
replace the slash with NUL and then restore them before we return,
but the restoration is done with the slash. If we were to go in the
direction of this patch, you may want to update that one to use
whatever dir-sep was used in the input string.
next prev parent reply other threads:[~2014-01-02 22:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 17:22 [PATCH] Fix safe_create_leading_directories() for Windows Sebastian Schuberth
2014-01-02 17:33 ` Johannes Schindelin
2014-01-02 18:11 ` Sebastian Schuberth
2014-01-02 18:18 ` John Keeping
2014-01-02 20:37 ` Sebastian Schuberth
2014-01-02 20:46 ` Johannes Schindelin
2014-01-07 15:43 ` Erik Faye-Lund
2014-01-07 17:56 ` Johannes Schindelin
2014-01-07 21:49 ` Sebastian Schuberth
2014-01-02 19:55 ` Junio C Hamano
2014-01-02 20:42 ` Johannes Schindelin
2014-01-02 20:48 ` Sebastian Schuberth
2014-01-02 20:54 ` [PATCH v2] " Sebastian Schuberth
2014-01-02 21:10 ` Johannes Schindelin
2014-01-02 21:24 ` Junio C Hamano
2014-01-02 21:51 ` Junio C Hamano
2014-01-02 22:12 ` Junio C Hamano [this message]
2014-01-02 21:08 ` [PATCH] " Junio C Hamano
2014-01-02 21:19 ` Johannes Schindelin
2014-01-19 7:00 ` Sebastian Schuberth
2014-01-19 7:26 ` Sebastian Schuberth
2014-01-21 20:09 ` 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=xmqqsit6nid3.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=sschuberth@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.