From: Johannes Sixt <j6t@kdbg.org>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Git List <git@vger.kernel.org>, Tvangeste <i.4m.l33t@yandex.ru>,
msysgit@googlegroups.com
Subject: Re: Regression in e02ca72: git svn rebase is broken on Windows
Date: Wed, 11 Sep 2013 07:43:07 +0200 [thread overview]
Message-ID: <523002EB.3010706@kdbg.org> (raw)
In-Reply-To: <CANYiYbFaNP=UUKX-5N7qQppMRehuPgn8p1uN_UOJ6bDwTjzKEQ@mail.gmail.com>
Am 11.09.2013 05:19, schrieb Jiang Xin:
> I tested 'relative_path' function using 'test-path-utils', and got the
> following result:
>
> $ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
> ../../../C:/a/b
>
> $ ./test-path-utils relative_path '/a/b' 'x/y'
> ../..//a/b
>
> $ ./test-path-utils relative_path 'a/b' '/x/y'
> ../../../a/b
>
> For the first case, in and prefix are on different ROOT, and for the other
> two cases, one path is a relative path, and another is an absolute path.
>
> I write a patch to test whether two paths (in and prefix) have the same
> root. The result after applied the patch:
>
> $ ./test-path-utils relative_path 'C:/a/b' 'C:/x/y'
> ../../a/b
>
> $ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
> C:/a/b
>
> $ ./test-path-utils relative_path '/a/b' 'x/y'
> /a/b
>
> $ ./test-path-utils relative_path 'a/b' '/x/y'
> a/b
>
>
> diff --git a/path.c b/path.c
> index 7f3324a..51f5d28 100644
> --- a/path.c
> +++ b/path.c
> @@ -441,6 +441,25 @@ int adjust_shared_perm(const char *path)
> return 0;
> }
>
> +static int have_same_root(const char *path1, const char *path2)
> +{
> + /* for POSIX:
> +
> + return ((path1 && is_dir_sep(*path1)) ^
> + (path2 && is_dir_sep(*path2))) == 0;
> + */
> + return path1 && path2 && *path1 && *path2 && (
> + (is_dir_sep(*path1) &&
> + is_dir_sep(*path2)) ||
> + (*(path1+1) == ':' &&
> + *(path2+1) == ':' &&
> + !strncasecmp(path1, path2, 1)) ||
> + (!is_dir_sep(*path1) &&
> + !is_dir_sep(*path2) &&
> + *(path1+1) != ':' &&
> + *(path2+1) != ':'));
I think this can be simplified to
return path1 && path2 &&
is_absolute_path(path1) &&
is_absolute_path(path2) &&
!strncasecmp(path1, path2, 1);
which would not mistake a path D:/foo on Unix as an absolute path.
> +}
-- Hannes
--
--
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.
You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
next prev parent reply other threads:[~2013-09-11 5:43 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-10 13:14 Regression in e02ca72: git svn rebase is broken on Windows Tvangeste
2013-09-10 16:13 ` Johannes Schindelin
2013-09-10 17:43 ` Tvangeste
2013-09-10 18:02 ` Johannes Schindelin
2013-09-10 20:53 ` Tvangeste
2013-09-10 16:52 ` Johannes Sixt
2013-09-10 17:44 ` Tvangeste
2013-09-10 17:06 ` Junio C Hamano
2013-09-10 22:17 ` Karsten Blees
2013-09-11 4:41 ` Jiang Xin
2013-09-11 3:19 ` Jiang Xin
2013-09-11 5:43 ` Johannes Sixt [this message]
2013-09-12 9:12 ` [PATCH 1/2] relative_path should honor dos_drive_prefix Jiang Xin
2013-09-12 9:32 ` Tvangeste
2013-09-12 14:13 ` Torsten Bögershausen
2013-09-12 15:48 ` Junio C Hamano
2013-09-12 17:22 ` Johannes Sixt
2013-09-12 19:11 ` Junio C Hamano
2013-09-13 4:55 ` Jiang Xin
2013-09-13 5:53 ` Junio C Hamano
2013-09-17 8:24 ` Jiang Xin
2013-09-17 8:30 ` [PATCH v3 1/3] test: use unambigous leading path (/foo) for mingw Jiang Xin
2013-09-17 8:30 ` [PATCH v3 2/3] relative_path should honor DOS and UNC paths Jiang Xin
2013-09-17 16:12 ` Junio C Hamano
2013-09-18 9:02 ` Jiang Xin
2013-09-18 16:00 ` Junio C Hamano
[not found] ` <5239BA98.9000205@gmail.com>
2013-09-18 15:09 ` Torsten Bögershausen
2013-09-17 8:30 ` [PATCH v3 3/3] Use simpler relative_path when set_git_dir Jiang Xin
2013-09-17 19:32 ` [PATCH 1/2] relative_path should honor dos_drive_prefix Johannes Sixt
2013-09-18 14:29 ` Torsten Bögershausen
2013-09-20 1:26 ` Jiang Xin
2013-09-20 2:38 ` [PATCH v4 0/3] relative path regression fix Jiang Xin
2013-09-20 2:38 ` [PATCH v4 1/3] test: use unambigous leading path (/foo) for mingw Jiang Xin
2013-10-10 20:32 ` Sebastian Schuberth
2013-10-14 1:33 ` Jiang Xin
2013-10-14 2:29 ` [PATCH v5 0/3] relative path regression fix Jiang Xin
2013-10-14 2:29 ` [PATCH v5 1/3] test: use unambigous leading path (/foo) for MSYS Jiang Xin
2013-10-14 6:50 ` Sebastian Schuberth
2013-10-14 19:40 ` Eric Sunshine
2013-10-14 2:29 ` [PATCH v5 2/3] relative_path should honor dos-drive-prefix Jiang Xin
2013-10-14 2:29 ` [PATCH v5 3/3] Use simpler relative_path when set_git_dir Jiang Xin
2013-09-20 2:38 ` [PATCH v4 2/3] relative_path should honor dos-driver-prefix Jiang Xin
2013-10-10 20:34 ` Sebastian Schuberth
2013-09-20 2:38 ` [PATCH v4 3/3] Use simpler relative_path when set_git_dir Jiang Xin
2013-09-13 13:59 ` [PATCH 1/2] relative_path should honor dos_drive_prefix Torsten Bögershausen
2013-09-12 15:45 ` Karsten Blees
2013-09-12 9:12 ` [PATCH 2/2] Use simpler relative_path when set_git_dir Jiang Xin
2013-09-12 17:36 ` Johannes Sixt
2013-09-13 5:08 ` [PATCH v2 0/3] fixes for relative_path Jiang Xin
2013-09-13 5:08 ` [PATCH v2 1/3] test: use unambigous leading path (/foo) for mingw Jiang Xin
2013-09-13 19:51 ` Junio C Hamano
2013-09-14 6:52 ` Torsten Bögershausen
2013-09-17 16:19 ` Junio C Hamano
2013-09-13 5:08 ` [PATCH v2 2/3] relative_path should honor dos_drive_prefix Jiang Xin
2013-09-14 6:11 ` Torsten Bögershausen
2013-09-13 5:08 ` [PATCH v2 3/3] Use simpler relative_path when set_git_dir Jiang Xin
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=523002EB.3010706@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=i.4m.l33t@yandex.ru \
--cc=msysgit@googlegroups.com \
--cc=worldhello.net@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).