mirror of
https://github.com/git/git.git
synced 2026-03-16 11:40:07 +01:00
Fix 'clone' failure at DOS root directory.
Cloning via relative path fails for a project residing immediately under the root directory of a DOS drive. For instance, for project c:/foo, issuing "cd c:/" followed by "git clone foo bar" fails with error "Unable to find remote helper for 'c'". The problem is caused by make_nonrelative_path() incorrectly returning c://foo rather than c:/foo for input "foo". The bogus path c://foo is misinterpreted by transport_get() as a URL with unrecognized protocol "c", hence the missing remote helper error. Fix make_nonrelative_path() to return c:/foo rather than c://foo (and /foo rather than //foo on Unix). Resolves msysgit issue #501: http://code.google.com/p/msysgit/issues/detail?id=501 Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Pat Thoyts
parent
b3f15d8bc3
commit
465024aac0
@@ -108,10 +108,15 @@ const char *make_nonrelative_path(const char *path)
|
||||
if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
|
||||
die("Too long path: %.*s", 60, path);
|
||||
} else {
|
||||
size_t len;
|
||||
const char *fmt;
|
||||
const char *cwd = get_pwd_cwd();
|
||||
if (!cwd)
|
||||
die_errno("Cannot determine the current working directory");
|
||||
if (snprintf(buf, PATH_MAX, "%s/%s", cwd, path) >= PATH_MAX)
|
||||
len = strlen(cwd);
|
||||
/* For cwd c:/, return c:/foo rather than URL-like c://foo */
|
||||
fmt = len > 0 && is_dir_sep(cwd[len-1]) ? "%s%s" : "%s/%s";
|
||||
if (snprintf(buf, PATH_MAX, fmt, cwd, path) >= PATH_MAX)
|
||||
die("Too long path: %.*s", 60, path);
|
||||
}
|
||||
return buf;
|
||||
|
||||
Reference in New Issue
Block a user