]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fetch-pack.c
test-lib: whitelist GIT_TR2_* in the environment
[thirdparty/git.git] / fetch-pack.c
index 08b3b356faeabdeeff90918142f7225ce5460e8c..e69993b2eb56885253af21b6de33fd487725e313 100644 (file)
@@ -191,8 +191,10 @@ static void send_request(struct fetch_pack_args *args,
        if (args->stateless_rpc) {
                send_sideband(fd, -1, buf->buf, buf->len, LARGE_PACKET_MAX);
                packet_flush(fd);
-       } else
-               write_or_die(fd, buf->buf, buf->len);
+       } else {
+               if (write_in_full(fd, buf->buf, buf->len) < 0)
+                       die_errno(_("unable to write to remote"));
+       }
 }
 
 static void insert_one_alternate_object(struct fetch_negotiator *negotiator,
@@ -1163,7 +1165,8 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
 
        /* Send request */
        packet_buf_flush(&req_buf);
-       write_or_die(fd_out, req_buf.buf, req_buf.len);
+       if (write_in_full(fd_out, req_buf.buf, req_buf.len) < 0)
+               die_errno(_("unable to write request to remote"));
 
        strbuf_release(&req_buf);
        return ret;
@@ -1290,6 +1293,8 @@ static void receive_shallow_info(struct fetch_pack_args *args,
                setup_alternate_shallow(&shallow_lock, &alternate_shallow_file,
                                        NULL);
                args->deepen = 1;
+       } else {
+               alternate_shallow_file = NULL;
        }
 }
 
@@ -1514,6 +1519,7 @@ static void update_shallow(struct fetch_pack_args *args,
                        rollback_lock_file(&shallow_lock);
                } else
                        commit_lock_file(&shallow_lock);
+               alternate_shallow_file = NULL;
                return;
        }
 
@@ -1537,6 +1543,7 @@ static void update_shallow(struct fetch_pack_args *args,
                                                &alternate_shallow_file,
                                                &extra);
                        commit_lock_file(&shallow_lock);
+                       alternate_shallow_file = NULL;
                }
                oid_array_clear(&extra);
                return;
@@ -1576,6 +1583,7 @@ static void update_shallow(struct fetch_pack_args *args,
                commit_lock_file(&shallow_lock);
                oid_array_clear(&extra);
                oid_array_clear(&ref);
+               alternate_shallow_file = NULL;
                return;
        }