git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] transport-helper: die on errors reading refs.
@ 2015-07-31 23:57 Stefan Beller
  0 siblings, 0 replies; only message in thread
From: Stefan Beller @ 2015-07-31 23:57 UTC (permalink / raw)
  To: gitster; +Cc: barkalow, mhagger, git, Stefan Beller

We check the return value of read_ref in 19 out of 21 cases.
This adds checks to the missing cases.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 transport-helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/transport-helper.c b/transport-helper.c
index 5d99a6b..68e498e 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -490,7 +490,8 @@ static int fetch_with_import(struct transport *transport,
 		else
 			private = xstrdup(name);
 		if (private) {
-			read_ref(private, posn->old_sha1);
+			if (read_ref(private, posn->old_sha1) < 0)
+				die("Could not read ref %s", private);
 			free(private);
 		}
 	}
@@ -1019,7 +1020,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
 		if (eon) {
 			if (has_attribute(eon + 1, "unchanged")) {
 				(*tail)->status |= REF_STATUS_UPTODATE;
-				read_ref((*tail)->name, (*tail)->old_sha1);
+				if (read_ref((*tail)->name,
+					     (*tail)->old_sha1) < 0)
+					die(N_("Could not read ref %s"),
+					    (*tail)->name);
 			}
 		}
 		tail = &((*tail)->next);
-- 
2.5.0.5.gf4cd9ae.dirty

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-31 23:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31 23:57 [PATCH] transport-helper: die on errors reading refs Stefan Beller

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).