git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <johannes.sixt@telecom.at>, git@vger.kernel.org
Subject: Re: [PATCH 1/5] Change git_connect() to return a struct child_process instead of a pid_t.
Date: Mon, 01 Oct 2007 09:23:19 +0200	[thread overview]
Message-ID: <4700A067.3010004@viscovery.net> (raw)
In-Reply-To: <7vbqbjg9zz.fsf@gitster.siamese.dyndns.org>

Junio C Hamano schrieb:
> Johannes Sixt <johannes.sixt@telecom.at> writes:
> 
>> 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.
> 
> Good description, except removal of checks for negative return
> of the calling sites raised my eyebrow and had me spend a few
> more minutes to review than necessary (see below).

I've thought about this issue a bit more.

Letting git_connect() die on error unconditionally is poison for any 
libification efforts. So here's a plan:

1. Let git_connect() return a struct child_process even for the
    non-forking case. This way a return value of NULL can uniquely
    identify a failure.

2. Keep the error checks in the callers (adjust to test for NULL).

3. Change the die() calls to return failure.

4. Note that the int fd[2] parameter to git_connect() is really an
    output: Remove it and use .in and .out of the returned struct
    child_process instead.

And maybe:

5. Reuse somehow the struct child_process that git_proxy_connect()
    already fills in.

Since my patch doesn't do (1), it can't do (2), i.e. keep the error checks - 
they must be removed because no unique failure value exists. So I could 
complete (1) in a new version of this patch, in order to also do (2). What 
is your preference?

-- Hannes

PS: I've postponed the completion of this plan - in favor of the MinGW port 
integration - because it only helps libification.

  parent reply	other threads:[~2007-10-01  7:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30 20:09 [PATCH 0/5] fork/exec removal series Johannes Sixt
2007-09-30 20:09 ` [PATCH 1/5] Change git_connect() to return a struct child_process instead of a pid_t Johannes Sixt
2007-09-30 20:09   ` [PATCH 2/5] Use start_command() in git_connect() instead of explicit fork/exec Johannes Sixt
2007-09-30 20:09     ` [PATCH 3/5] Use start_command() to run the filter " Johannes Sixt
2007-09-30 20:10       ` [PATCH 4/5] Use run_command() to spawn external diff programs instead of fork/exec Johannes Sixt
2007-09-30 20:10         ` [PATCH 5/5] Use start_comand() in builtin-fetch-pack.c instead of explicit fork/exec Johannes Sixt
2007-09-30 21:10         ` [PATCH 4/5] Use run_command() to spawn external diff programs instead of fork/exec Johannes Schindelin
2007-09-30 21:07       ` [PATCH 3/5] Use start_command() to run the filter instead of explicit fork/exec Johannes Schindelin
2007-09-30 20:43   ` [PATCH 1/5] Change git_connect() to return a struct child_process instead of a pid_t Junio C Hamano
2007-09-30 21:40     ` Johannes Sixt
2007-10-03 20:09       ` [PATCH 0/5, resend] fork/exec removal series Johannes Sixt
2007-10-03 20:09         ` [PATCH 1/5] Change git_connect() to return a struct child_process instead of a pid_t Johannes Sixt
2007-10-03 20:09           ` [PATCH 2/5] Use start_command() in git_connect() instead of explicit fork/exec Johannes Sixt
2007-10-03 20:09             ` [PATCH 3/5] Use start_command() to run the filter " Johannes Sixt
2007-10-03 20:09               ` [PATCH 4/5] Use run_command() to spawn external diff programs instead of fork/exec Johannes Sixt
2007-10-03 20:09                 ` [PATCH 5/5] Use start_comand() in builtin-fetch-pack.c instead of explicit fork/exec Johannes Sixt
2007-10-04  8:55                   ` Junio C Hamano
2007-10-04  9:22                     ` Johannes Sixt
2007-10-04 20:11                       ` Johannes Sixt
2007-10-01  7:23     ` Johannes Sixt [this message]
2007-10-01  8:39       ` [PATCH 1/5] Change git_connect() to return a struct child_process instead of a pid_t Junio C Hamano
2007-10-01  9:08         ` Johannes Sixt
2007-10-02 17:54           ` Junio C Hamano
2007-09-30 21:04   ` Johannes Schindelin
2007-09-30 20:20 ` [PATCH 0/5] fork/exec removal series Junio C Hamano
2007-09-30 21:14 ` Johannes Schindelin
2007-09-30 21:34   ` Johannes Sixt
2007-09-30 21:43     ` Johannes Schindelin
2007-10-01  7:07       ` Johannes Sixt
2007-10-01  9:49         ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4700A067.3010004@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.sixt@telecom.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).