Change git_connect() to return a struct child_process instead of a pid_t.
This prepares the API of git_connect() and finish_connect() to operate on a struct child_process. Currently, we just use that object as a placeholder for the pid that we used to return. A follow-up patch will change the implementation of git_connect() and finish_connect() to make full use of the object. Old code had early-return-on-error checks at the calling sites of git_connect(), but since git_connect() dies on errors anyway, these checks were removed. [sp: Corrected style nit of "conn == NULL" to "!conn"] Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
committed by
Shawn O. Pearce
parent
ca5bb5d539
commit
98158e9cfd
@ -762,7 +762,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
|
||||
{
|
||||
int i, ret;
|
||||
int fd[2];
|
||||
pid_t pid;
|
||||
struct child_process *conn;
|
||||
struct ref *ref;
|
||||
struct stat st;
|
||||
|
||||
@ -773,16 +773,14 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
|
||||
st.st_mtime = 0;
|
||||
}
|
||||
|
||||
pid = git_connect(fd, (char *)dest, uploadpack,
|
||||
conn = git_connect(fd, (char *)dest, uploadpack,
|
||||
args.verbose ? CONNECT_VERBOSE : 0);
|
||||
if (pid < 0)
|
||||
return NULL;
|
||||
if (heads && nr_heads)
|
||||
nr_heads = remove_duplicates(nr_heads, heads);
|
||||
ref = do_fetch_pack(fd, nr_heads, heads, pack_lockfile);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
ret = finish_connect(pid);
|
||||
ret = finish_connect(conn);
|
||||
|
||||
if (!ret && nr_heads) {
|
||||
/* If the heads to pull were given, we should have
|
||||
|
||||
Reference in New Issue
Block a user