git: simplify environment save/restore logic
[gitweb.git] / transport-helper.c
index 5d99a6bc2e7a10d40f6d8213e2f3cad254dbdb04..12f50d5b94802eed31bf36377f297bbd62f7d83c 100644 (file)
@@ -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);
@@ -1039,6 +1043,8 @@ int transport_helper_init(struct transport *transport, const char *name)
        struct helper_data *data = xcalloc(1, sizeof(*data));
        data->name = name;
 
+       transport_check_allowed(name);
+
        if (getenv("GIT_TRANSPORT_HELPER_DEBUG"))
                debug = 1;