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
120b0122
Commit
120b0122
authored
May 05, 2013
by
Brad Morgan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
22595b84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
59 deletions
+43
-59
src/transports/ssh.c
+43
-59
No files found.
src/transports/ssh.c
View file @
120b0122
...
...
@@ -215,72 +215,18 @@ static int gitssh_extract_url_parts(
return
0
;
}
static
int
_git_
uploadpack_ls
(
static
int
_git_
ssh_setup_conn
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
char
*
host
,
*
port
,
*
user
=
NULL
,
*
pass
=
NULL
;
ssh_stream
*
s
;
*
stream
=
NULL
;
if
(
!
git__prefixcmp
(
url
,
prefix_ssh
))
url
+=
strlen
(
prefix_ssh
);
if
(
ssh_stream_alloc
(
t
,
url
,
cmd_uploadpack
,
stream
)
<
0
)
return
-
1
;
s
=
(
ssh_stream
*
)
*
stream
;
if
(
gitno_extract_url_parts
(
&
host
,
&
port
,
&
user
,
&
pass
,
url
,
GIT_DEFAULT_PORT
)
<
0
)
goto
on_error
;
if
(
gitno_connect
(
&
s
->
socket
,
host
,
port
,
0
)
<
0
)
goto
on_error
;
t
->
current_stream
=
s
;
git__free
(
host
);
git__free
(
port
);
git__free
(
user
);
git__free
(
pass
);
return
0
;
on_error:
if
(
*
stream
)
ssh_stream_free
(
*
stream
);
git__free
(
host
);
git__free
(
port
);
return
-
1
;
}
static
int
_git_uploadpack
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
GIT_UNUSED
(
url
);
if
(
t
->
current_stream
)
{
*
stream
=
&
t
->
current_stream
->
parent
;
return
0
;
}
giterr_set
(
GITERR_NET
,
"Must call UPLOADPACK_LS before UPLOADPACK"
);
return
-
1
;
}
static
int
_git_receivepack_ls
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
const
char
*
cmd
,
git_smart_subtransport_stream
**
stream
)
{
char
*
host
,
*
user
=
NULL
;
ssh_stream
*
s
;
*
stream
=
NULL
;
if
(
ssh_stream_alloc
(
t
,
url
,
cmd
_receivepack
,
stream
)
<
0
)
if
(
ssh_stream_alloc
(
t
,
url
,
cmd
,
stream
)
<
0
)
return
-
1
;
s
=
(
ssh_stream
*
)
*
stream
;
...
...
@@ -359,6 +305,44 @@ on_error:
return
-
1
;
}
static
int
_git_uploadpack_ls
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
if
(
_git_ssh_setup_conn
(
t
,
url
,
cmd_uploadpack
,
stream
)
<
0
)
return
-
1
;
return
0
;
}
static
int
_git_uploadpack
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
GIT_UNUSED
(
url
);
if
(
t
->
current_stream
)
{
*
stream
=
&
t
->
current_stream
->
parent
;
return
0
;
}
giterr_set
(
GITERR_NET
,
"Must call UPLOADPACK_LS before UPLOADPACK"
);
return
-
1
;
}
static
int
_git_receivepack_ls
(
ssh_subtransport
*
t
,
const
char
*
url
,
git_smart_subtransport_stream
**
stream
)
{
if
(
_git_ssh_setup_conn
(
t
,
url
,
cmd_receivepack
,
stream
)
<
0
)
return
-
1
;
return
0
;
}
static
int
_git_receivepack
(
ssh_subtransport
*
t
,
const
char
*
url
,
...
...
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