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
c08b8a3a
Commit
c08b8a3a
authored
Oct 18, 2012
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update clar and add reliable rename for Win32
parent
4c47a8bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
tests-clar/clar
+1
-1
tests-clar/clar_helpers.c
+40
-3
tests-clar/clar_libgit2.h
+3
-0
No files found.
tests-clar/clar
View file @
c08b8a3a
...
...
@@ -338,7 +338,7 @@ CLAR_FILES = {
"clar_print_tap.c"
:
r"""eJyNVE1vnDAQPcOvmGWFBAiQot6yaqr2HFU9tLdKyAGzscLayDbbVlX+e8cDJPbuJtsTzPObmTcfdmwss6KFoxIdtAPTzaiFtI2Qwmb4A5Yb27RqkrYEZ5tJWL4CrZLGQvvINBTzgWQHbvL4bxxlLmT+6r5bIY94gq08ktBnyffP3+DItRFKws2HnzLJd/FzHL8h2TxOtlO/5HXZDuBaKz0D/yM3xDznXRxHoodsEwSMXmrYwsiM4R2wYYC0I2GZybGY0hOJhUV8MDxw7JkY0BGd2EHJ/am3l7BEvyiMtoa5qeu0O8/2dhspLPVQTod1xMbqqbUzjQhQ0MdrHbJdL9a8AFVVzSPzMJy5YXsOt5Ca1yKqu7mWg9mHdMNx/ML+uaVenEWj0QCcRSM8pLri4QLV4SGzx6ZfYjo8ZA5CrszOZzq8wXY8cJ2v67Ecddy0WozWbfTmI3z9cX/v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YcjjCobHoU/nT43IAv4b0aYK6QSDXSMmd9uFutZhGjP/5DJ2rq3kmoC7eL/M5K9VF4B6Eujg2VSP9xnCpKfRN2/7Ra9Y9Cq2j/nXeKqqPvKppuLrcPm+7YOWq71QhdC3ZI1V5plx08S7GlXdF7kkUqqTERdIPL8vyVSMHFc5t9QaDHJ0PuWDO4hsthOBv1XxYV0lu6fi1LUJBL86cNCNswmhtXXY16PLf+lcHhSMt57dO1Pttq4qnLJqVdDpKu50Da2zHcERw96oJXwlVCNI2KYVAT+IU5MsvLgQtz912feLwfmDuQBGDeC2zzGoQfBvEdf+L5QyCnp5B2PfPXD+TXQP5hoMzJJl52uTdJDkRcdHODHAjvSWRUTJiO0gD0M7SIkaoU6cNvttFMCryf+WNtP+Z/AaQwXp0="""
}
...
...
tests-clar/clar_helpers.c
View file @
c08b8a3a
...
...
@@ -92,6 +92,37 @@ int cl_setenv(const char *name, const char *value)
cl_assert
(
SetEnvironmentVariableW
(
name_utf16
,
value
?
value_utf16
:
NULL
));
return
0
;
}
/* This function performs retries on calls to MoveFile in order
* to provide enhanced reliability in the face of antivirus
* agents that may be scanning the source (or in the case that
* the source is a directory, a child of the source). */
int
cl_rename
(
const
char
*
source
,
const
char
*
dest
)
{
wchar_t
source_utf16
[
GIT_WIN_PATH
];
wchar_t
dest_utf16
[
GIT_WIN_PATH
];
unsigned
retries
=
1
;
git__utf8_to_16
(
source_utf16
,
GIT_WIN_PATH
,
source
);
git__utf8_to_16
(
dest_utf16
,
GIT_WIN_PATH
,
dest
);
while
(
!
MoveFileW
(
source_utf16
,
dest_utf16
))
{
/* Only retry if the error is ERROR_ACCESS_DENIED;
* this may indicate that an antivirus agent is
* preventing the rename from source to target */
if
(
retries
>
5
||
ERROR_ACCESS_DENIED
!=
GetLastError
())
return
-
1
;
/* With 5 retries and a coefficient of 10ms, the maximum
* delay here is 550 ms */
Sleep
(
10
*
retries
*
retries
);
retries
++
;
}
return
0
;
}
#else
#include <stdlib.h>
...
...
@@ -104,6 +135,12 @@ int cl_setenv(const char *name, const char *value)
{
return
(
value
==
NULL
)
?
unsetenv
(
name
)
:
setenv
(
name
,
value
,
1
);
}
int
cl_rename
(
const
char
*
source
,
const
char
*
dest
)
{
return
p_rename
(
source
,
dest
);
}
#endif
static
const
char
*
_cl_sandbox
=
NULL
;
...
...
@@ -124,18 +161,18 @@ git_repository *cl_git_sandbox_init(const char *sandbox)
* named `.git` inside the fixtures folder of our libgit2 repo.
*/
if
(
p_access
(
".gitted"
,
F_OK
)
==
0
)
cl_git_pass
(
p
_rename
(
".gitted"
,
".git"
));
cl_git_pass
(
cl
_rename
(
".gitted"
,
".git"
));
/* If we have `gitattributes`, rename to `.gitattributes`. This may
* be necessary if we don't want the attributes to be applied in the
* libgit2 repo, but just during testing.
*/
if
(
p_access
(
"gitattributes"
,
F_OK
)
==
0
)
cl_git_pass
(
p
_rename
(
"gitattributes"
,
".gitattributes"
));
cl_git_pass
(
cl
_rename
(
"gitattributes"
,
".gitattributes"
));
/* As with `gitattributes`, we may need `gitignore` just for testing. */
if
(
p_access
(
"gitignore"
,
F_OK
)
==
0
)
cl_git_pass
(
p
_rename
(
"gitignore"
,
".gitignore"
));
cl_git_pass
(
cl
_rename
(
"gitignore"
,
".gitignore"
));
cl_git_pass
(
p_chdir
(
".."
));
...
...
tests-clar/clar_libgit2.h
View file @
c08b8a3a
...
...
@@ -49,6 +49,9 @@ bool cl_is_chmod_supported(void);
char
*
cl_getenv
(
const
char
*
name
);
int
cl_setenv
(
const
char
*
name
,
const
char
*
value
);
/* Reliable rename */
int
cl_rename
(
const
char
*
source
,
const
char
*
dest
);
/* Git sandbox setup helpers */
git_repository
*
cl_git_sandbox_init
(
const
char
*
sandbox
);
...
...
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