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
9457a36c
Commit
9457a36c
authored
Sep 21, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of github.com:libgit2/libgit2 into development
parents
468d0d1e
c498701d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
12 deletions
+24
-12
src/unix/posix.h
+1
-0
src/win32/posix.c
+8
-0
src/win32/posix.h
+1
-0
tests/t15-config.c
+5
-4
tests/t16-remotes.c
+9
-8
No files found.
src/unix/posix.h
View file @
9457a36c
...
...
@@ -20,5 +20,6 @@
#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_setenv(n,v,o) setenv(n,v,o)
#endif
src/win32/posix.c
View file @
9457a36c
...
...
@@ -252,3 +252,11 @@ int p_mkstemp(char *tmp_path)
return
p_creat
(
tmp_path
,
0744
);
}
int
p_setenv
(
const
char
*
name
,
const
char
*
value
,
int
overwrite
)
{
if
(
overwrite
!=
1
)
return
EINVAL
;
return
(
SetEnvironmentVariableA
(
name
,
value
)
==
0
?
GIT_EOSERR
:
GIT_SUCCESS
);
}
src/win32/posix.h
View file @
9457a36c
...
...
@@ -32,5 +32,6 @@ extern char *p_realpath(const char *orig_path, char *buffer);
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_setenv
(
const
char
*
name
,
const
char
*
value
,
int
overwrite
);
#endif
tests/t15-config.c
View file @
9457a36c
...
...
@@ -26,6 +26,7 @@
#include "test_helpers.h"
#include <git2.h>
#include <posix.h>
#include "filebuf.h"
#define CONFIG_BASE TEST_RESOURCES "/config"
...
...
@@ -217,7 +218,7 @@ BEGIN_TEST(config10, "a repo's config overrides the global config")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
p_
setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -226,7 +227,7 @@ BEGIN_TEST(config10, "a repo's config overrides the global config")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
@@ -237,7 +238,7 @@ BEGIN_TEST(config11, "fall back to the global config")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
p_
setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -246,7 +247,7 @@ BEGIN_TEST(config11, "fall back to the global config")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
tests/t16-remotes.c
View file @
9457a36c
...
...
@@ -26,6 +26,7 @@
#include "test_helpers.h"
#include <git2.h>
#include <posix.h>
BEGIN_TEST
(
remotes0
,
"remote parsing works"
)
git_remote
*
remote
;
...
...
@@ -34,7 +35,7 @@ BEGIN_TEST(remotes0, "remote parsing works")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
"/dev/null"
,
1
);
p_
setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -46,7 +47,7 @@ BEGIN_TEST(remotes0, "remote parsing works")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
@@ -58,7 +59,7 @@ BEGIN_TEST(refspec0, "remote with refspec works")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
"/dev/null"
,
1
);
p_
setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -71,7 +72,7 @@ BEGIN_TEST(refspec0, "remote with refspec works")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
@@ -83,7 +84,7 @@ BEGIN_TEST(refspec1, "remote fnmatch works as expected")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
"/dev/null"
,
1
);
p_
setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -96,7 +97,7 @@ BEGIN_TEST(refspec1, "remote fnmatch works as expected")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
@@ -109,7 +110,7 @@ BEGIN_TEST(refspec2, "refspec transform")
char
*
old_home
;
old_home
=
git__strdup
(
getenv
(
"HOME"
));
setenv
(
"HOME"
,
"/dev/null"
,
1
);
p_
setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
));
...
...
@@ -122,7 +123,7 @@ BEGIN_TEST(refspec2, "refspec transform")
git_config_free
(
cfg
);
git_repository_free
(
repo
);
setenv
(
"HOME"
,
old_home
,
1
);
p_
setenv
(
"HOME"
,
old_home
,
1
);
free
(
old_home
);
END_TEST
...
...
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