diff options
author | Johannes Sixt <j6t@kdbg.org> | 2017-05-25 14:00:13 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-26 08:05:32 +0900 |
commit | d9244ecf4f109030e61b8fd52a799789133e2199 (patch) | |
tree | 74d8ae05ccb952b1160e7ba162db0df5ec5cbf35 /compat/strdup.c | |
parent | mingw.h: permit arguments with side effects for is_dir_sep (diff) | |
download | tgif-d9244ecf4f109030e61b8fd52a799789133e2199.tar.xz |
Windows: do not treat a path with backslashes as a remote's nick name
On Windows, the remote repository name in, e.g., `git fetch foo\bar`
is clearly not a nickname for a configured remote repository. However,
the function valid_remote_nick() does not account for backslashes.
Use is_dir_sep() to check for both slashes and backslashes on Windows.
This was discovered while playing with Duy's patches that warn after
fopen() failures. The functions that read the branches and remotes
files are protected by a valid_remote_nick() check. Without this
change, a Windows style absolute path is incorrectly regarded as
nickname and is concatenated to a prefix and used with fopen(). This
triggers warnings because a colon in a path name is not allowed:
C:\Temp\gittest>git fetch C:\Temp\gittest
warning: unable to access '.git/remotes/C:\Temp\gittest': Invalid argument
warning: unable to access '.git/branches/C:\Temp\gittest': Invalid argument
From C:\Temp\gittest
* branch HEAD -> FETCH_HEAD
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/strdup.c')
0 files changed, 0 insertions, 0 deletions