From 22cb2f79ddb89a368dd823e815fa1b0587ff1b6a Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Thu, 10 Aug 2023 09:32:33 +0200 Subject: [PATCH] Squashed 'gitstatus/' changes from 4b47ca047..abb4f6a52 abb4f6a52 fix typos in docs and comments 958ae4e6d docs: explicitly mention that core.fsmonitor was disable in git benchmarks (#370) git-subtree-dir: gitstatus git-subtree-split: abb4f6a5225d12f51ffd8196060804b0c770482e --- README.md | 4 ++-- gitstatus.plugin.sh | 2 +- gitstatus.plugin.zsh | 2 +- src/check.h | 2 +- src/dir.h | 2 +- src/options.cc | 6 +++--- src/options.h | 2 +- src/repo.cc | 2 +- src/tag_db.cc | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 82a19981..a6631f63 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ repository was checked out to an ext4 filesystem on M.2 SSD. Three functionally equivalent tools for computing git status were benchmarked: * `gitstatusd` -* `git` with untracked cache enabled +* `git` with `core.untrackedcache` enabled and `core.fsmonitor` disabled * `lg2` -- a demo/example executable from [libgit2](https://github.com/romkatv/libgit2) that implements a subset of `git` functionality on top of libgit2 API; for the purposes of this benchmark the subset is sufficient to generate the same data as the other tools @@ -381,7 +381,7 @@ generated with the same tools and the same flags as the profile of libgit2. Since both profiles were generated from the same workload, absolute numbers can be compared. We can see that gitstatusd took 62 seconds in total compared to libgit2's 232 seconds. System calls at the -core of the algorithm are cleary visible. `__GI___fxstatat` is a flavor of `stat()`, and the other +core of the algorithm are clearly visible. `__GI___fxstatat` is a flavor of `stat()`, and the other three calls -- `__libc_openat64`, `__libc_close` and `__GI___fxstat` are responsible for opening directories and finding untracked files. Notice that there is almost nothing else in the profile apart from these calls. The rest of the code accounts for 3.77 seconds of CPU time -- 32 times less diff --git a/gitstatus.plugin.sh b/gitstatus.plugin.sh index 37b78f44..bfe16dc2 100644 --- a/gitstatus.plugin.sh +++ b/gitstatus.plugin.sh @@ -290,7 +290,7 @@ function gitstatus_stop() { unset _GITSTATUS_DIRTY_MAX_INDEX_SIZE _GITSTATUS_CLIENT_PID } -# Retrives status of a git repository from a directory under its working tree. +# Retrieves status of a git repository from a directory under its working tree. # # Usage: gitstatus_query [OPTION]... # diff --git a/gitstatus.plugin.zsh b/gitstatus.plugin.zsh index 228fea74..b74396d3 100644 --- a/gitstatus.plugin.zsh +++ b/gitstatus.plugin.zsh @@ -59,7 +59,7 @@ zmodload -F zsh/files b:zf_rm || return typeset -g _gitstatus_plugin_dir"${1:-}"="${${(%):-%x}:A:h}" -# Retrives status of a git repo from a directory under its working tree. +# Retrieves status of a git repo from a directory under its working tree. # ## Usage: gitstatus_query [OPTION]... NAME # diff --git a/src/check.h b/src/check.h index 82dceae1..682675a2 100644 --- a/src/check.h +++ b/src/check.h @@ -23,7 +23,7 @@ #include // The argument must be an expression convertible to bool. -// Does nothing if the expression evalutes to true. Otherwise +// Does nothing if the expression evaluates to true. Otherwise // it's equivalent to LOG(FATAL). #define CHECK(cond...) \ static_cast(0), (!!(cond)) ? static_cast(0) : LOG(FATAL) << #cond << ": " diff --git a/src/dir.h b/src/dir.h index 4d4cf3da..2a7533a3 100644 --- a/src/dir.h +++ b/src/dir.h @@ -25,7 +25,7 @@ namespace gitstatus { -// On error, leaves entries unchaged and returns false. Does not throw. +// On error, leaves entries unchanged and returns false. Does not throw. // // On success, appends names of files from the specified directory to entries and returns true. // Every appended entry is a null-terminated string. At -1 offset is its d_type. All elements diff --git a/src/options.cc b/src/options.cc index 46f3845c..b7abe5db 100644 --- a/src/options.cc +++ b/src/options.cc @@ -61,7 +61,7 @@ size_t ParseSizeT(const char* s) { void PrintUsage() { std::cout << "Usage: gitstatusd [OPTION]...\n" - << "Print machine-readable status of the git repos for directores in stdin.\n" + << "Print machine-readable status of the git repos for directories in stdin.\n" << "\n" << "OPTIONS\n" << " -l, --lock-fd=NUM [default=-1]\n" @@ -78,7 +78,7 @@ void PrintUsage() { << " maximum performance.\n" << "\n" << " -v, --log-level=STR [default=INFO]\n" - << " Don't write entires to log whose log level is below this. Log levels in\n" + << " Don't write entries to log whose log level is below this. Log levels in\n" << " increasing order: DEBUG, INFO, WARN, ERROR, FATAL.\n" << "\n" << " -r, --repo-ttl-seconds=NUM [default=3600]\n" @@ -141,7 +141,7 @@ void PrintUsage() { << "\n" << " 1. Request ID. Any string. Can be empty.\n" << " 2. Path to the directory for which git stats are being requested.\n" - << " If the first character is ':', it is removed and the remaning path\n" + << " If the first character is ':', it is removed and the remaining path\n" << " is treated as GIT_DIR.\n" << " 3. (Optional) '1' to disable computation of anything that requires reading\n" << " git index; '0' for the default behavior of computing everything.\n" diff --git a/src/options.h b/src/options.h index fd561e11..bb373155 100644 --- a/src/options.h +++ b/src/options.h @@ -62,7 +62,7 @@ struct Options : Limits { // If non-negative, send signal 0 to the specified PID when not receiving any requests for one // second; exit if signal sending fails. int parent_pid = -1; - // Don't write entires to log whose log level is below this. Log levels in increasing order: + // Don't write entries to log whose log level is below this. Log levels in increasing order: // DEBUG, INFO, WARN, ERROR, FATAL. LogLevel log_level = INFO; // Close git repositories that haven't been used for this long. This is meant to release resources diff --git a/src/repo.cc b/src/repo.cc index d7ea7d3e..a81594a4 100644 --- a/src/repo.cc +++ b/src/repo.cc @@ -155,7 +155,7 @@ IndexStats Repo::GetIndexStats(const git_oid* head, git_config* cfg) { VERIFY(!git_repository_index(&git_index_, repo_)) << GitError(); // Query an attribute (doesn't matter which) to initialize repo's attribute // cache. It's a workaround for synchronization bugs (data races) in libgit2 - // that result from lazy cache initialization without synchrnonization. + // that result from lazy cache initialization without synchronization. // Thankfully, subsequent cache reads and writes are properly synchronized. const char* attr; VERIFY(!git_attr_get(&attr, repo_, 0, "x", "x")) << GitError(); diff --git a/src/tag_db.cc b/src/tag_db.cc index 52cbaede..8bd445c7 100644 --- a/src/tag_db.cc +++ b/src/tag_db.cc @@ -268,7 +268,7 @@ void TagDb::ParsePack() { } if (!std::is_sorted(name2id_.begin(), name2id_.end(), ByName)) { - // "sorted" in the header of packed-refs promisses that this won't trigger. + // "sorted" in the header of packed-refs promises that this won't trigger. std::sort(name2id_.begin(), name2id_.end(), ByName); }