From: Junio C Hamano Date: Mon, 27 Jan 2014 18:44:59 +0000 (-0800) Subject: Merge branch 'ef/mingw-write' X-Git-Tag: v1.9-rc1~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7b4e2b7e6aba677fcefffde79d0d3a53ae623b4f?hp=-c Merge branch 'ef/mingw-write' * ef/mingw-write: mingw: remove mingw_write prefer xwrite instead of write --- 7b4e2b7e6aba677fcefffde79d0d3a53ae623b4f diff --combined builtin/merge.c index 4941a6c36a,a6a38ee5ba..e576a7fdc6 --- a/builtin/merge.c +++ b/builtin/merge.c @@@ -367,7 -367,7 +367,7 @@@ static void squash_message(struct commi sha1_to_hex(commit->object.sha1)); pretty_print_commit(&ctx, commit, &out); } - if (write(fd, out.buf, out.len) < 0) + if (write_in_full(fd, out.buf, out.len) != out.len) die_errno(_("Writing SQUASH_MSG")); if (close(fd)) die_errno(_("Finishing SQUASH_MSG")); @@@ -446,17 -446,17 +446,17 @@@ static void merge_name(const char *remo die(_("'%s' does not point to a commit"), remote); if (dwim_ref(remote, strlen(remote), branch_head, &found_ref) > 0) { - if (!prefixcmp(found_ref, "refs/heads/")) { + if (starts_with(found_ref, "refs/heads/")) { strbuf_addf(msg, "%s\t\tbranch '%s' of .\n", sha1_to_hex(branch_head), remote); goto cleanup; } - if (!prefixcmp(found_ref, "refs/tags/")) { + if (starts_with(found_ref, "refs/tags/")) { strbuf_addf(msg, "%s\t\ttag '%s' of .\n", sha1_to_hex(branch_head), remote); goto cleanup; } - if (!prefixcmp(found_ref, "refs/remotes/")) { + if (starts_with(found_ref, "refs/remotes/")) { strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n", sha1_to_hex(branch_head), remote); goto cleanup; @@@ -570,8 -570,8 +570,8 @@@ static int git_merge_config(const char { int status; - if (branch && !prefixcmp(k, "branch.") && - !prefixcmp(k + 7, branch) && + if (branch && starts_with(k, "branch.") && + starts_with(k + 7, branch) && !strcmp(k + 7 + strlen(branch), ".mergeoptions")) { free(branch_mergeoptions); branch_mergeoptions = xstrdup(v); @@@ -1106,7 -1106,7 +1106,7 @@@ int cmd_merge(int argc, const char **ar * current branch. */ branch = branch_to_free = resolve_refdup("HEAD", head_sha1, 0, &flag); - if (branch && !prefixcmp(branch, "refs/heads/")) + if (branch && starts_with(branch, "refs/heads/")) branch += 11; if (!branch || is_null_sha1(head_sha1)) head_commit = NULL; diff --combined streaming.c index 9659f18be2,e3d697b88e..d7c9f32f0c --- a/streaming.c +++ b/streaming.c @@@ -113,7 -113,7 +113,7 @@@ static enum input_source istream_source oi->typep = type; oi->sizep = &size; - status = sha1_object_info_extended(sha1, oi); + status = sha1_object_info_extended(sha1, oi, 0); if (status < 0) return stream_error; @@@ -538,7 -538,7 +538,7 @@@ int stream_blob_to_fd(int fd, unsigned goto close_and_exit; } if (kept && (lseek(fd, kept - 1, SEEK_CUR) == (off_t) -1 || - write(fd, "", 1) != 1)) + xwrite(fd, "", 1) != 1)) goto close_and_exit; result = 0; diff --combined transport-helper.c index 087f617d39,ea34b39a81..ad72fbd53c --- a/transport-helper.c +++ b/transport-helper.c @@@ -190,7 -190,7 +190,7 @@@ static struct child_process *get_helper data->export = 1; else if (!strcmp(capname, "check-connectivity")) data->check_connectivity = 1; - else if (!data->refspecs && !prefixcmp(capname, "refspec ")) { + else if (!data->refspecs && starts_with(capname, "refspec ")) { ALLOC_GROW(refspecs, refspec_nr + 1, refspec_alloc); @@@ -199,17 -199,17 +199,17 @@@ data->connect = 1; } else if (!strcmp(capname, "signed-tags")) { data->signed_tags = 1; - } else if (!prefixcmp(capname, "export-marks ")) { + } else if (starts_with(capname, "export-marks ")) { struct strbuf arg = STRBUF_INIT; strbuf_addstr(&arg, "--export-marks="); strbuf_addstr(&arg, capname + strlen("export-marks ")); data->export_marks = strbuf_detach(&arg, NULL); - } else if (!prefixcmp(capname, "import-marks")) { + } else if (starts_with(capname, "import-marks")) { struct strbuf arg = STRBUF_INIT; strbuf_addstr(&arg, "--import-marks="); strbuf_addstr(&arg, capname + strlen("import-marks ")); data->import_marks = strbuf_detach(&arg, NULL); - } else if (!prefixcmp(capname, "no-private-update")) { + } else if (starts_with(capname, "no-private-update")) { data->no_private_update = 1; } else if (mandatory) { die("Unknown mandatory capability %s. This remote " @@@ -311,7 -311,7 +311,7 @@@ static int set_helper_option(struct tra if (!strcmp(buf.buf, "ok")) ret = 0; - else if (!prefixcmp(buf.buf, "error")) { + else if (starts_with(buf.buf, "error")) { ret = -1; } else if (!strcmp(buf.buf, "unsupported")) ret = 1; @@@ -360,12 -360,6 +360,12 @@@ static int fetch_with_fetch(struct tran data->transport_options.check_self_contained_and_connected) set_helper_option(transport, "check-connectivity", "true"); + if (transport->cloning) + set_helper_option(transport, "cloning", "true"); + + if (data->transport_options.update_shallow) + set_helper_option(transport, "update-shallow", "true"); + for (i = 0; i < nr_heads; i++) { const struct ref *posn = to_fetch[i]; if (posn->status & REF_STATUS_UPTODATE) @@@ -381,7 -375,7 +381,7 @@@ while (1) { recvline(data, &buf); - if (!prefixcmp(buf.buf, "lock ")) { + if (starts_with(buf.buf, "lock ")) { const char *name = buf.buf + 5; if (transport->pack_lockfile) warning("%s also locked %s", data->name, name); @@@ -652,10 -646,10 +652,10 @@@ static int push_update_ref_status(struc char *refname, *msg; int status; - if (!prefixcmp(buf->buf, "ok ")) { + if (starts_with(buf->buf, "ok ")) { status = REF_STATUS_OK; refname = buf->buf + 3; - } else if (!prefixcmp(buf->buf, "error ")) { + } else if (starts_with(buf->buf, "error ")) { status = REF_STATUS_REMOTE_REJECT; refname = buf->buf + 6; } else @@@ -1135,9 -1129,8 +1135,8 @@@ static int udt_do_write(struct unidirec return 0; /* Nothing to write. */ transfer_debug("%s is writable", t->dest_name); - bytes = write(t->dest, t->buf, t->bufuse); - if (bytes < 0 && errno != EWOULDBLOCK && errno != EAGAIN && - errno != EINTR) { + bytes = xwrite(t->dest, t->buf, t->bufuse); + if (bytes < 0 && errno != EWOULDBLOCK) { error("write(%s) failed: %s", t->dest_name, strerror(errno)); return -1; } else if (bytes > 0) {