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
01d7fded
Commit
01d7fded
authored
Sep 22, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Rewrite getenv to use Win32 version on Windows"
This reverts commit
e1b86444
.
parent
ea4dad8e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
48 deletions
+10
-48
src/config.c
+4
-8
src/posix.c
+0
-9
src/posix.h
+0
-1
src/win32/posix_w32.c
+0
-24
tests/t15-config.c
+2
-2
tests/t16-remotes.c
+4
-4
No files found.
src/config.c
View file @
01d7fded
...
...
@@ -312,24 +312,20 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
int
git_config_find_global
(
char
*
global_config_path
)
{
char
*
home
;
c
onst
c
har
*
home
;
home
=
p_
getenv
(
"HOME"
);
home
=
getenv
(
"HOME"
);
#ifdef GIT_WIN32
if
(
home
==
NULL
)
home
=
p_
getenv
(
"USERPROFILE"
);
home
=
getenv
(
"USERPROFILE"
);
#endif
if
(
home
==
NULL
)
{
free
(
home
);
if
(
home
==
NULL
)
return
git__throw
(
GIT_EOSERR
,
"Failed to open global config file. Cannot locate the user's home directory"
);
}
git_path_join
(
global_config_path
,
home
,
GIT_CONFIG_FILENAME
);
free
(
home
);
if
(
git_futils_exists
(
global_config_path
)
<
GIT_SUCCESS
)
return
git__throw
(
GIT_EOSERR
,
"Failed to open global config file. The file does not exist"
);
...
...
src/posix.c
View file @
01d7fded
...
...
@@ -39,15 +39,6 @@ int p_getcwd(char *buffer_out, size_t size)
return
GIT_SUCCESS
;
}
char
*
p_getenv
(
const
char
*
name
)
{
char
*
buf
=
getenv
(
name
);
if
(
!
buf
)
return
buf
;
return
git__strdup
(
buf
);
}
#endif
int
p_read
(
git_file
fd
,
void
*
buf
,
size_t
cnt
)
...
...
src/posix.h
View file @
01d7fded
...
...
@@ -44,7 +44,6 @@ extern int p_write(git_file fd, const void *buf, size_t cnt);
extern
int
p_open
(
const
char
*
path
,
int
flags
);
extern
int
p_creat
(
const
char
*
path
,
int
mode
);
extern
int
p_getcwd
(
char
*
buffer_out
,
size_t
size
);
extern
char
*
p_getenv
(
const
char
*
name
);
#ifndef GIT_WIN32
...
...
src/win32/posix_w32.c
View file @
01d7fded
...
...
@@ -370,30 +370,6 @@ int p_mkstemp(char *tmp_path)
return
p_creat
(
tmp_path
,
0744
);
}
char
*
p_getenv
(
const
char
*
name
)
{
wchar_t
*
buf
;
wchar_t
*
name_w
=
conv_utf8_to_utf16
(
name
);
char
*
ret
;
DWORD
len
;
len
=
GetEnvironmentVariableW
(
name_w
,
NULL
,
0
);
if
(
len
==
0
)
{
free
(
name_w
);
return
NULL
;
}
len
++
;
/* Null Terminator */
buf
=
malloc
(
sizeof
(
wchar_t
)
*
len
);
GetEnvironmentVariableW
(
name_w
,
buf
,
len
);
ret
=
conv_utf16_to_utf8
(
buf
);
free
(
name_w
);
free
(
buf
);
return
ret
;
}
int
p_setenv
(
const
char
*
name
,
const
char
*
value
,
int
overwrite
)
{
if
(
overwrite
!=
1
)
...
...
tests/t15-config.c
View file @
01d7fded
...
...
@@ -235,7 +235,7 @@ BEGIN_TEST(config10, "a repo's config overrides the global config")
int
version
;
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
@@ -255,7 +255,7 @@ BEGIN_TEST(config11, "fall back to the global config")
int
num
;
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
tests/t16-remotes.c
View file @
01d7fded
...
...
@@ -34,7 +34,7 @@ BEGIN_TEST(remotes0, "remote parsing works")
git_config
*
cfg
;
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
@@ -58,7 +58,7 @@ BEGIN_TEST(refspec0, "remote with refspec works")
const
git_refspec
*
refspec
=
NULL
;
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
@@ -83,7 +83,7 @@ BEGIN_TEST(refspec1, "remote fnmatch works as expected")
const
git_refspec
*
refspec
=
NULL
;
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
@@ -109,7 +109,7 @@ BEGIN_TEST(refspec2, "refspec transform")
char
ref
[
1024
]
=
{
0
};
char
*
old_home
;
old_home
=
p_getenv
(
"HOME"
);
old_home
=
git__strdup
(
getenv
(
"HOME"
)
);
p_setenv
(
"HOME"
,
"/dev/null"
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
...
...
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