[PATCH] builtin-remote: make reuse of code easier by not die()ing
From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:43
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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