Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
9bf5bd7c
Commit
9bf5bd7c
authored
Feb 05, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2867 from ethomson/8dot3
Handle 8dot3 filenames being disabled on Win32
parents
3dc92940
07c989e9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
1 deletions
+34
-1
src/repository.c
+2
-1
tests/checkout/nasty.c
+3
-0
tests/clar_libgit2.c
+22
-0
tests/clar_libgit2.h
+4
-0
tests/path/win32.c
+3
-0
No files found.
src/repository.c
View file @
9bf5bd7c
...
@@ -808,7 +808,8 @@ const char *git_repository__8dot3_name(git_repository *repo)
...
@@ -808,7 +808,8 @@ const char *git_repository__8dot3_name(git_repository *repo)
/* We anticipate the 8.3 name is "GIT~1", so use a static for
/* We anticipate the 8.3 name is "GIT~1", so use a static for
* easy testing in the common case */
* easy testing in the common case */
if
(
strcasecmp
(
repo
->
name_8dot3
,
git_repository__8dot3_default
)
==
0
)
if
(
repo
->
name_8dot3
&&
strcasecmp
(
repo
->
name_8dot3
,
git_repository__8dot3_default
)
==
0
)
repo
->
has_8dot3_default
=
1
;
repo
->
has_8dot3_default
=
1
;
}
}
#endif
#endif
...
...
tests/checkout/nasty.c
View file @
9bf5bd7c
...
@@ -217,6 +217,9 @@ void test_checkout_nasty__git_tilde1(void)
...
@@ -217,6 +217,9 @@ void test_checkout_nasty__git_tilde1(void)
void
test_checkout_nasty__git_custom_shortname
(
void
)
void
test_checkout_nasty__git_custom_shortname
(
void
)
{
{
#ifdef GIT_WIN32
#ifdef GIT_WIN32
if
(
!
cl_sandbox_supports_8dot3
())
clar__skip
();
cl_must_pass
(
p_rename
(
"nasty/.git"
,
"nasty/_temp"
));
cl_must_pass
(
p_rename
(
"nasty/.git"
,
"nasty/_temp"
));
cl_git_write2file
(
"nasty/git~1"
,
""
,
0
,
O_RDWR
|
O_CREAT
,
0666
);
cl_git_write2file
(
"nasty/git~1"
,
""
,
0
,
O_RDWR
|
O_CREAT
,
0666
);
cl_must_pass
(
p_rename
(
"nasty/_temp"
,
"nasty/.git"
));
cl_must_pass
(
p_rename
(
"nasty/_temp"
,
"nasty/.git"
));
...
...
tests/clar_libgit2.c
View file @
9bf5bd7c
...
@@ -538,3 +538,25 @@ void cl_sandbox_set_search_path_defaults(void)
...
@@ -538,3 +538,25 @@ void cl_sandbox_set_search_path_defaults(void)
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_SYSTEM
,
sandbox_path
);
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_SYSTEM
,
sandbox_path
);
}
}
#ifdef GIT_WIN32
bool
cl_sandbox_supports_8dot3
(
void
)
{
git_buf
longpath
=
GIT_BUF_INIT
;
char
*
shortname
;
bool
supported
;
cl_git_pass
(
git_buf_joinpath
(
&
longpath
,
clar_sandbox_path
(),
"longer_than_8dot3"
));
cl_git_write2file
(
longpath
.
ptr
,
""
,
0
,
O_RDWR
|
O_CREAT
,
0666
);
shortname
=
git_win32_path_8dot3_name
(
longpath
.
ptr
);
supported
=
(
shortname
!=
NULL
);
git__free
(
shortname
);
git_buf_free
(
&
longpath
);
return
supported
;
}
#endif
tests/clar_libgit2.h
View file @
9bf5bd7c
...
@@ -161,4 +161,8 @@ void cl_fake_home_cleanup(void *);
...
@@ -161,4 +161,8 @@ void cl_fake_home_cleanup(void *);
void
cl_sandbox_set_search_path_defaults
(
void
);
void
cl_sandbox_set_search_path_defaults
(
void
);
#ifdef GIT_WIN32
bool
cl_sandbox_supports_8dot3
(
void
);
#endif
#endif
#endif
tests/path/win32.c
View file @
9bf5bd7c
...
@@ -194,6 +194,9 @@ void test_path_win32__8dot3_name(void)
...
@@ -194,6 +194,9 @@ void test_path_win32__8dot3_name(void)
#ifdef GIT_WIN32
#ifdef GIT_WIN32
char
*
shortname
;
char
*
shortname
;
if
(
!
cl_sandbox_supports_8dot3
())
clar__skip
();
/* Some guaranteed short names */
/* Some guaranteed short names */
cl_assert_equal_s
(
"PROGRA~1"
,
(
shortname
=
git_win32_path_8dot3_name
(
"C:
\\
Program Files"
)));
cl_assert_equal_s
(
"PROGRA~1"
,
(
shortname
=
git_win32_path_8dot3_name
(
"C:
\\
Program Files"
)));
git__free
(
shortname
);
git__free
(
shortname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment