Skip to content

Commit 18a5364

Browse files
committed
Merge branch 'maint'
* maint: change throughput display units with fast links clone: Supply the right commit hash to post-checkout when -b is used remote-curl: add missing initialization of argv0_path
2 parents 9ecb2a7 + 583371a commit 18a5364

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

builtin-clone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
641641
die("unable to write new index file");
642642

643643
err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1),
644-
sha1_to_hex(remote_head->old_sha1), "1", NULL);
644+
sha1_to_hex(our_head_points_at->old_sha1), "1",
645+
NULL);
645646

646647
if (!err && option_recursive)
647648
err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);

progress.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ static void throughput_string(struct throughput *tp, off_t total,
131131
} else {
132132
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
133133
}
134-
if (rate)
134+
135+
if (rate > 1 << 10) {
136+
int x = rate + 5; /* for rounding */
137+
snprintf(tp->display + sizeof(tp->display) - l, l,
138+
" | %u.%2.2u MiB/s",
139+
x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
140+
} else if (rate)
135141
snprintf(tp->display + sizeof(tp->display) - l, l,
136142
" | %u KiB/s", rate);
137143
}

remote-curl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "strbuf.h"
44
#include "walker.h"
55
#include "http.h"
6+
#include "exec_cmd.h"
67

78
static struct ref *get_refs(struct walker *walker, const char *url)
89
{
@@ -82,6 +83,7 @@ int main(int argc, const char **argv)
8283
const char *url;
8384
struct walker *walker = NULL;
8485

86+
git_extract_argv0_path(argv[0]);
8587
setup_git_directory();
8688
if (argc < 2) {
8789
fprintf(stderr, "Remote needed\n");

0 commit comments

Comments
 (0)