Codebergdnkl
foot
master
1#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4#include <stdbool.h>
5#include <limits.h>
6#include <locale.h>
7#include <getopt.h>
8#include <signal.h>
9#include <errno.h>
10#include <unistd.h>
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <sys/utsname.h>
15#include <fcntl.h>
17#include <fcft/fcft.h>
19#define LOG_MODULE "main"
20#define LOG_ENABLE_DBG 0
21#include "log.h"
23#include "config.h"
24#include "fdm.h"
25#include "foot-features.h"
26#include "key-binding.h"
27#include "macros.h"
28#include "reaper.h"
29#include "render.h"
30#include "server.h"
31#include "shm.h"
32#include "terminal.h"
33#include "util.h"
34#include "xmalloc.h"
35#include "xsnprintf.h"
36#include "uri.h"
38#if !defined(__STDC_UTF_32__) || !__STDC_UTF_32__
39 #error "char32_t does not use UTF-32"
40#endif
42static bool
43fdm_sigint(struct fdm *fdm, int signo, void *data)
44{
45 *(volatile sig_atomic_t *)data = true;
46 return true;
47}
49struct sigusr_context {
50 struct terminal *term;
51 struct server *server;
52};
54static bool
55fdm_sigusr(struct fdm *fdm, int signo, void *data)
56{
57 xassert(signo == SIGUSR1 || signo == SIGUSR2);
59 struct sigusr_context *ctx = data;
61 if (ctx->server != NULL) {
62 if (signo == SIGUSR1)
63 server_global_theme_switch_to_dark(ctx->server);
64 else
65 server_global_theme_switch_to_light(ctx->server);
66 } else {
67 if (signo == SIGUSR1)
68 term_theme_switch_to_dark(ctx->term);
69 else
70 term_theme_switch_to_light(ctx->term);
71 }
73 return true;
74}
76static void
77print_usage(const char *prog_name)
78{
79 static const char options[] =
80 "\nOptions:\n"
81 " -c,--config=PATH load configuration from PATH ($XDG_CONFIG_HOME/foot/foot.ini)\n"
82 " -C,--check-config verify configuration, exit with 0 if ok, otherwise exit with 1\n"
83 " -o,--override=[section.]key=value override configuration option\n"
84 " -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n"
85 " -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n"
86 " -T,--title=TITLE initial window title (foot)\n"
87 " -a,--app-id=ID window application ID (foot)\n"
88 " --toplevel-tag=TAG set a custom toplevel tag\n"
89 " -m,--maximized start in maximized mode\n"
90 " -F,--fullscreen start in fullscreen mode\n"
91 " -L,--login-shell start shell as a login shell\n"
92 " --pty=PATH display an existing PTY instead of creating one\n"
93 " -D,--working-directory=DIR directory to start in (CWD)\n"
94 " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
95 " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
96 " -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n"
97 " Without PATH, $XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock will be used.\n"
98 " -H,--hold remain open after child process exits\n"
99 " -p,--print-pid=FILE|FD print PID to file or FD (only applicable in server mode)\n"
100 " -d,--log-level={info|warning|error|none} log level (warning)\n"
101 " -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
102 " -S,--log-no-syslog disable syslog logging (only applicable in server mode)\n"
103 " -v,--version show the version number and quit\n"
104 " -e ignored (for compatibility with xterm -e)\n";
106 printf("Usage: %s [OPTIONS...]\n", prog_name);
107 printf("Usage: %s [OPTIONS...] command [ARGS...]\n", prog_name);
108 puts(options);
109}
111bool
112locale_is_utf8(void)
113{
114 static const char u8[] = u8"ö";
115 xassert(strlen(u8) == 2);
117 char32_t w;
118 if (mbrtoc32(&w, u8, 2, &(mbstate_t){0}) != 2)
119 return false;
121 return w == U'ö';
122}
124struct shutdown_context {
125 struct terminal **term;
126 int exit_code;
127};
129static void
130term_shutdown_cb(void *data, int exit_code)
131{
132 struct shutdown_context *ctx = data;
133 *ctx->term = NULL;
134 ctx->exit_code = exit_code;
135}
137static bool
138print_pid(const char *pid_file, bool *unlink_at_exit)
139{
140 LOG_DBG("printing PID to %s", pid_file);
142 errno = 0;
143 char *end;
144 int pid_fd = strtoul(pid_file, &end, 10);
146 if (errno != 0 || *end != '\0') {
147 if ((pid_fd = open(pid_file,
148 O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
149 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) {
150 LOG_ERRNO("%s: failed to open", pid_file);
151 return false;
152 } else
153 *unlink_at_exit = true;
154 }
156 if (pid_fd >= 0) {
157 char pid[32];
158 size_t n = xsnprintf(pid, sizeof(pid), "%u\n", getpid());
160 ssize_t bytes = write(pid_fd, pid, n);
161 close(pid_fd);
163 if (bytes < 0) {
164 LOG_ERRNO("failed to write PID to FD=%u", pid_fd);
165 return false;
166 }
168 LOG_DBG("wrote %zd bytes to FD=%d", bytes, pid_fd);
169 return true;
170 } else
171 return false;
172}
174static void
175sanitize_signals(void)
176{
177 sigset_t mask;
178 sigemptyset(&mask);
179 sigprocmask(SIG_SETMASK, &mask, NULL);
181 struct sigaction dfl = {.sa_handler = SIG_DFL};
182 sigemptyset(&dfl.sa_mask);
184 for (int i = 1; i < SIGRTMAX; i++)
185 sigaction(i, &dfl, NULL);
186}
188enum {
189 PTY_OPTION = CHAR_MAX + 1,
190 TOPLEVEL_TAG_OPTION = CHAR_MAX + 2,
191};
193int
194main(int argc, char *const *argv)
195{
196 /* Custom exit code, to enable users to differentiate between foot
197 * itself failing, and the client application failing */
198 static const int foot_exit_failure = -26;
199 int ret = foot_exit_failure;
201 sanitize_signals();
203 /* XDG startup notifications */
204 const char *token = getenv("XDG_ACTIVATION_TOKEN");
205 unsetenv("XDG_ACTIVATION_TOKEN");
207 /* Startup notifications; we don't support it, but must ensure we
208 * don't pass this on to programs launched by us */
209 unsetenv("DESKTOP_STARTUP_ID");
211 const char *const prog_name = argc > 0 ? argv[0] : "<nullptr>";
213 static const struct option longopts[] = {
214 {"config", required_argument, NULL, 'c'},
215 {"check-config", no_argument, NULL, 'C'},
216 {"override", required_argument, NULL, 'o'},
217 {"term", required_argument, NULL, 't'},
218 {"title", required_argument, NULL, 'T'},
219 {"app-id", required_argument, NULL, 'a'},
220 {"class", required_argument, NULL, 'a'},
221 {"toplevel-tag", required_argument, NULL, TOPLEVEL_TAG_OPTION},
222 {"login-shell", no_argument, NULL, 'L'},
223 {"working-directory", required_argument, NULL, 'D'},
224 {"font", required_argument, NULL, 'f'},
225 {"window-size-pixels", required_argument, NULL, 'w'},
226 {"window-size-chars", required_argument, NULL, 'W'},
227 {"server", optional_argument, NULL, 's'},
228 {"hold", no_argument, NULL, 'H'},
229 {"maximized", no_argument, NULL, 'm'},
230 {"fullscreen", no_argument, NULL, 'F'},
231 {"presentation-timings", no_argument, NULL, 'P'}, /* Undocumented */
232 {"pty", required_argument, NULL, PTY_OPTION},
233 {"print-pid", required_argument, NULL, 'p'},
234 {"log-level", required_argument, NULL, 'd'},
235 {"log-colorize", optional_argument, NULL, 'l'},
236 {"log-no-syslog", no_argument, NULL, 'S'},
237 {"version", no_argument, NULL, 'v'},
238 {"help", no_argument, NULL, 'h'},
239 {NULL, no_argument, NULL, 0},
240 };
242 bool check_config = false;
243 const char *conf_path = NULL;
244 char *custom_cwd = NULL;
245 const char *pty_path = NULL;
246 bool as_server = false;
247 const char *conf_server_socket_path = NULL;
248 bool presentation_timings = false;
249 bool hold = false;
250 bool unlink_pid_file = false;
251 const char *pid_file = NULL;
252 enum log_class log_level = LOG_CLASS_WARNING;
253 enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
254 bool log_syslog = true;
255 user_notifications_t user_notifications = tll_init();
256 config_override_t overrides = tll_init();
258 while (true) {
259 int c = getopt_long(argc, argv, "+c:Co:t:T:a:LD:f:w:W:s::HmFPp:d:l::Sveh", longopts, NULL);
261 if (c == -1)
262 break;
264 switch (c) {
265 case 'c':
266 conf_path = optarg;
267 break;
269 case 'C':
270 check_config = true;
271 break;
273 case 'o':
274 tll_push_back(overrides, xstrdup(optarg));
275 break;
277 case 't':
278 tll_push_back(overrides, xstrjoin("term=", optarg));
279 break;
281 case 'L':
282 tll_push_back(overrides, xstrdup("login-shell=yes"));
283 break;
285 case 'T':
286 tll_push_back(overrides, xstrjoin("title=", optarg));
287 break;
289 case 'a':
290 tll_push_back(overrides, xstrjoin("app-id=", optarg));
291 break;
293 case TOPLEVEL_TAG_OPTION:
294 tll_push_back(overrides, xstrjoin("toplevel-tag=", optarg));
295 break;
297 case 'D': {
298 /* try to parse optarg as a local file URL. if it's not a
299 URL, use optarg directly */
300 char *scheme, *host, *path;
301 if (uri_parse(optarg, strlen(optarg), &scheme, NULL, NULL,
302 &host, NULL, &path, NULL, NULL)) {
303 if (!(streq(scheme, "file") && hostname_is_localhost(host))) {
304 fprintf(stderr, "error: %s: not a local path\n", optarg);
305 free(scheme);
306 free(host);
307 free(path);
308 return ret;
309 }
311 // ownership moved to custom_cwd, freed at out:
312 custom_cwd = path;
313 path = NULL;
314 } else
315 custom_cwd = xstrdup(optarg);
317 free(scheme);
318 free(host);
319 free(path);
321 struct stat st;
322 if (stat(custom_cwd, &st) < 0 || !(st.st_mode & S_IFDIR)) {
323 fprintf(stderr, "error: %s: not a directory\n", optarg);
324 return ret;
325 }
326 break;
327 }
329 case 'f': {
330 char *font_override = xstrjoin("font=", optarg);
331 tll_push_back(overrides, font_override);
332 break;
333 }
335 case 'w': {
336 unsigned width, height;
337 if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
338 fprintf(stderr, "error: invalid window-size-pixels: %s\n", optarg);
339 return ret;
340 }
342 tll_push_back(
343 overrides, xasprintf("initial-window-size-pixels=%ux%u",
344 width, height));
345 break;
346 }
348 case 'W': {
349 unsigned width, height;
350 if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
351 fprintf(stderr, "error: invalid window-size-chars: %s\n", optarg);
352 return ret;
353 }
355 tll_push_back(
356 overrides, xasprintf("initial-window-size-chars=%ux%u",
357 width, height));
358 break;
359 }
361 case 's':
362 as_server = true;
363 if (optarg != NULL)
364 conf_server_socket_path = optarg;
365 break;
367 case PTY_OPTION:
368 pty_path = optarg;
369 break;
371 case 'P':
372 presentation_timings = true;
373 break;
375 case 'H':
376 hold = true;
377 break;
379 case 'm':
380 tll_push_back(overrides, xstrdup("initial-window-mode=maximized"));
381 break;
383 case 'F':
384 tll_push_back(overrides, xstrdup("initial-window-mode=fullscreen"));
385 break;
387 case 'p':
388 pid_file = optarg;
389 break;
391 case 'd': {
392 int lvl = log_level_from_string(optarg);
393 if (unlikely(lvl < 0)) {
394 fprintf(
395 stderr,
396 "-d,--log-level: %s: argument must be one of %s\n",
397 optarg,
398 log_level_string_hint());
399 return ret;
400 }
401 log_level = lvl;
402 break;
403 }
405 case 'l':
406 if (optarg == NULL || streq(optarg, "auto"))
407 log_colorize = LOG_COLORIZE_AUTO;
408 else if (streq(optarg, "never"))
409 log_colorize = LOG_COLORIZE_NEVER;
410 else if (streq(optarg, "always"))
411 log_colorize = LOG_COLORIZE_ALWAYS;
412 else {
413 fprintf(stderr, "%s: argument must be one of 'never', 'always' or 'auto'\n", optarg);
414 return ret;
415 }
416 break;
418 case 'S':
419 log_syslog = false;
420 break;
422 case 'v':
423 print_version_and_features("foot ");
424 return EXIT_SUCCESS;
426 case 'h':
427 print_usage(prog_name);
428 return EXIT_SUCCESS;
430 case 'e':
431 break;
433 case '?':
434 return ret;
435 }
436 }
438 if (as_server && pty_path) {
439 fputs("error: --pty is incompatible with server mode\n", stderr);
440 return ret;
441 }
443 log_init(log_colorize, as_server && log_syslog,
444 as_server ? LOG_FACILITY_DAEMON : LOG_FACILITY_USER, log_level);
446 if (argc > 0) {
447 argc -= optind;
448 argv += optind;
449 }
451 LOG_INFO("%s", version_and_features);
453 {
454 struct utsname name;
455 if (uname(&name) < 0)
456 LOG_ERRNO("uname() failed");
457 else
458 LOG_INFO("arch: %s %s/%zu-bit",
459 name.sysname, name.machine, sizeof(void *) * 8);
460 }
462 srand(time(NULL));
464 const char *locale = setlocale(LC_CTYPE, "");
465 if (locale == NULL) {
466 /*
467 * If the user has configured an invalid locale, or a name of a locale
468 * that does not exist on this system, then the above call may return
469 * NULL. We should just continue with the fallback method below.
470 */
471 LOG_ERR("setlocale() failed. The most common cause is that the "
472 "configured locale is not available, or has been misspelled");
473 }
475 LOG_INFO("locale: %s", locale != NULL ? locale : "<invalid>");
477 bool bad_locale = locale == NULL || !locale_is_utf8();
478 if (bad_locale) {
479 static const char fallback_locales[][12] = {
480 "C.UTF-8",
481 "en_US.UTF-8",
482 };
483 char *saved_locale = locale != NULL ? xstrdup(locale) : NULL;
485 /*
486 * Try to force an UTF-8 locale. If we succeed, launch the
487 * user's shell as usual, but add a user-notification saying
488 * the locale has been changed.
489 */
490 for (size_t i = 0; i < ALEN(fallback_locales); i++) {
491 const char *const fallback_locale = fallback_locales[i];
493 if (setlocale(LC_CTYPE, fallback_locale) != NULL) {
494 if (saved_locale != NULL) {
495 LOG_WARN(
496 "'%s' is not a UTF-8 locale, falling back to '%s'",
497 saved_locale, fallback_locale);
499 user_notification_add_fmt(
500 &user_notifications, USER_NOTIFICATION_WARNING,
501 "'%s' is not a UTF-8 locale, falling back to '%s'",
502 saved_locale, fallback_locale);
504 } else {
505 LOG_WARN(
506 "invalid locale, falling back to '%s'", fallback_locale);
507 user_notification_add_fmt(
508 &user_notifications, USER_NOTIFICATION_WARNING,
509 "invalid locale, falling back to '%s'", fallback_locale);
510 }
512 bad_locale = false;
513 break;
514 }
515 }
517 if (bad_locale) {
518 if (saved_locale != NULL) {
519 LOG_ERR(
520 "'%s' is not a UTF-8 locale, and failed to find a fallback",
521 saved_locale);
523 user_notification_add_fmt(
524 &user_notifications, USER_NOTIFICATION_ERROR,
525 "'%s' is not a UTF-8 locale, and failed to find a fallback",
526 saved_locale);
527 } else {
528 LOG_ERR("invalid locale, and failed to find a fallback");
530 user_notification_add_fmt(
531 &user_notifications, USER_NOTIFICATION_ERROR,
532 "invalid locale, and failed to find a fallback");
533 }
534 }
535 free(saved_locale);
536 }
538 struct config conf = {NULL};
539 bool conf_successful = config_load(
540 &conf, conf_path, &user_notifications, &overrides, check_config, as_server);
542 tll_free_and_free(overrides, free);
543 if (!conf_successful) {
544 config_free(&conf);
545 return ret;
546 }
548 if (check_config) {
549 config_free(&conf);
550 return EXIT_SUCCESS;
551 }
553 _Static_assert((int)LOG_CLASS_ERROR == (int)FCFT_LOG_CLASS_ERROR,
554 "fcft log level enum offset");
555 _Static_assert((int)LOG_COLORIZE_ALWAYS == (int)FCFT_LOG_COLORIZE_ALWAYS,
556 "fcft colorize enum mismatch");
557 fcft_init(
558 (enum fcft_log_colorize)log_colorize,
559 as_server && log_syslog,
560 (enum fcft_log_class)log_level);
562 if (conf_server_socket_path != NULL) {
563 free(conf.server_socket_path);
564 conf.server_socket_path = xstrdup(conf_server_socket_path);
565 }
566 conf.presentation_timings = presentation_timings;
567 conf.hold_at_exit = hold;
569 if (conf.tweak.font_monospace_warn && conf.fonts[0].count > 0) {
570 check_if_font_is_monospaced(
571 conf.fonts[0].arr[0].pattern, &conf.notifications);
572 }
575 if (bad_locale) {
576 static char *const bad_locale_fake_argv[] = {"/bin/sh", "-c", "", NULL};
577 argc = 1;
578 argv = bad_locale_fake_argv;
579 conf.hold_at_exit = true;
580 }
582 struct fdm *fdm = NULL;
583 struct reaper *reaper = NULL;
584 struct key_binding_manager *key_binding_manager = NULL;
585 struct wayland *wayl = NULL;
586 struct renderer *renderer = NULL;
587 struct terminal *term = NULL;
588 struct server *server = NULL;
589 struct shutdown_context shutdown_ctx = {.term = &term, .exit_code = foot_exit_failure};
591 const char *cwd = custom_cwd;
592 char *_cwd = NULL;
594 if (cwd == NULL) {
595 size_t buf_len = 1024;
596 do {
597 _cwd = xrealloc(_cwd, buf_len);
598 errno = 0;
599 if (getcwd(_cwd, buf_len) == NULL && errno != ERANGE) {
600 LOG_ERRNO("failed to get current working directory");
601 goto out;
602 }
603 buf_len *= 2;
604 } while (errno == ERANGE);
605 cwd = _cwd;
606 }
608 const char *pwd = getenv("PWD");
609 if (pwd != NULL) {
610 char *resolved_path_cwd = realpath(cwd, NULL);
611 char *resolved_path_pwd = realpath(pwd, NULL);
613 if (resolved_path_cwd != NULL &&
614 resolved_path_pwd != NULL &&
615 streq(resolved_path_cwd, resolved_path_pwd))
616 {
617 /*
618 * The resolved path of $PWD matches the resolved path of
619 * the *actual* working directory - use $PWD.
620 *
621 * This makes a difference when $PWD refers to a symlink.
622 */
623 cwd = pwd;
624 }
626 free(resolved_path_cwd);
627 free(resolved_path_pwd);
628 }
630 shm_set_max_pool_size(conf.tweak.max_shm_pool_size);
631 shm_set_min_stride_alignment(conf.tweak.min_stride_alignment);
633 if ((fdm = fdm_init()) == NULL)
634 goto out;
636 if ((reaper = reaper_init(fdm)) == NULL)
637 goto out;
639 if ((key_binding_manager = key_binding_manager_new()) == NULL)
640 goto out;
642 if ((wayl = wayl_init(
643 fdm, key_binding_manager, conf.presentation_timings)) == NULL)
644 {
645 goto out;
646 }
648 if ((renderer = render_init(fdm, wayl)) == NULL)
649 goto out;
651 if (!as_server && (term = term_init(
652 &conf, fdm, reaper, wayl, "foot", cwd, token, pty_path,
653 argc, argv, NULL,
654 &term_shutdown_cb, &shutdown_ctx)) == NULL) {
655 goto out;
656 }
657 free(_cwd);
658 _cwd = NULL;
660 if (as_server && (server = server_init(&conf, fdm, reaper, wayl)) == NULL)
661 goto out;
663 volatile sig_atomic_t aborted = false;
664 if (!fdm_signal_add(fdm, SIGINT, &fdm_sigint, (void *)&aborted) ||
665 !fdm_signal_add(fdm, SIGTERM, &fdm_sigint, (void *)&aborted))
666 {
667 goto out;
668 }
670 struct sigusr_context sigusr_context = {
671 .term = term,
672 .server = server,
673 };
675 if (!fdm_signal_add(fdm, SIGUSR1, &fdm_sigusr, &sigusr_context) ||
676 !fdm_signal_add(fdm, SIGUSR2, &fdm_sigusr, &sigusr_context))
677 {
678 goto out;
679 }
681 struct sigaction sig_ign = {.sa_handler = SIG_IGN};
682 sigemptyset(&sig_ign.sa_mask);
683 if (sigaction(SIGHUP, &sig_ign, NULL) < 0 ||
684 sigaction(SIGPIPE, &sig_ign, NULL) < 0)
685 {
686 LOG_ERRNO("failed to ignore SIGHUP+SIGPIPE");
687 goto out;
688 }
690 if (as_server)
691 LOG_INFO("running as server; launch terminals by running footclient");
693 if (as_server && pid_file != NULL) {
694 if (!print_pid(pid_file, &unlink_pid_file))
695 goto out;
696 }
698 ret = EXIT_SUCCESS;
699 while (likely(!aborted && (as_server || tll_length(wayl->terms) > 0))) {
700 if (unlikely(!fdm_poll(fdm))) {
701 ret = foot_exit_failure;
702 break;
703 }
704 }
706out:
707 free(_cwd);
708 free(custom_cwd);
709 server_destroy(server);
710 term_destroy(term);
712 shm_fini();
713 render_destroy(renderer);
714 wayl_destroy(wayl);
715 key_binding_manager_destroy(key_binding_manager);
716 reaper_destroy(reaper);
717 fdm_signal_del(fdm, SIGUSR1);
718 fdm_signal_del(fdm, SIGUSR2);
719 fdm_signal_del(fdm, SIGTERM);
720 fdm_signal_del(fdm, SIGINT);
721 fdm_destroy(fdm);
723 config_free(&conf);
725 if (unlink_pid_file)
726 unlink(pid_file);
728 LOG_INFO("goodbye");
729 fcft_fini();
730 log_deinit();
731 return ret == EXIT_SUCCESS && !as_server ? shutdown_ctx.exit_code : ret;
732}
734UNITTEST
735{
736 char *s = xstrjoin("foo", "bar");
737 xassert(streq(s, "foobar"));
738 free(s);
740 s = xstrjoin3("foo", " ", "bar");
741 xassert(streq(s, "foo bar"));
742 free(s);
744 s = xstrjoin3("foo", ",", "bar");
745 xassert(streq(s, "foo,bar"));
746 free(s);
748 s = xstrjoin3("foo", "bar", "baz");
749 xassert(streq(s, "foobarbaz"));
750 free(s);
751}
Diagnostics5 git calls · 26 ms
CallStatusSizeTime026 ms
discover200178 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=178 git.server.agent=git/2.56.1-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=178 git.pkt.payload.max=35
ls-refs20010 KiB · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=10322 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=108 git.pkt.data=107 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=10322 git.pkt.payload.max=106 git.ls_refs.count=107 git.ls_refs.head=refs/heads/master
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=8830 git.pkt.payload.max=8730 git.sideband.band1.bytes=8730 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=14 git.pack.bytes=8730 git.fetch.wide.objects=14 git.fetch.wide.extra_bytes=9909 git.fetch.wide.blobs=0
fetchtree:0 · deepen 102009.3 KiB · hit4 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=9489 git.response.cache=HIT git.response.duration_ms=4 git.fetch.filter=tree:0 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=9489 git.pkt.payload.max=9389 git.sideband.band1.bytes=9389 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=9389 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a git.pack.full=10Open pack map
fetch2006.3 KiB · hit19 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=19 git.response.bytes=6453 git.response.cache=HIT git.response.duration_ms=19 git.fetch.wants=383d57a3698dba9cfafbf20f7704fe62527df918 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=6453 git.pkt.payload.max=6426 git.sideband.band1.bytes=6426 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://codeberg.org/dnkl/foot
- Ref
- refs/heads/master
- Commit
- c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
- cf-ray
- a5e190125d9c5b65
- Request
- 72c65f15…
- Protocol
- v2 · sha1
- Agent
- git/2.56.1-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format