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
26b08d4c
Commit
26b08d4c
authored
Aug 12, 2021
by
Peter Pettersson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clone: don't test remote url against filesystem
parent
d728cb61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
src/libgit2/clone.c
+17
-16
No files found.
src/libgit2/clone.c
View file @
26b08d4c
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "fs_path.h"
#include "fs_path.h"
#include "repository.h"
#include "repository.h"
#include "odb.h"
#include "odb.h"
#include "net.h"
static
int
clone_local_into
(
git_repository
*
repo
,
git_remote
*
remote
,
const
git_fetch_options
*
fetch_opts
,
const
git_checkout_options
*
co_opts
,
const
char
*
branch
,
int
link
);
static
int
clone_local_into
(
git_repository
*
repo
,
git_remote
*
remote
,
const
git_fetch_options
*
fetch_opts
,
const
git_checkout_options
*
co_opts
,
const
char
*
branch
,
int
link
);
...
@@ -336,8 +337,9 @@ static int create_and_configure_origin(
...
@@ -336,8 +337,9 @@ static int create_and_configure_origin(
git_remote_create_cb
remote_create
=
options
->
remote_cb
;
git_remote_create_cb
remote_create
=
options
->
remote_cb
;
void
*
payload
=
options
->
remote_cb_payload
;
void
*
payload
=
options
->
remote_cb_payload
;
/* If the path exists and is a dir, the url should be the absolute path */
/* If the path is local and exists it should be the absolute path. */
if
(
git_fs_path_root
(
url
)
<
0
&&
git_fs_path_exists
(
url
)
&&
git_fs_path_isdir
(
url
))
{
if
(
!
git_net_str_is_url
(
url
)
&&
git_fs_path_root
(
url
)
<
0
&&
git_fs_path_exists
(
url
))
{
if
(
p_realpath
(
url
,
buf
)
==
NULL
)
if
(
p_realpath
(
url
,
buf
)
==
NULL
)
return
-
1
;
return
-
1
;
...
@@ -458,26 +460,25 @@ cleanup:
...
@@ -458,26 +460,25 @@ cleanup:
int
git_clone__should_clone_local
(
const
char
*
url_or_path
,
git_clone_local_t
local
)
int
git_clone__should_clone_local
(
const
char
*
url_or_path
,
git_clone_local_t
local
)
{
{
git_str
fromurl
=
GIT_STR_INIT
;
git_str
fromurl
=
GIT_STR_INIT
;
const
char
*
path
=
url_or_path
;
bool
is_local
;
bool
is_url
,
is_local
;
if
(
local
==
GIT_CLONE_NO_LOCAL
)
if
(
local
==
GIT_CLONE_NO_LOCAL
)
return
0
;
return
0
;
if
(
(
is_url
=
git_fs_path_is_local_file_url
(
url_or_path
))
!=
0
)
{
if
(
git_net_str_is_url
(
url_or_path
)
)
{
if
(
git_fs_path_fromurl
(
&
fromurl
,
url_or_path
)
<
0
)
{
/* If GIT_CLONE_LOCAL_AUTO is specified, any url should be treated as remote */
is_local
=
-
1
;
if
(
local
==
GIT_CLONE_LOCAL_AUTO
||
goto
done
;
!
git_fs_path_is_local_file_url
(
url_or_path
))
}
return
0
;
path
=
fromurl
.
ptr
;
if
(
git_fs_path_fromurl
(
&
fromurl
,
url_or_path
)
==
0
)
is_local
=
git_fs_path_isdir
(
git_str_cstr
(
&
fromurl
));
else
is_local
=
-
1
;
git_str_dispose
(
&
fromurl
);
}
else
{
is_local
=
git_fs_path_isdir
(
url_or_path
);
}
}
is_local
=
(
!
is_url
||
local
!=
GIT_CLONE_LOCAL_AUTO
)
&&
git_fs_path_isdir
(
path
);
done:
git_str_dispose
(
&
fromurl
);
return
is_local
;
return
is_local
;
}
}
...
...
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