[PATCH] builtin-remote: make reuse of code easier by not die()ing
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 9, 2008, 20:11 UTC
- Message-ID
- <alpine.DEB.1.00.0806092110020.1783@racer>
- In-Reply-To
- <484D7860.6050301@free.fr>
By mistake, this programmer used a die() call when an error() was much more appropriate. Code reuse was not possible, hence this fix.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> ---
On Mon, 9 Jun 2008, Olivier Marin wrote:
> Johannes Schindelin a écrit : > > > > But did you not now make it harder to fix "that"? By relying > > on the die() behaviour in your regression fix? > > If I change return path for some functions, I will have to check > all the callers anyway. So, no I don't think it make things harder to > fix. Also I don't like to add dead code. > > Please, let me do this fix so that I can post my next patches. > After that I will be happy to work on what you asked.
Wow, that patch was hard ;-)
BTW this thread shows -- again -- how hard it is to push toward libification. People seem to actively block it.
builtin-remote.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c index 2641e20..9939c96 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -243,7 +243,7 @@ static int get_ref_states(const struct ref *ref, struct ref_states *states) for (i = 0; i < states->remote->fetch_refspec_nr; i++) if (get_fetch_map(ref, states->remote->fetch + i, &tail, 1)) - die("Could not get fetch map for refspec %s", + return error("Could not get fetch map for refspec %s", states->remote->fetch_refspec[i]); states->new.strdup_paths = states->tracked.strdup_paths = 1;
-- 1.5.6.rc1.181.gb439d