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
09719c50
Commit
09719c50
authored
Mar 14, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reference: Fix creation of references with extended ASCII characters in their name
parent
9273399b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletions
+53
-1
src/fileops.c
+12
-1
tests-clar/refs/unicode.c
+41
-0
No files found.
src/fileops.c
View file @
09719c50
...
...
@@ -62,7 +62,18 @@ int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode
int
git_futils_creat_locked
(
const
char
*
path
,
const
mode_t
mode
)
{
int
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_EXCL
,
mode
);
int
fd
;
#ifdef GIT_WIN32
wchar_t
*
buf
;
buf
=
gitwin_to_utf16
(
path
);
fd
=
_wopen
(
buf
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_EXCL
,
mode
);
git__free
(
buf
);
#else
fd
=
open
(
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
|
O_BINARY
|
O_EXCL
,
mode
);
#endif
if
(
fd
<
0
)
{
giterr_set
(
GITERR_OS
,
"Failed to create locked file '%s'"
,
path
);
return
-
1
;
...
...
tests-clar/refs/unicode.c
0 → 100644
View file @
09719c50
#include "clar_libgit2.h"
static
git_repository
*
repo
;
void
test_refs_unicode__initialize
(
void
)
{
cl_fixture_sandbox
(
"testrepo.git"
);
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
}
void
test_refs_unicode__cleanup
(
void
)
{
git_repository_free
(
repo
);
cl_fixture_cleanup
(
"testrepo.git"
);
}
void
test_refs_unicode__create_and_lookup
(
void
)
{
git_reference
*
ref
,
*
ref2
;
git_repository
*
repo2
;
const
char
*
REFNAME
=
"refs/heads/"
"
\305
"
"ngstr"
"
\366
"
"m"
;
const
char
*
master
=
"refs/heads/master"
;
/* Create the reference */
cl_git_pass
(
git_reference_lookup
(
&
ref
,
repo
,
master
));
cl_git_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
REFNAME
,
git_reference_oid
(
ref
),
0
));
cl_assert
(
strcmp
(
REFNAME
,
git_reference_name
(
ref
))
==
0
);
/* Lookup the reference in a different instance of the repository */
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo.git"
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo2
,
REFNAME
));
cl_assert
(
git_oid_cmp
(
git_reference_oid
(
ref
),
git_reference_oid
(
ref2
))
==
0
);
cl_assert
(
strcmp
(
REFNAME
,
git_reference_name
(
ref2
))
==
0
);
git_reference_free
(
ref
);
git_reference_free
(
ref2
);
git_repository_free
(
repo2
);
}
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