git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	fullung@gmail.com, matthijs@stdin.nl
Subject: Re: [PATCH] get_cwd_relative(): do not misinterpret root path
Date: Fri, 19 Nov 2010 21:41:59 +0100	[thread overview]
Message-ID: <20101119204159.GA28622@localhost> (raw)
In-Reply-To: <1290158239-12138-1-git-send-email-pclouds@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

Hi Duy,

Thanks for looking into this.

On Fri, Nov 19, 2010 at 04:17:19PM +0700, Nguyễn Thái Ngọc Duy wrote:
> 
> @@ -965,6 +965,12 @@ char *get_relative_cwd(char *buffer, int size, const char *dir)
>  	case '/':
>  		return cwd + 1;
>  	default:
> +		/*
> +		 * dir can end with a path separator when it's root
> +		 * directory. Return proper prefix in that case.
> +		 */
> +		if (is_dir_sep(dir[-1]))
> +			return cwd;
>  		return NULL;
>  	}
>  }

make_absolute_path() already rewrites dir to contain slashes only.
I think it is confusing to use is_dir_sep() here, when we only
check for / above.

Otherwise, the patch looks good to me.

Clemens

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

       reply	other threads:[~2010-11-19 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1290158239-12138-1-git-send-email-pclouds@gmail.com>
2010-11-19 20:41 ` Clemens Buchacher [this message]
2010-11-20  6:50   ` [PATCH v2] get_cwd_relative(): do not misinterpret root path Nguyễn Thái Ngọc Duy

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=20101119204159.GA28622@localhost \
    --to=drizzd@aon.at \
    --cc=fullung@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=matthijs@stdin.nl \
    --cc=pclouds@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 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).