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
8f759ac0
Commit
8f759ac0
authored
Aug 07, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2471 from jacquesg/compatibility-cleanup
Compatibility/Portability cleanup
parents
e0af2517
07d03d31
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
158 additions
and
136 deletions
+158
-136
src/clone.c
+3
-0
src/global.c
+2
-0
src/path.h
+1
-0
src/posix.h
+46
-28
src/transports/winhttp.c
+6
-2
src/unix/posix.h
+23
-9
src/unix/realpath.c
+8
-7
src/win32/mingw-compat.h
+5
-12
src/win32/msvc-compat.h
+3
-32
src/win32/posix.h
+20
-31
src/win32/posix_w32.c
+28
-3
tests/clar_libgit2.h
+2
-1
tests/refs/pack.c
+2
-2
tests/stress/diff.c
+5
-5
tests/threads/refdb.c
+4
-4
No files found.
src/clone.c
View file @
8f759ac0
...
...
@@ -488,6 +488,9 @@ static const char *repository_base(git_repository *repo)
static
bool
can_link
(
const
char
*
src
,
const
char
*
dst
,
int
link
)
{
#ifdef GIT_WIN32
GIT_UNUSED
(
src
);
GIT_UNUSED
(
dst
);
GIT_UNUSED
(
link
);
return
false
;
#else
...
...
src/global.c
View file @
8f759ac0
...
...
@@ -19,7 +19,9 @@ git_mutex git__mwindow_mutex;
#ifdef GIT_SSL
# include <openssl/ssl.h>
SSL_CTX
*
git__ssl_ctx
;
# ifdef GIT_THREADS
static
git_mutex
*
openssl_locks
;
# endif
#endif
static
git_global_shutdown_fn
git__shutdown_callbacks
[
MAX_SHUTDOWN_CB
];
...
...
src/path.h
View file @
8f759ac0
...
...
@@ -8,6 +8,7 @@
#define INCLUDE_path_h__
#include "common.h"
#include "posix.h"
#include "buffer.h"
#include "vector.h"
...
...
src/posix.h
View file @
8f759ac0
...
...
@@ -12,23 +12,61 @@
#include <time.h>
#include "fnmatch.h"
/* stat: file mode type testing macros */
#ifndef S_IFGITLINK
#define S_IFGITLINK 0160000
#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
#endif
#ifndef S_IFLNK
#define S_IFLNK 0120000
#undef _S_IFLNK
#define _S_IFLNK S_IFLNK
#endif
#ifndef S_IXUSR
#define S_IXUSR 00100
#endif
#ifndef S_ISLNK
#define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_ISFIFO
#define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
#endif
/* if S_ISGID is not defined, then don't try to set it */
#ifndef S_ISGID
#define S_ISGID 0
#endif
#if
!defined(O_BINARY)
#if
ndef O_BINARY
#define O_BINARY 0
#endif
#if
!defined(O_CLOEXEC)
#if
ndef O_CLOEXEC
#define O_CLOEXEC 0
#endif
/* access() mode parameter #defines */
#ifndef F_OK
#define F_OK 0
/* existence check */
#endif
#ifndef W_OK
#define W_OK 2
/* write mode check */
#endif
#ifndef R_OK
#define R_OK 4
/* read mode check */
#endif
/* Determine whether an errno value indicates that a read or write failed
* because the descriptor is blocked.
*/
...
...
@@ -38,6 +76,12 @@
#define GIT_ISBLOCKED(e) ((e) == EAGAIN)
#endif
/* define some standard errnos that the runtime may be missing. for example,
* mingw lacks EAFNOSUPPORT. */
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT (INT_MAX-1)
#endif
typedef
int
git_file
;
/**
...
...
@@ -56,8 +100,6 @@ typedef int git_file;
extern
int
p_read
(
git_file
fd
,
void
*
buf
,
size_t
cnt
);
extern
int
p_write
(
git_file
fd
,
const
void
*
buf
,
size_t
cnt
);
#define p_fstat(f,b) fstat(f, b)
#define p_lseek(f,n,w) lseek(f, n, w)
#define p_close(fd) close(fd)
#define p_umask(m) umask(m)
...
...
@@ -66,30 +108,6 @@ extern int p_creat(const char *path, mode_t mode);
extern
int
p_getcwd
(
char
*
buffer_out
,
size_t
size
);
extern
int
p_rename
(
const
char
*
from
,
const
char
*
to
);
#ifndef GIT_WIN32
#define p_stat(p,b) stat(p, b)
#define p_chdir(p) chdir(p)
#define p_rmdir(p) rmdir(p)
#define p_chmod(p,m) chmod(p, m)
#define p_access(p,m) access(p,m)
#define p_ftruncate(fd, sz) ftruncate(fd, sz)
#define p_recv(s,b,l,f) recv(s,b,l,f)
#define p_send(s,b,l,f) send(s,b,l,f)
typedef
int
GIT_SOCKET
;
#define INVALID_SOCKET -1
#define p_localtime_r localtime_r
#define p_gmtime_r gmtime_r
#else
typedef
SOCKET
GIT_SOCKET
;
extern
struct
tm
*
p_localtime_r
(
const
time_t
*
timer
,
struct
tm
*
result
);
extern
struct
tm
*
p_gmtime_r
(
const
time_t
*
timer
,
struct
tm
*
result
);
#endif
/**
* Platform-dependent methods
*/
...
...
src/transports/winhttp.c
View file @
8f759ac0
...
...
@@ -36,6 +36,10 @@
#define CACHED_POST_BODY_BUF_SIZE 4096
#define UUID_LENGTH_CCH 32
#ifndef WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH
#define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
#endif
static
const
char
*
prefix_http
=
"http://"
;
static
const
char
*
prefix_https
=
"https://"
;
static
const
char
*
upload_pack_service
=
"upload-pack"
;
...
...
@@ -745,9 +749,9 @@ replay:
/* Verify that we got the correct content-type back */
if
(
post_verb
==
s
->
verb
)
snprintf
(
expected_content_type_8
,
MAX_CONTENT_TYPE_LEN
,
"application/x-git-%s-result"
,
s
->
service
);
p_
snprintf
(
expected_content_type_8
,
MAX_CONTENT_TYPE_LEN
,
"application/x-git-%s-result"
,
s
->
service
);
else
snprintf
(
expected_content_type_8
,
MAX_CONTENT_TYPE_LEN
,
"application/x-git-%s-advertisement"
,
s
->
service
);
p_
snprintf
(
expected_content_type_8
,
MAX_CONTENT_TYPE_LEN
,
"application/x-git-%s-advertisement"
,
s
->
service
);
if
(
git__utf8_to_16
(
expected_content_type
,
MAX_CONTENT_TYPE_LEN
,
expected_content_type_8
)
<
0
)
{
giterr_set
(
GITERR_OS
,
"Failed to convert expected content-type to wide characters"
);
...
...
src/unix/posix.h
View file @
8f759ac0
...
...
@@ -4,33 +4,47 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_posix__
w32
_h__
#define INCLUDE_posix__
w32
_h__
#ifndef INCLUDE_posix__
unix
_h__
#define INCLUDE_posix__
unix
_h__
#include <stdio.h>
#include <sys/param.h>
typedef
int
GIT_SOCKET
;
#define INVALID_SOCKET -1
#define p_lseek(f,n,w) lseek(f, n, w)
#define p_fstat(f,b) fstat(f, b)
#define p_lstat(p,b) lstat(p,b)
#define p_stat(p,b) stat(p, b)
#define p_readlink(a, b, c) readlink(a, b, c)
#define p_symlink(o,n) symlink(o, n)
#define p_link(o,n) link(o, n)
#define p_unlink(p) unlink(p)
#define p_mkdir(p,m) mkdir(p, m)
#define p_fsync(fd) fsync(fd)
extern
char
*
p_realpath
(
const
char
*
,
char
*
);
/* The OpenBSD realpath function behaves differently */
#if !defined(__OpenBSD__)
# define p_realpath(p, po) realpath(p, po)
#else
char
*
p_realpath
(
const
char
*
,
char
*
);
#endif
#define p_recv(s,b,l,f) recv(s,b,l,f)
#define p_send(s,b,l,f) send(s,b,l,f)
#define p_inet_pton(a, b, c) inet_pton(a, b, c)
#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
#define p_mkstemp(p) mkstemp(p)
#define p_inet_pton(a, b, c) inet_pton(a, b, c)
#define p_chdir(p) chdir(p)
#define p_chmod(p,m) chmod(p, m)
#define p_rmdir(p) rmdir(p)
#define p_access(p,m) access(p,m)
#define p_ftruncate(fd, sz) ftruncate(fd, sz)
/* see win32/posix.h for explanation about why this exists */
#define p_lstat_posixly(p,b) lstat(p,b)
#define p_localtime_r(c, r) localtime_r(c, r)
#define p_gmtime_r(c, r) gmtime_r(c, r)
#endif
src/unix/realpath.c
View file @
8f759ac0
...
...
@@ -6,7 +6,7 @@
*/
#include <git2/common.h>
#if
def __OpenBSD__
#if
ndef GIT_WIN32
#include <limits.h>
#include <stdlib.h>
...
...
@@ -16,15 +16,16 @@
char
*
p_realpath
(
const
char
*
pathname
,
char
*
resolved
)
{
char
*
ret
;
if
((
ret
=
realpath
(
pathname
,
resolved
))
==
NULL
)
return
NULL
;
/* Figure out if the file exists */
if
(
!
access
(
ret
,
F_OK
))
return
ret
;
return
NULL
;
#ifdef __OpenBSD__
/* The OpenBSD realpath function behaves differently,
* figure out if the file exists */
if
(
access
(
ret
,
F_OK
)
<
0
)
ret
=
NULL
;
#endif
return
ret
;
}
#endif
src/win32/mingw-compat.h
View file @
8f759ac0
...
...
@@ -9,18 +9,11 @@
#if defined(__MINGW32__)
/* use a 64-bit file offset type */
# undef lseek
# define lseek _lseeki64
# undef stat
# define stat _stati64
# undef fstat
# define fstat _fstati64
/* stat: file mode type testing macros */
# define _S_IFLNK 0120000
# define S_IFLNK _S_IFLNK
# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
#if _WIN32_WINNT >= 0x0601
#define stat __stat64
#else
#define stat _stati64
#endif
#endif
...
...
src/win32/msvc-compat.h
View file @
8f759ac0
...
...
@@ -9,41 +9,12 @@
#if defined(_MSC_VER)
/* access() mode parameter #defines */
# define F_OK 0
/* existence check */
# define W_OK 2
/* write mode check */
# define R_OK 4
/* read mode check */
/* 64-bit stat information, regardless of USE_32BIT_TIME_T define */
#define stat __stat64
# define lseek _lseeki64
# define stat __stat64
# define fstat _fstat64
/* stat: file mode type testing macros */
# define _S_IFLNK 0120000
# define S_IFLNK _S_IFLNK
# define S_IXUSR 00100
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
# define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
# define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
# define mode_t unsigned short
/* case-insensitive string comparison */
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
/* MSVC doesn't define ssize_t at all */
typedef
unsigned
short
mode_t
;
typedef
SSIZE_T
ssize_t
;
/* define snprintf using variadic macro support if available */
#if _MSC_VER >= 1500
# define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__)
#else
# define snprintf _snprintf
#endif
#endif
#define GIT_STDLIB_CALL __cdecl
...
...
src/win32/posix.h
View file @
8f759ac0
...
...
@@ -12,49 +12,35 @@
#include "utf-conv.h"
#include "dir.h"
/* define some standard errnos that the runtime may be missing. for example,
* mingw lacks EAFNOSUPPORT. */
typedef
SOCKET
GIT_SOCKET
;
#ifndef EAFNOSUPPORT
# define EAFNOSUPPORT (INT_MAX-1)
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1500
# define p_ftruncate(fd, sz) _chsize_s(fd, sz)
#else
/* MinGW */
# define p_ftruncate(fd, sz) _chsize(fd, sz)
#endif
GIT_INLINE
(
int
)
p_link
(
const
char
*
old
,
const
char
*
new
)
{
GIT_UNUSED
(
old
);
GIT_UNUSED
(
new
);
errno
=
ENOSYS
;
return
-
1
;
}
extern
int
p_mkdir
(
const
char
*
path
,
mode_t
mode
);
extern
int
p_unlink
(
const
char
*
path
);
#define p_lseek(f,n,w) _lseeki64(f, n, w)
#define p_fstat(f,b) _fstat64(f, b)
extern
int
p_lstat
(
const
char
*
file_name
,
struct
stat
*
buf
);
extern
int
p_stat
(
const
char
*
path
,
struct
stat
*
buf
);
extern
int
p_readlink
(
const
char
*
path
,
char
*
buf
,
size_t
bufsiz
);
extern
int
p_symlink
(
const
char
*
old
,
const
char
*
new
);
extern
int
p_link
(
const
char
*
old
,
const
char
*
new
);
extern
int
p_unlink
(
const
char
*
path
);
extern
int
p_mkdir
(
const
char
*
path
,
mode_t
mode
);
extern
int
p_fsync
(
int
fd
);
extern
char
*
p_realpath
(
const
char
*
orig_path
,
char
*
buffer
);
extern
int
p_recv
(
GIT_SOCKET
socket
,
void
*
buffer
,
size_t
length
,
int
flags
);
extern
int
p_send
(
GIT_SOCKET
socket
,
const
void
*
buffer
,
size_t
length
,
int
flags
);
extern
int
p_inet_pton
(
int
af
,
const
char
*
src
,
void
*
dst
);
#define strcasecmp(s1, s2) _stricmp(s1, s2)
#define strncasecmp(s1, s2, c) _strnicmp(s1, s2, c)
extern
int
p_vsnprintf
(
char
*
buffer
,
size_t
count
,
const
char
*
format
,
va_list
argptr
);
extern
int
p_snprintf
(
char
*
buffer
,
size_t
count
,
const
char
*
format
,
...)
GIT_FORMAT_PRINTF
(
3
,
4
);
extern
int
p_mkstemp
(
char
*
tmp_path
);
extern
int
p_stat
(
const
char
*
path
,
struct
stat
*
buf
);
extern
int
p_chdir
(
const
char
*
path
);
extern
int
p_chmod
(
const
char
*
path
,
mode_t
mode
);
extern
int
p_rmdir
(
const
char
*
path
);
extern
int
p_access
(
const
char
*
path
,
mode_t
mode
);
extern
int
p_fsync
(
int
fd
);
extern
int
p_open
(
const
char
*
path
,
int
flags
,
...);
extern
int
p_creat
(
const
char
*
path
,
mode_t
mode
);
extern
int
p_getcwd
(
char
*
buffer_out
,
size_t
size
);
extern
int
p_rename
(
const
char
*
from
,
const
char
*
to
);
extern
int
p_recv
(
GIT_SOCKET
socket
,
void
*
buffer
,
size_t
length
,
int
flags
);
extern
int
p_send
(
GIT_SOCKET
socket
,
const
void
*
buffer
,
size_t
length
,
int
flags
);
extern
int
p_inet_pton
(
int
af
,
const
char
*
src
,
void
*
dst
);
extern
int
p_ftruncate
(
int
fd
,
long
size
);
/* p_lstat is almost but not quite POSIX correct. Specifically, the use of
* ENOTDIR is wrong, in that it does not mean precisely that a non-directory
...
...
@@ -64,4 +50,7 @@ extern int p_inet_pton(int af, const char* src, void* dst);
*/
extern
int
p_lstat_posixly
(
const
char
*
filename
,
struct
stat
*
buf
);
extern
struct
tm
*
p_localtime_r
(
const
time_t
*
timer
,
struct
tm
*
result
);
extern
struct
tm
*
p_gmtime_r
(
const
time_t
*
timer
,
struct
tm
*
result
);
#endif
src/win32/posix_w32.c
View file @
8f759ac0
...
...
@@ -51,6 +51,15 @@ static int utf8_to_16_with_errno(git_win32_path dest, const char *src)
return
len
;
}
int
p_ftruncate
(
int
fd
,
long
size
)
{
#if defined(_MSC_VER) && _MSC_VER >= 1500
return
_chsize_s
(
fd
,
size
);
#else
return
_chsize
(
fd
,
size
);
#endif
}
int
p_mkdir
(
const
char
*
path
,
mode_t
mode
)
{
git_win32_path
buf
;
...
...
@@ -63,6 +72,14 @@ int p_mkdir(const char *path, mode_t mode)
return
_wmkdir
(
buf
);
}
int
p_link
(
const
char
*
old
,
const
char
*
new
)
{
GIT_UNUSED
(
old
);
GIT_UNUSED
(
new
);
errno
=
ENOSYS
;
return
-
1
;
}
int
p_unlink
(
const
char
*
path
)
{
git_win32_path
buf
;
...
...
@@ -547,11 +564,19 @@ char *p_realpath(const char *orig_path, char *buffer)
int
p_vsnprintf
(
char
*
buffer
,
size_t
count
,
const
char
*
format
,
va_list
argptr
)
{
#if defined(_MSC_VER)
&& _MSC_VER >= 1500
#if defined(_MSC_VER)
int
len
;
if
(
count
==
0
||
(
len
=
_vsnprintf_s
(
buffer
,
count
,
_TRUNCATE
,
format
,
argptr
))
<
0
)
if
(
count
==
0
)
return
_vscprintf
(
format
,
argptr
);
#if _MSC_VER >= 1500
len
=
_vsnprintf_s
(
buffer
,
count
,
_TRUNCATE
,
format
,
argptr
);
#else
len
=
_vsnprintf
(
buffer
,
count
,
format
,
argptr
);
#endif
if
(
len
<
0
)
return
_vscprintf
(
format
,
argptr
);
return
len
;
...
...
tests/clar_libgit2.h
View file @
8f759ac0
...
...
@@ -3,6 +3,7 @@
#include "clar.h"
#include <git2.h>
#include <posix.h>
#include "common.h"
/**
...
...
@@ -51,7 +52,7 @@ GIT_INLINE(void) clar__assert_in_range(
{
if
(
lo
>
val
||
hi
<
val
)
{
char
buf
[
128
];
snprintf
(
buf
,
sizeof
(
buf
),
"%d not in [%d,%d]"
,
val
,
lo
,
hi
);
p_
snprintf
(
buf
,
sizeof
(
buf
),
"%d not in [%d,%d]"
,
val
,
lo
,
hi
);
clar__fail
(
file
,
line
,
err
,
buf
,
should_abort
);
}
}
...
...
tests/refs/pack.c
View file @
8f759ac0
...
...
@@ -91,12 +91,12 @@ void test_refs_pack__symbolic(void)
/* make a bunch of references */
for
(
i
=
0
;
i
<
100
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
name
,
"refs/heads/master"
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
tests/stress/diff.c
View file @
8f759ac0
...
...
@@ -97,14 +97,14 @@ void test_stress_diff__rename_big_files(void)
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
for
(
i
=
0
;
i
<
100
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
for
(
j
=
i
*
256
;
j
>
0
;
--
j
)
git_buf_printf
(
&
b
,
"more content %d
\n
"
,
i
);
cl_git_mkfile
(
tmp
,
b
.
ptr
);
}
for
(
i
=
0
;
i
<
100
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
cl_git_pass
(
git_index_add_bypath
(
index
,
tmp
+
strlen
(
"renames/"
)));
}
...
...
@@ -128,15 +128,15 @@ void test_stress_diff__rename_many_files(void)
git_buf_printf
(
&
b
,
"%08d
\n
"
ANOTHER_POEM
"%08d
\n
"
ANOTHER_POEM
ANOTHER_POEM
,
0
,
0
);
for
(
i
=
0
;
i
<
2500
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
snprintf
(
b
.
ptr
,
9
,
"%08d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
b
.
ptr
,
9
,
"%08d"
,
i
);
b
.
ptr
[
8
]
=
'\n'
;
cl_git_mkfile
(
tmp
,
b
.
ptr
);
}
git_buf_free
(
&
b
);
for
(
i
=
0
;
i
<
2500
;
i
+=
1
)
{
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
p_
snprintf
(
tmp
,
sizeof
(
tmp
),
"renames/newfile%03d"
,
i
);
cl_git_pass
(
git_index_add_bypath
(
index
,
tmp
+
strlen
(
"renames/"
)));
}
...
...
tests/threads/refdb.c
View file @
8f759ac0
...
...
@@ -58,7 +58,7 @@ void test_threads_refdb__iterator(void)
/* make a bunch of references */
for
(
r
=
0
;
r
<
200
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
@@ -102,7 +102,7 @@ static void *create_refs(void *arg)
cl_git_pass
(
git_reference_name_to_id
(
&
head
,
g_repo
,
"HEAD"
));
for
(
i
=
0
;
i
<
10
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
[
i
],
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
if
(
i
==
5
)
{
...
...
@@ -127,7 +127,7 @@ static void *delete_refs(void *arg)
char
name
[
128
];
for
(
i
=
0
;
i
<
10
;
++
i
)
{
snprintf
(
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
(
*
id
)
&
~
0x3
,
i
);
if
(
!
git_reference_lookup
(
&
ref
,
g_repo
,
name
))
{
...
...
@@ -167,7 +167,7 @@ void test_threads_refdb__edit_while_iterate(void)
/* make a bunch of references */
for
(
r
=
0
;
r
<
50
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
p_
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
}
...
...
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