Re: [PATCH 10/40] Windows: Treat Windows style path names.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 28, 2008, 12:18 UTC
- Message-ID
- <alpine.LSU.1.00.0802281212140.22527@racer.site>
- In-Reply-To
- <1204138503-6126-11-git-send-email-johannes.sixt@telecom.at>
Hi,
On Wed, 27 Feb 2008, Johannes Sixt wrote:
Show 12 quoted lines
> diff --git a/cache.h b/cache.h
> index e1000bc..3e4e10a 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -441,7 +441,11 @@ int safe_create_leading_directories(char *path);
> char *enter_repo(char *path, int strict);
> static inline int is_absolute_path(const char *path)
> {
> +#ifndef __MINGW32__
> return path[0] == '/';
> +#else
> + return path[0] == '/' || (path[0] && path[1] == ':');Maybe "(isalpha(path[0]) && ...)"?
And maybe make this an inline function in git-compat-util.h, like this?
static inline int has_dos_drive_prefix(const char *path)
{
#ifdef __MINGW32__
return isalpha(*path) && path[1] == ':';
#else
return 0;
#endif
}Show 13 quoted lines
> diff --git a/setup.c b/setup.c
> index dc247a8..77cc461 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -4,13 +4,26 @@
> static int inside_git_dir = -1;
> static int inside_work_tree = -1;
>
> +#ifdef __MINGW32__
> +static inline int is_dir_sep(char c) { return c == '/' || c == '\\'; }
> +#else
> +static inline int is_dir_sep(char c) { return c == '/'; }
> +#endifI think if you rename it to is_dir_separator(), you can put it into git-compat-util.h, right after the PATH_SEPARATOR Paolo suggested.
Thanks, Dscho