Squashed 'gitstatus/' changes from 075baf6e..39d34dff
39d34dff add a CHECK to Arena.Allocate<T>(n) git-subtree-dir: gitstatus git-subtree-split: 39d34dff4456067a0df17bdf1ea74b07c1983b39
This commit is contained in:
parent
604f19a9ea
commit
242ccfaef8
|
|
@ -1,5 +1,16 @@
|
||||||
* text=auto
|
* text=auto
|
||||||
*.zsh text eol=lf
|
|
||||||
*.zsh-theme text eol=lf
|
*.cc text eol=lf
|
||||||
/prompt_powerlevel9k_setup text eol=lf
|
*.h text eol=lf
|
||||||
/prompt_powerlevel10k_setup text eol=lf
|
*.info text eol=lf
|
||||||
|
*.json text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.zsh text eol=lf
|
||||||
|
|
||||||
|
/.clang-format text eol=lf
|
||||||
|
/LICENSE text eol=lf
|
||||||
|
/Makefile text eol=lf
|
||||||
|
/build text eol=lf
|
||||||
|
/install text eol=lf
|
||||||
|
/mbuild text eol=lf
|
||||||
|
|
|
||||||
|
|
@ -1 +1,8 @@
|
||||||
*.zwc
|
*.zwc
|
||||||
|
/core
|
||||||
|
/deps/libgit2-*.tar.gz
|
||||||
|
/locks
|
||||||
|
/logs
|
||||||
|
/obj
|
||||||
|
/usrbin/gitstatusd*
|
||||||
|
/.vscode/ipch
|
||||||
|
|
|
||||||
688
LICENSE
688
LICENSE
|
|
@ -1,22 +1,674 @@
|
||||||
Copyright (c) 2009-2014 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Copyright (c) 2014-2017 Ben Hilburn <bhilburn@gmail.com>
|
Version 3, 29 June 2007
|
||||||
Copyright (c) 2019 Roman Perepelitsa <roman.perepelitsa@gmail.com> and contributors (see https://github.com/romkatv/powerlevel10k/contributors)
|
|
||||||
|
|
||||||
MIT LICENSE
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Preamble
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The GNU General Public License is a free, copyleft license for
|
||||||
copies or substantial portions of the Software.
|
software and other kinds of works.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
The licenses for most software and other practical works are designed
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
to take away your freedom to share and change the works. By contrast,
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
share and change all versions of a program--to make sure it remains free
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|
|
||||||
55
Makefile
55
Makefile
|
|
@ -1,14 +1,57 @@
|
||||||
|
APPNAME ?= gitstatusd
|
||||||
|
OBJDIR ?= obj
|
||||||
|
|
||||||
|
CXX ?= g++
|
||||||
ZSH := $(shell command -v zsh 2> /dev/null)
|
ZSH := $(shell command -v zsh 2> /dev/null)
|
||||||
|
|
||||||
all:
|
VERSION ?= $(shell . ./build.info && printf "%s" "$$gitstatus_version")
|
||||||
|
|
||||||
|
# Note: -fsized-deallocation is not used to avoid binary compatibility issues on macOS.
|
||||||
|
#
|
||||||
|
# Sized delete is implemented as __ZdlPvm in /usr/lib/libc++.1.dylib but this symbol is
|
||||||
|
# missing in macOS prior to 10.13.
|
||||||
|
CXXFLAGS += -std=c++14 -funsigned-char -O3 -DNDEBUG -DGITSTATUS_VERSION=$(VERSION) # -Wall -g -fsanitize=thread
|
||||||
|
LDFLAGS += -pthread # -fsanitize=thread
|
||||||
|
LDLIBS += -lgit2 # -lprofiler -lunwind
|
||||||
|
|
||||||
|
SRCS := $(shell find src -name "*.cc")
|
||||||
|
OBJS := $(patsubst src/%.cc, $(OBJDIR)/%.o, $(SRCS))
|
||||||
|
|
||||||
|
all: $(APPNAME)
|
||||||
|
|
||||||
|
$(APPNAME): usrbin/$(APPNAME)
|
||||||
|
|
||||||
|
usrbin/$(APPNAME): $(OBJS)
|
||||||
|
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir -p -- $(OBJDIR)
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o: src/%.cc Makefile build.info | $(OBJDIR)
|
||||||
|
$(CXX) $(CXXFLAGS) -MM -MT $@ src/$*.cc >$(OBJDIR)/$*.dep
|
||||||
|
$(CXX) $(CXXFLAGS) -Wall -c -o $@ src/$*.cc
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf -- $(OBJDIR)
|
||||||
|
|
||||||
zwc:
|
zwc:
|
||||||
$(MAKE) -C gitstatus zwc
|
$(or $(ZSH),:) -fc 'for f in *.zsh install; do zcompile -R -- $$f.zwc $$f || exit; done'
|
||||||
$(or $(ZSH),:) -fc 'for f in *.zsh-theme internal/*.zsh; do zcompile -R -- $$f.zwc $$f || exit; done'
|
|
||||||
|
|
||||||
minify:
|
minify:
|
||||||
$(MAKE) -C gitstatus minify
|
rm -rf -- .clang-format .git .gitattributes .gitignore .vscode deps docs src usrbin/.gitkeep LICENSE Makefile README.md build mbuild
|
||||||
rm -rf -- .git .gitattributes .gitignore LICENSE Makefile README.md font.md powerlevel10k.png
|
|
||||||
|
|
||||||
pkg: zwc
|
pkg: zwc
|
||||||
$(MAKE) -C gitstatus pkg
|
GITSTATUS_DAEMON= GITSTATUS_CACHE_DIR=$(shell pwd)/usrbin ./install -f
|
||||||
|
|
||||||
|
-include $(OBJS:.o=.dep)
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "Usage: make [TARGET]"
|
||||||
|
@echo "Available targets:"
|
||||||
|
@echo " all Build $(APPNAME) (default target)"
|
||||||
|
@echo " clean Remove generated files and directories"
|
||||||
|
@echo " zwc Compile Zsh files"
|
||||||
|
@echo " minify Remove unnecessary files and folders"
|
||||||
|
@echo " pkg Create a package"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1713
config/p10k-lean.zsh
1713
config/p10k-lean.zsh
File diff suppressed because it is too large
Load Diff
|
|
@ -1,193 +0,0 @@
|
||||||
# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
|
|
||||||
#
|
|
||||||
# Differences from Pure:
|
|
||||||
#
|
|
||||||
# - Git:
|
|
||||||
# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
|
|
||||||
# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
|
|
||||||
#
|
|
||||||
# Apart from the differences listed above, the replication of Pure prompt is exact. This includes
|
|
||||||
# even the questionable parts. For example, just like in Pure, there is no indication of Git status
|
|
||||||
# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
|
|
||||||
# doesn't fit on one line, it wraps around with no attempt to shorten it.
|
|
||||||
#
|
|
||||||
# If you like the general style of Pure but not particularly attached to all its quirks, type
|
|
||||||
# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
|
|
||||||
# advantage of Powerlevel10k features that aren't present in Pure.
|
|
||||||
|
|
||||||
# Temporarily change options.
|
|
||||||
'builtin' 'local' '-a' 'p10k_config_opts'
|
|
||||||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
|
||||||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
|
||||||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
|
||||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
|
||||||
|
|
||||||
() {
|
|
||||||
emulate -L zsh -o extended_glob
|
|
||||||
|
|
||||||
# Unset all configuration options.
|
|
||||||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
|
||||||
|
|
||||||
# Zsh >= 5.1 is required.
|
|
||||||
[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return
|
|
||||||
|
|
||||||
# Prompt colors.
|
|
||||||
local grey=242
|
|
||||||
local red=1
|
|
||||||
local yellow=3
|
|
||||||
local blue=4
|
|
||||||
local magenta=5
|
|
||||||
local cyan=6
|
|
||||||
local white=7
|
|
||||||
|
|
||||||
# Left prompt segments.
|
|
||||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
|
||||||
# =========================[ Line #1 ]=========================
|
|
||||||
context # user@host
|
|
||||||
dir # current directory
|
|
||||||
vcs # git status
|
|
||||||
command_execution_time # previous command duration
|
|
||||||
# =========================[ Line #2 ]=========================
|
|
||||||
newline # \n
|
|
||||||
virtualenv # python virtual environment
|
|
||||||
prompt_char # prompt symbol
|
|
||||||
)
|
|
||||||
|
|
||||||
# Right prompt segments.
|
|
||||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
|
||||||
# =========================[ Line #1 ]=========================
|
|
||||||
# command_execution_time # previous command duration
|
|
||||||
# virtualenv # python virtual environment
|
|
||||||
# context # user@host
|
|
||||||
# time # current time
|
|
||||||
# =========================[ Line #2 ]=========================
|
|
||||||
newline # \n
|
|
||||||
)
|
|
||||||
|
|
||||||
# Basic style options that define the overall prompt look.
|
|
||||||
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
|
|
||||||
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
|
|
||||||
|
|
||||||
# Add an empty line before each prompt except the first. This doesn't emulate the bug
|
|
||||||
# in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
|
||||||
|
|
||||||
# Magenta prompt symbol if the last command succeeded.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
|
|
||||||
# Red prompt symbol if the last command failed.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
|
||||||
# Default prompt symbol.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
|
||||||
# Prompt symbol in command vi mode.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
|
|
||||||
# Prompt symbol in visual vi mode is the same as in command mode.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮'
|
|
||||||
# Prompt symbol in overwrite vi mode is the same as in command mode.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
|
|
||||||
|
|
||||||
# Grey Python Virtual Environment.
|
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
|
|
||||||
# Don't show Python version.
|
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
|
||||||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
|
||||||
|
|
||||||
# Blue current directory.
|
|
||||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
|
|
||||||
|
|
||||||
# Context format when root: user@host. The first part white, the rest grey.
|
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
|
|
||||||
# Context format when not root: user@host. The whole thing grey.
|
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
|
|
||||||
# Don't show context unless root or in SSH.
|
|
||||||
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
|
|
||||||
|
|
||||||
# Show previous command duration only if it's >= 5s.
|
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
|
|
||||||
# Don't show fractional seconds. Thus, 7s rather than 7.3s.
|
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
|
||||||
# Duration format: 1d 2h 3m 4s.
|
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
|
||||||
# Yellow previous command duration.
|
|
||||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
|
|
||||||
|
|
||||||
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
|
|
||||||
|
|
||||||
# Disable async loading indicator to make directories that aren't Git repositories
|
|
||||||
# indistinguishable from large Git repositories without known state.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
|
|
||||||
|
|
||||||
# Don't wait for Git status even for a millisecond, so that prompt always updates
|
|
||||||
# asynchronously when Git state changes.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
|
||||||
|
|
||||||
# Cyan ahead/behind arrows.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
|
|
||||||
# Don't show remote branch, current tag or stashes.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
|
|
||||||
# Don't show the branch icon.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
|
||||||
# When in detached HEAD state, show @commit where branch normally goes.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
|
|
||||||
# Don't show staged, unstaged, untracked indicators.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
|
|
||||||
# Show '*' when there are staged, unstaged or untracked files.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
|
|
||||||
# Show '⇣' if local branch is behind remote.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
|
|
||||||
# Show '⇡' if local branch is ahead of remote.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
|
|
||||||
# Don't show the number of commits next to the ahead/behind arrows.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
|
|
||||||
# Remove space between '⇣' and '⇡' and all trailing spaces.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
|
|
||||||
|
|
||||||
# Grey current time.
|
|
||||||
typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey
|
|
||||||
# Format for the current time: 09:51:02. See `man 3 strftime`.
|
|
||||||
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
|
|
||||||
# If set to true, time will update when you hit enter. This way prompts for the past
|
|
||||||
# commands will contain the start times of their commands rather than the end times of
|
|
||||||
# their preceding commands.
|
|
||||||
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
|
|
||||||
|
|
||||||
# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
|
|
||||||
# when accepting a command line. Supported values:
|
|
||||||
#
|
|
||||||
# - off: Don't change prompt when accepting a command line.
|
|
||||||
# - always: Trim down prompt when accepting a command line.
|
|
||||||
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
|
|
||||||
# typed after changing current working directory.
|
|
||||||
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
|
|
||||||
|
|
||||||
# Instant prompt mode.
|
|
||||||
#
|
|
||||||
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
|
||||||
# it incompatible with your zsh configuration files.
|
|
||||||
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
|
||||||
# during zsh initialization. Choose this if you've read and understood
|
|
||||||
# https://github.com/romkatv/powerlevel10k#instant-prompt.
|
|
||||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
|
||||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
|
||||||
# seen the warning, or if you are unsure what this all means.
|
|
||||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
|
||||||
|
|
||||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
|
||||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
|
||||||
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
|
||||||
# really need it.
|
|
||||||
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
|
||||||
|
|
||||||
# If p10k is already loaded, reload configuration.
|
|
||||||
# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
|
|
||||||
(( ! $+functions[p10k] )) || p10k reload
|
|
||||||
}
|
|
||||||
|
|
||||||
# Tell `p10k configure` which file it should overwrite.
|
|
||||||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
|
||||||
|
|
||||||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
|
||||||
'builtin' 'unset' 'p10k_config_opts'
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,111 +0,0 @@
|
||||||
# Config file for Powerlevel10k with the style of robbyrussell theme from Oh My Zsh.
|
|
||||||
#
|
|
||||||
# Original: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#robbyrussell.
|
|
||||||
#
|
|
||||||
# Replication of robbyrussell theme is exact. The only observable difference is in
|
|
||||||
# performance. Powerlevel10k prompt is very fast everywhere, even in large Git repositories.
|
|
||||||
#
|
|
||||||
# Usage: Source this file either before or after loading Powerlevel10k.
|
|
||||||
#
|
|
||||||
# source ~/powerlevel10k/config/p10k-robbyrussell.zsh
|
|
||||||
# source ~/powerlevel10k/powerlevel10k.zsh-theme
|
|
||||||
|
|
||||||
# Temporarily change options.
|
|
||||||
'builtin' 'local' '-a' 'p10k_config_opts'
|
|
||||||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
|
||||||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
|
||||||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
|
||||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
|
||||||
|
|
||||||
() {
|
|
||||||
emulate -L zsh -o extended_glob
|
|
||||||
|
|
||||||
# Unset all configuration options.
|
|
||||||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
|
||||||
|
|
||||||
# Zsh >= 5.1 is required.
|
|
||||||
[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return
|
|
||||||
|
|
||||||
# Left prompt segments.
|
|
||||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(prompt_char dir vcs)
|
|
||||||
# Right prompt segments.
|
|
||||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
|
||||||
|
|
||||||
# Basic style options that define the overall prompt look.
|
|
||||||
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
|
|
||||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
|
|
||||||
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
|
|
||||||
|
|
||||||
# Green prompt symbol if the last command succeeded.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=green
|
|
||||||
# Red prompt symbol if the last command failed.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red
|
|
||||||
# Prompt symbol: bold arrow.
|
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_CONTENT_EXPANSION='%B➜ '
|
|
||||||
|
|
||||||
# Cyan current directory.
|
|
||||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=cyan
|
|
||||||
# Show only the last segment of the current directory.
|
|
||||||
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
|
|
||||||
# Bold directory.
|
|
||||||
typeset -g POWERLEVEL9K_DIR_CONTENT_EXPANSION='%B$P9K_CONTENT'
|
|
||||||
|
|
||||||
# Git status formatter.
|
|
||||||
function my_git_formatter() {
|
|
||||||
emulate -L zsh
|
|
||||||
if [[ -n $P9K_CONTENT ]]; then
|
|
||||||
# If P9K_CONTENT is not empty, it's either "loading" or from vcs_info (not from
|
|
||||||
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
|
|
||||||
typeset -g my_git_format=$P9K_CONTENT
|
|
||||||
else
|
|
||||||
# Use VCS_STATUS_* parameters to assemble Git status. See reference:
|
|
||||||
# https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
|
|
||||||
typeset -g my_git_format="${1+%B%4F}git:(${1+%1F}"
|
|
||||||
my_git_format+=${${VCS_STATUS_LOCAL_BRANCH:-${VCS_STATUS_COMMIT[1,8]}}//\%/%%}
|
|
||||||
my_git_format+="${1+%4F})"
|
|
||||||
if (( VCS_STATUS_NUM_CONFLICTED || VCS_STATUS_NUM_STAGED ||
|
|
||||||
VCS_STATUS_NUM_UNSTAGED || VCS_STATUS_NUM_UNTRACKED )); then
|
|
||||||
my_git_format+=" ${1+%3F}✗"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
functions -M my_git_formatter 2>/dev/null
|
|
||||||
|
|
||||||
# Disable the default Git status formatting.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
|
|
||||||
# Install our own Git status formatter.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
|
|
||||||
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
|
|
||||||
# Grey Git status when loading.
|
|
||||||
typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=246
|
|
||||||
|
|
||||||
# Instant prompt mode.
|
|
||||||
#
|
|
||||||
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
|
||||||
# it incompatible with your zsh configuration files.
|
|
||||||
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
|
||||||
# during zsh initialization. Choose this if you've read and understood
|
|
||||||
# https://github.com/romkatv/powerlevel10k#instant-prompt.
|
|
||||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
|
||||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
|
||||||
# seen the warning, or if you are unsure what this all means.
|
|
||||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
|
||||||
|
|
||||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
|
||||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
|
||||||
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
|
||||||
# really need it.
|
|
||||||
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
|
||||||
|
|
||||||
# If p10k is already loaded, reload configuration.
|
|
||||||
# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
|
|
||||||
(( ! $+functions[p10k] )) || p10k reload
|
|
||||||
}
|
|
||||||
|
|
||||||
# Tell `p10k configure` which file it should overwrite.
|
|
||||||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
|
||||||
|
|
||||||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
|
||||||
'builtin' 'unset' 'p10k_config_opts'
|
|
||||||
185
font.md
185
font.md
|
|
@ -1,185 +0,0 @@
|
||||||
# Recommended font: Meslo Nerd Font patched for Powerlevel10k
|
|
||||||
|
|
||||||
Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple,
|
|
||||||
further customized by André Berg, and finally patched by yours truly with customized scripts
|
|
||||||
originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that
|
|
||||||
Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating
|
|
||||||
systems.
|
|
||||||
|
|
||||||
*FAQ*: [How was the recommended font created?](README.md#how-was-the-recommended-font-created)
|
|
||||||
|
|
||||||
## Automatic font installation
|
|
||||||
|
|
||||||
If you are using iTerm2 or Termux, `p10k configure` can install the recommended font for you.
|
|
||||||
Simply answer `Yes` when asked whether to install *Meslo Nerd Font*.
|
|
||||||
|
|
||||||
If you are using a different terminal, proceed with manual font installation. 👇
|
|
||||||
|
|
||||||
## Manual font installation
|
|
||||||
|
|
||||||
1. Download these four ttf files:
|
|
||||||
- [MesloLGS NF Regular.ttf](
|
|
||||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf)
|
|
||||||
- [MesloLGS NF Bold.ttf](
|
|
||||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf)
|
|
||||||
- [MesloLGS NF Italic.ttf](
|
|
||||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf)
|
|
||||||
- [MesloLGS NF Bold Italic.ttf](
|
|
||||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf)
|
|
||||||
1. Double-click on each file and click "Install". This will make `MesloLGS NF` font available to all
|
|
||||||
applications on your system.
|
|
||||||
1. Configure your terminal to use this font:
|
|
||||||
- **iTerm2**: Type `p10k configure` and answer `Yes` when asked whether to install
|
|
||||||
*Meslo Nerd Font*. Alternatively, open *iTerm2 → Preferences → Profiles → Text* and set *Font* to
|
|
||||||
`MesloLGS NF`.
|
|
||||||
- **Apple Terminal**: Open *Terminal → Preferences → Profiles → Text*, click *Change* under *Font*
|
|
||||||
and select `MesloLGS NF` family.
|
|
||||||
- **Hyper**: Open *Hyper → Edit → Preferences* and change the value of `fontFamily` under
|
|
||||||
`module.exports.config` to `MesloLGS NF`.
|
|
||||||
- **Visual Studio Code**: Open *File → Preferences → Settings* (PC) or
|
|
||||||
*Code → Preferences → Settings* (Mac), enter `terminal.integrated.fontFamily` in the search box at
|
|
||||||
the top of *Settings* tab and set the value below to `MesloLGS NF`.
|
|
||||||
Consult [this screenshot](
|
|
||||||
https://raw.githubusercontent.com/romkatv/powerlevel10k-media/389133fb8c9a2347929a23702ce3039aacc46c3d/visual-studio-code-font-settings.jpg)
|
|
||||||
to see how it should look like or see [this issue](
|
|
||||||
https://github.com/romkatv/powerlevel10k/issues/671) for extra information.
|
|
||||||
|
|
||||||
Note that software installed via [Snap](https://en.wikipedia.org/wiki/Snap_\(software\)) is
|
|
||||||
unable to use system fonts. If you've install Visual Studio Code via Snap, remove it by running
|
|
||||||
`sudo snap remove code` and install the official `.deb` build from the
|
|
||||||
[Visual Studio Code website](https://code.visualstudio.com/Download).
|
|
||||||
- **GNOME Terminal** (the default Ubuntu terminal): Open *Terminal → Preferences* and click on the
|
|
||||||
selected profile under *Profiles*. Check *Custom font* under *Text Appearance* and select
|
|
||||||
`MesloLGS NF Regular`.
|
|
||||||
- **Konsole**: Open *Settings → Edit Current Profile → Appearance*, click *Select Font* and select
|
|
||||||
`MesloLGS NF Regular`.
|
|
||||||
- **Tilix**: Open *Tilix → Preferences* and click on the selected profile under *Profiles*. Check
|
|
||||||
*Custom font* under *Text Appearance* and select `MesloLGS NF Regular`.
|
|
||||||
- **Windows Console Host** (the old thing): Click the icon in the top left corner, then
|
|
||||||
*Properties → Font* and set *Font* to `MesloLGS NF`.
|
|
||||||
- **Windows Terminal** by Microsoft (the new thing): Open *Settings* (<kbd>Ctrl+,</kbd>), click
|
|
||||||
either on the selected profile under *Profiles* or on *Defaults*, click *Appearance* and set
|
|
||||||
*Font face* to `MesloLGS NF`.
|
|
||||||
- **Conemu**: Open *Setup → General → Fonts* and set *Main console font* to `MesloLGS NF`.
|
|
||||||
- **IntelliJ** (and other IDEs by Jet Brains): Open *IDE → Edit → Preferences → Editor →
|
|
||||||
Color Scheme → Console Font*. Select *Use console font instead of the default* and set the font
|
|
||||||
name to `MesloLGS NF`.
|
|
||||||
- **Termux**: Type `p10k configure` and answer `Yes` when asked whether to install
|
|
||||||
*Meslo Nerd Font*.
|
|
||||||
- **Blink**: Type `config`, go to *Appearance*, tap *Add a new font*, tap *Open Gallery*, select
|
|
||||||
*MesloLGS NF.css*, tap *import* and type `exit` in the home view to reload the font.
|
|
||||||
- **Tabby** (formerly **Terminus**): Open *Settings → Appearance* and set *Font* to `MesloLGS NF`.
|
|
||||||
- **Terminator**: Open *Preferences* using the context menu. Under *Profiles* select the *General*
|
|
||||||
tab (should be selected already), uncheck *Use the system fixed width font* (if not already)
|
|
||||||
and select `MesloLGS NF Regular`. Exit the Preferences dialog by clicking *Close*.
|
|
||||||
- **Guake**: Right Click on an open terminal and open *Preferences*. Under *Appearance*
|
|
||||||
tab, uncheck *Use the system fixed width font* (if not already) and select `MesloLGS NF Regular`.
|
|
||||||
Exit the Preferences dialog by clicking *Close*.
|
|
||||||
- **MobaXterm**: Open *Settings* → *Configuration* → *Terminal* → (under *Terminal look and feel*)
|
|
||||||
and change *Font* to `MesloLGS NF`. If you have *sessions*, you need to change the font in each
|
|
||||||
of them through *Settings* → right click on an individual session → *Edit Session* → *Terminal
|
|
||||||
Settings* → *Font settings*.
|
|
||||||
- **Asbrú Connection Manager**: Open *Preferences → Local Shell Options → Look and Feel*, enable
|
|
||||||
*Use these personal options* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
|
|
||||||
To change the font for the remote host connections, go to *Preferences → Terminal Options →
|
|
||||||
Look and Feel* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
|
|
||||||
- **Warp**: Open Warp and Navigate to *Settings* then *Appearance*. Scroll down to *Text* Section
|
|
||||||
and under *"Terminal Font"*, select the `MesloLGS NF` font.
|
|
||||||
- **WSLtty**: Right click on an open terminal and then on *Options*. In the *Text* section, under
|
|
||||||
*Font*, click *"Select..."* and set Font to `MesloLGS NF Regular`.
|
|
||||||
- **Yakuake**: Click *≡* → *Manage Profiles* → *New* → *Appearance*. Click *Choose* next to the
|
|
||||||
*Font* dropdown, select `MesloLGS NF` and click *OK*. Click *OK* to save the profile. Select the
|
|
||||||
new profile and click *Set as Default*.
|
|
||||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.toml` and add the following
|
|
||||||
section to it:
|
|
||||||
```toml
|
|
||||||
[font.normal]
|
|
||||||
family = "MesloLGS NF"
|
|
||||||
```
|
|
||||||
- **foot**: Create or open `~/.config/foot/foot.ini` and add the following section to it:
|
|
||||||
```ini
|
|
||||||
font=MesloLGS NF:size=12
|
|
||||||
```
|
|
||||||
- **kitty**: Create or open `~/.config/kitty/kitty.conf` and add the following line to it:
|
|
||||||
```text
|
|
||||||
font_family MesloLGS NF
|
|
||||||
```
|
|
||||||
Restart kitty by closing all sessions and opening a new session.
|
|
||||||
- **puTTY**: Set *Window* → *Appearance* → *Font* to `MesloLGS NF`. Requires puTTY
|
|
||||||
version >= 0.75.
|
|
||||||
- **WezTerm**: Create or open `$HOME/.config/wezterm/wezterm.lua` and add the following:
|
|
||||||
```lua
|
|
||||||
local wezterm = require 'wezterm';
|
|
||||||
return {
|
|
||||||
font = wezterm.font("MesloLGS NF"),
|
|
||||||
}
|
|
||||||
```
|
|
||||||
If the file already exists, only add the line with the font to the existing return.
|
|
||||||
Also add the first line if it is not already present.
|
|
||||||
- **urxvt**: Create or open `~/.Xresources` and add the following line to it:
|
|
||||||
```text
|
|
||||||
URxvt.font: xft:MesloLGS NF:size=11
|
|
||||||
```
|
|
||||||
You can adjust the font size to your preference. After changing the config run
|
|
||||||
`xrdb ~/.Xresources` to reload it. The new config is applied to all new terminals.
|
|
||||||
- **xterm**: Create or open `~/.Xresources` and add the following line to it:
|
|
||||||
```text
|
|
||||||
xterm*faceName: MesloLGS NF
|
|
||||||
```
|
|
||||||
After changing the config run `xrdb ~/.Xresources` to reload it. The new config is applied to
|
|
||||||
all new terminals.
|
|
||||||
- **Zed**: Open `~/.config/zed/settings.json` and set `terminal.font_family` to `"MesloLGS NF"`.
|
|
||||||
```jsonc
|
|
||||||
{
|
|
||||||
"terminal": {
|
|
||||||
"font_family": "MesloLGS NF"
|
|
||||||
},
|
|
||||||
// Other settings.
|
|
||||||
}
|
|
||||||
```
|
|
||||||
- Crostini (Linux on Chrome OS): Open
|
|
||||||
chrome-untrusted://terminal/html/nassh_preferences_editor.html, set *Text font family* to
|
|
||||||
`'MesloLGS NF'` (including the quotes) and *Custom CSS (inline text)* to the following:
|
|
||||||
```css
|
|
||||||
@font-face {
|
|
||||||
font-family: "MesloLGS NF";
|
|
||||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Regular.ttf");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "MesloLGS NF";
|
|
||||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Bold.ttf");
|
|
||||||
font-weight: bold;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "MesloLGS NF";
|
|
||||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Italic.ttf");
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: "MesloLGS NF";
|
|
||||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Bold%20Italic.ttf");
|
|
||||||
font-weight: bold;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
**_CAVEAT_**: If you open the normal terminal preferences these settings will be overwritten.
|
|
||||||
- **Deepin Terminal**: Create or open `~/.config/deepin/deepin-terminal/config.conf` and add the following section
|
|
||||||
to it:
|
|
||||||
```ini
|
|
||||||
[basic.interface.font]
|
|
||||||
value = "MesloLGS NF"
|
|
||||||
```
|
|
||||||
- **Ghostty**: Open *Menu → Open Configuration* (Linux) or *Ghostty → Settings...* (Mac) and add
|
|
||||||
the following line:
|
|
||||||
```text
|
|
||||||
font-family = "MesloLGS NF"
|
|
||||||
```
|
|
||||||
1. Run `p10k configure` to generate a new `~/.p10k.zsh`. The old config may work
|
|
||||||
incorrectly with the new font.
|
|
||||||
|
|
||||||
_Using a different terminal and know how to set the font for it? Share your knowledge by sending a
|
|
||||||
PR to expand the list!_
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
* text=auto
|
|
||||||
|
|
||||||
*.cc text eol=lf
|
|
||||||
*.h text eol=lf
|
|
||||||
*.info text eol=lf
|
|
||||||
*.json text eol=lf
|
|
||||||
*.md text eol=lf
|
|
||||||
*.sh text eol=lf
|
|
||||||
*.zsh text eol=lf
|
|
||||||
|
|
||||||
/.clang-format text eol=lf
|
|
||||||
/LICENSE text eol=lf
|
|
||||||
/Makefile text eol=lf
|
|
||||||
/build text eol=lf
|
|
||||||
/install text eol=lf
|
|
||||||
/mbuild text eol=lf
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
*.zwc
|
|
||||||
/core
|
|
||||||
/deps/libgit2-*.tar.gz
|
|
||||||
/locks
|
|
||||||
/logs
|
|
||||||
/obj
|
|
||||||
/usrbin/gitstatusd*
|
|
||||||
/.vscode/ipch
|
|
||||||
|
|
@ -1,674 +0,0 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
APPNAME ?= gitstatusd
|
|
||||||
OBJDIR ?= obj
|
|
||||||
|
|
||||||
CXX ?= g++
|
|
||||||
ZSH := $(shell command -v zsh 2> /dev/null)
|
|
||||||
|
|
||||||
VERSION ?= $(shell . ./build.info && printf "%s" "$$gitstatus_version")
|
|
||||||
|
|
||||||
# Note: -fsized-deallocation is not used to avoid binary compatibility issues on macOS.
|
|
||||||
#
|
|
||||||
# Sized delete is implemented as __ZdlPvm in /usr/lib/libc++.1.dylib but this symbol is
|
|
||||||
# missing in macOS prior to 10.13.
|
|
||||||
CXXFLAGS += -std=c++14 -funsigned-char -O3 -DNDEBUG -DGITSTATUS_VERSION=$(VERSION) # -Wall -g -fsanitize=thread
|
|
||||||
LDFLAGS += -pthread # -fsanitize=thread
|
|
||||||
LDLIBS += -lgit2 # -lprofiler -lunwind
|
|
||||||
|
|
||||||
SRCS := $(shell find src -name "*.cc")
|
|
||||||
OBJS := $(patsubst src/%.cc, $(OBJDIR)/%.o, $(SRCS))
|
|
||||||
|
|
||||||
all: $(APPNAME)
|
|
||||||
|
|
||||||
$(APPNAME): usrbin/$(APPNAME)
|
|
||||||
|
|
||||||
usrbin/$(APPNAME): $(OBJS)
|
|
||||||
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
|
|
||||||
|
|
||||||
$(OBJDIR):
|
|
||||||
mkdir -p -- $(OBJDIR)
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: src/%.cc Makefile build.info | $(OBJDIR)
|
|
||||||
$(CXX) $(CXXFLAGS) -MM -MT $@ src/$*.cc >$(OBJDIR)/$*.dep
|
|
||||||
$(CXX) $(CXXFLAGS) -Wall -c -o $@ src/$*.cc
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf -- $(OBJDIR)
|
|
||||||
|
|
||||||
zwc:
|
|
||||||
$(or $(ZSH),:) -fc 'for f in *.zsh install; do zcompile -R -- $$f.zwc $$f || exit; done'
|
|
||||||
|
|
||||||
minify:
|
|
||||||
rm -rf -- .clang-format .git .gitattributes .gitignore .vscode deps docs src usrbin/.gitkeep LICENSE Makefile README.md build mbuild
|
|
||||||
|
|
||||||
pkg: zwc
|
|
||||||
GITSTATUS_DAEMON= GITSTATUS_CACHE_DIR=$(shell pwd)/usrbin ./install -f
|
|
||||||
|
|
||||||
-include $(OBJS:.o=.dep)
|
|
||||||
|
|
||||||
.PHONY: help
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "Usage: make [TARGET]"
|
|
||||||
@echo "Available targets:"
|
|
||||||
@echo " all Build $(APPNAME) (default target)"
|
|
||||||
@echo " clean Remove generated files and directories"
|
|
||||||
@echo " zwc Compile Zsh files"
|
|
||||||
@echo " minify Remove unnecessary files and folders"
|
|
||||||
@echo " pkg Create a package"
|
|
||||||
|
|
@ -1,534 +0,0 @@
|
||||||
# gitstatus
|
|
||||||
|
|
||||||
- **THE PROJECT HAS VERY LIMITED SUPPORT**
|
|
||||||
- **NO NEW FEATURES ARE IN THE WORKS**
|
|
||||||
- **MOST BUGS WILL GO UNFIXED**
|
|
||||||
|
|
||||||
**gitstatus** is a 10x faster alternative to `git status` and `git describe`. Its primary use
|
|
||||||
case is to enable fast git prompt in interactive shells.
|
|
||||||
|
|
||||||
Heavy lifting is done by **gitstatusd** -- a custom binary written in C++. It comes with Zsh and
|
|
||||||
Bash bindings for integration with shell.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
1. [Using from Zsh](#using-from-zsh)
|
|
||||||
1. [Using from Bash](#using-from-bash)
|
|
||||||
2. [Using from other shells](#using-from-other-shells)
|
|
||||||
1. [How it works](#how-it-works)
|
|
||||||
1. [Benchmarks](#benchmarks)
|
|
||||||
1. [Why fast](#why-fast)
|
|
||||||
1. [Requirements](#requirements)
|
|
||||||
1. [Compiling](#compiling)
|
|
||||||
1. [License](#license)
|
|
||||||
|
|
||||||
## Using from Zsh
|
|
||||||
|
|
||||||
The easiest way to take advantage of gitstatus from Zsh is to use a theme that's already integrated
|
|
||||||
with it. For example, [Powerlevel10k](https://github.com/romkatv/powerlevel10k) is a flexible and
|
|
||||||
fast theme with first-class gitstatus integration. If you install Powerlevel10k, you don't need to
|
|
||||||
install gitstatus.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
For those who wish to use gitstatus without a theme, there is
|
|
||||||
[gitstatus.prompt.zsh](gitstatus.prompt.zsh). Install it as follows:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/gitstatus
|
|
||||||
echo 'source ~/gitstatus/gitstatus.prompt.zsh' >>! ~/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
Users in China can use the official mirror on gitee.com for faster download.<br>
|
|
||||||
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git ~/gitstatus
|
|
||||||
echo 'source ~/gitstatus/gitstatus.prompt.zsh' >>! ~/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, if you have Homebrew installed:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
brew install romkatv/gitstatus/gitstatus
|
|
||||||
echo "source $(brew --prefix)/opt/gitstatus/gitstatus.prompt.zsh" >>! ~/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
(If you choose this option, replace `~/gitstatus` with `$(brew --prefix)/opt/gitstatus/gitstatus`
|
|
||||||
in all code snippets below.)
|
|
||||||
|
|
||||||
_Make sure to disable your current theme if you have one._
|
|
||||||
|
|
||||||
This will give you a basic yet functional prompt with git status in it. It's
|
|
||||||
[over 10x faster](#benchmarks) than any alternative that can give you comparable prompt. In order
|
|
||||||
to customize it, set `PROMPT` and/or `RPROMPT` at the end of `~/.zshrc` after sourcing
|
|
||||||
`gitstatus.prompt.zsh`. Insert `${GITSTATUS_PROMPT}` where you want git status to go. For example:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
source ~/gitstatus/gitstatus.prompt.zsh
|
|
||||||
|
|
||||||
PROMPT='%~%# ' # left prompt: directory followed by %/# (normal/root)
|
|
||||||
RPROMPT='$GITSTATUS_PROMPT' # right prompt: git status
|
|
||||||
```
|
|
||||||
|
|
||||||
The expansion of `${GITSTATUS_PROMPT}` can contain the following bits:
|
|
||||||
|
|
||||||
| segment | meaning |
|
|
||||||
|-------------|-------------------------------------------------------|
|
|
||||||
| `master` | current branch |
|
|
||||||
| `#v1` | HEAD is tagged with `v1`; not shown when on a branch |
|
|
||||||
| `@5fc6fca4` | current commit; not shown when on a branch or tag |
|
|
||||||
| `⇣1` | local branch is behind the remote by 1 commit |
|
|
||||||
| `⇡2` | local branch is ahead of the remote by 2 commits |
|
|
||||||
| `⇠3` | local branch is behind the push remote by 3 commits |
|
|
||||||
| `⇢4` | local branch is ahead of the push remote by 4 commits |
|
|
||||||
| `*5` | there are 5 stashes |
|
|
||||||
| `merge` | merge is in progress (could be some other action) |
|
|
||||||
| `~6` | there are 6 merge conflicts |
|
|
||||||
| `+7` | there are 7 staged changes |
|
|
||||||
| `!8` | there are 8 unstaged changes |
|
|
||||||
| `?9` | there are 9 untracked files |
|
|
||||||
|
|
||||||
`$GITSTATUS_PROMPT_LEN` tells you how long `$GITSTATUS_PROMPT` is when printed to the console.
|
|
||||||
[gitstatus.prompt.zsh](gitstatus.prompt.zsh) has an example of using it to truncate the current
|
|
||||||
directory.
|
|
||||||
|
|
||||||
If you'd like to change the format of git status, or want to have greater control over the
|
|
||||||
process of assembling `PROMPT`, you can copy and modify parts of
|
|
||||||
[gitstatus.prompt.zsh](gitstatus.prompt.zsh) instead of sourcing the script. Your `~/.zshrc`
|
|
||||||
might look something like this:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
source ~/gitstatus/gitstatus.plugin.zsh
|
|
||||||
|
|
||||||
function my_set_prompt() {
|
|
||||||
PROMPT='%~%# '
|
|
||||||
RPROMPT=''
|
|
||||||
|
|
||||||
if gitstatus_query MY && [[ $VCS_STATUS_RESULT == ok-sync ]]; then
|
|
||||||
RPROMPT=${${VCS_STATUS_LOCAL_BRANCH:-@${VCS_STATUS_COMMIT}}//\%/%%} # escape %
|
|
||||||
(( VCS_STATUS_NUM_STAGED )) && RPROMPT+='+'
|
|
||||||
(( VCS_STATUS_NUM_UNSTAGED )) && RPROMPT+='!'
|
|
||||||
(( VCS_STATUS_NUM_UNTRACKED )) && RPROMPT+='?'
|
|
||||||
fi
|
|
||||||
|
|
||||||
setopt no_prompt_{bang,subst} prompt_percent # enable/disable correct prompt expansions
|
|
||||||
}
|
|
||||||
|
|
||||||
gitstatus_stop 'MY' && gitstatus_start -s -1 -u -1 -c -1 -d -1 'MY'
|
|
||||||
autoload -Uz add-zsh-hook
|
|
||||||
add-zsh-hook precmd my_set_prompt
|
|
||||||
```
|
|
||||||
|
|
||||||
This snippet is sourcing `gitstatus.plugin.zsh` rather than `gitstatus.prompt.zsh`. The former
|
|
||||||
defines low-level bindings that communicate with gitstatusd over pipes. The latter is a simple
|
|
||||||
script that uses these bindings to assemble git prompt.
|
|
||||||
|
|
||||||
Unlike [Powerlevel10k](https://github.com/romkatv/powerlevel10k), code based on
|
|
||||||
[gitstatus.prompt.zsh](gitstatus.prompt.zsh) is communicating with gitstatusd synchronously. This
|
|
||||||
can make your prompt slow when working in a large git repository or on a slow machine. To avoid
|
|
||||||
this problem, call `gitstatus_query` asynchronously as documented in
|
|
||||||
[gitstatus.plugin.zsh](gitstatus.plugin.zsh). This can be quite challenging.
|
|
||||||
|
|
||||||
## Using from Bash
|
|
||||||
|
|
||||||
The easiest way to take advantage of gitstatus from Bash is via
|
|
||||||
[gitstatus.prompt.sh](gitstatus.prompt.sh). Install it as follows:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone --depth=1 https://github.com/romkatv/gitstatus.git ~/gitstatus
|
|
||||||
echo 'source ~/gitstatus/gitstatus.prompt.sh' >> ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
Users in China can use the official mirror on gitee.com for faster download.<br>
|
|
||||||
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git ~/gitstatus
|
|
||||||
echo 'source ~/gitstatus/gitstatus.prompt.sh' >> ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, if you have Homebrew installed:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
brew install romkatv/gitstatus/gitstatus
|
|
||||||
echo "source $(brew --prefix)/opt/gitstatus/gitstatus.prompt.sh" >> ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
(If you choose this option, replace `~/gitstatus` with `$(brew --prefix)/opt/gitstatus/gitstatus`
|
|
||||||
in all code snippets below.)
|
|
||||||
|
|
||||||
This will give you a basic yet functional prompt with git status in it. It's
|
|
||||||
[over 10x faster](#benchmarks) than any alternative that can give you comparable prompt.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
In order to customize your prompt, set `PS1` at the end of `~/.bashrc` after sourcing
|
|
||||||
`gitstatus.prompt.sh`. Insert `${GITSTATUS_PROMPT}` where you want git status to go. For example:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
source ~/gitstatus/gitstatus.prompt.sh
|
|
||||||
|
|
||||||
PS1='\w ${GITSTATUS_PROMPT}\n\$ ' # directory followed by git status and $/# (normal/root)
|
|
||||||
```
|
|
||||||
|
|
||||||
The expansion of `${GITSTATUS_PROMPT}` can contain the following bits:
|
|
||||||
|
|
||||||
| segment | meaning |
|
|
||||||
|-------------|-------------------------------------------------------|
|
|
||||||
| `master` | current branch |
|
|
||||||
| `#v1` | HEAD is tagged with `v1`; not shown when on a branch |
|
|
||||||
| `@5fc6fca4` | current commit; not shown when on a branch or tag |
|
|
||||||
| `⇣1` | local branch is behind the remote by 1 commit |
|
|
||||||
| `⇡2` | local branch is ahead of the remote by 2 commits |
|
|
||||||
| `⇠3` | local branch is behind the push remote by 3 commits |
|
|
||||||
| `⇢4` | local branch is ahead of the push remote by 4 commits |
|
|
||||||
| `*5` | there are 5 stashes |
|
|
||||||
| `merge` | merge is in progress (could be some other action) |
|
|
||||||
| `~6` | there are 6 merge conflicts |
|
|
||||||
| `+7` | there are 7 staged changes |
|
|
||||||
| `!8` | there are 8 unstaged changes |
|
|
||||||
| `?9` | there are 9 untracked files |
|
|
||||||
|
|
||||||
If you'd like to change the format of git status, or want to have greater control over the
|
|
||||||
process of assembling `PS1`, you can copy and modify parts of
|
|
||||||
[gitstatus.prompt.sh](gitstatus.prompt.sh) instead of sourcing the script. Your `~/.bashrc` might
|
|
||||||
look something like this:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
source ~/gitstatus/gitstatus.plugin.sh
|
|
||||||
|
|
||||||
function my_set_prompt() {
|
|
||||||
PS1='\w'
|
|
||||||
|
|
||||||
if gitstatus_query && [[ "$VCS_STATUS_RESULT" == ok-sync ]]; then
|
|
||||||
if [[ -n "$VCS_STATUS_LOCAL_BRANCH" ]]; then
|
|
||||||
PS1+=" ${VCS_STATUS_LOCAL_BRANCH//\\/\\\\}" # escape backslash
|
|
||||||
else
|
|
||||||
PS1+=" @${VCS_STATUS_COMMIT//\\/\\\\}" # escape backslash
|
|
||||||
fi
|
|
||||||
(( VCS_STATUS_HAS_STAGED" )) && PS1+='+'
|
|
||||||
(( VCS_STATUS_HAS_UNSTAGED" )) && PS1+='!'
|
|
||||||
(( VCS_STATUS_HAS_UNTRACKED" )) && PS1+='?'
|
|
||||||
fi
|
|
||||||
|
|
||||||
PS1+='\n\$ '
|
|
||||||
|
|
||||||
shopt -u promptvars # disable expansion of '$(...)' and the like
|
|
||||||
}
|
|
||||||
|
|
||||||
gitstatus_stop && gitstatus_start
|
|
||||||
PROMPT_COMMAND=my_set_prompt
|
|
||||||
```
|
|
||||||
|
|
||||||
This snippet is sourcing `gitstatus.plugin.sh` rather than `gitstatus.prompt.sh`. The former
|
|
||||||
defines low-level bindings that communicate with gitstatusd over pipes. The latter is a simple
|
|
||||||
script that uses these bindings to assemble git prompt.
|
|
||||||
|
|
||||||
Note: Bash bindings, unlike Zsh bindings, don't support asynchronous calls.
|
|
||||||
|
|
||||||
## Using from other shells
|
|
||||||
|
|
||||||
If there are no gitstatusd bindings for your shell, you'll need to get your hands dirty.
|
|
||||||
Use the existing bindings for inspiration; run `gitstatusd --help` or read the same thing in
|
|
||||||
[options.cc](src/options.cc).
|
|
||||||
|
|
||||||
## How it works
|
|
||||||
|
|
||||||
gitstatusd reads requests from stdin and prints responses to stdout. Requests contain an ID and
|
|
||||||
a directory. Responses contain the same ID and machine-readable git status for the directory.
|
|
||||||
gitstatusd keeps some state in memory for the directories it has seen in order to serve future
|
|
||||||
requests faster.
|
|
||||||
|
|
||||||
[Zsh bindings](gitstatus.plugin.zsh) and [Bash bindings](gitstatus.plugin.sh) start gitstatusd in
|
|
||||||
the background and communicate with it via pipes. Themes such as
|
|
||||||
[Powerlevel10k](https://github.com/romkatv/powerlevel10k) use these bindings to put git status in
|
|
||||||
`PROMPT`.
|
|
||||||
|
|
||||||
Note that gitstatus cannot be used as a drop-in replacement for `git status` command as it doesn't
|
|
||||||
produce output in the same format. It does perform the same computation though.
|
|
||||||
|
|
||||||
## Benchmarks
|
|
||||||
|
|
||||||
The following benchmark results were obtained on Intel i9-7900X running Ubuntu 18.04 in
|
|
||||||
a clean [chromium](https://github.com/chromium/chromium) repository synced to `9394e49a`. The
|
|
||||||
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 `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
|
|
||||||
|
|
||||||
Every tool was benchmark in cold and hot conditions. For `git` the first run in a repository was
|
|
||||||
considered cold, with the following runs considered hot. `lg2` was patched to compute results twice
|
|
||||||
in a single invocation without freeing the repository in between; the second run was considered hot.
|
|
||||||
The same patching was not done for `git` because `git` cannot be easily modified to refresh inmemory
|
|
||||||
index state between invocations; in fact, this limitation is one of the primary reasons developers
|
|
||||||
use libgit2. `gitstatusd` was benchmarked similarly to `lg2` with two result computations in the
|
|
||||||
same invocation.
|
|
||||||
|
|
||||||
Two commands were benchmarked: `status` and `describe`.
|
|
||||||
|
|
||||||
### Status
|
|
||||||
|
|
||||||
In this benchmark all tools were computing the equivalent of `git status`. Lower numbers are better.
|
|
||||||
|
|
||||||
| Tool | Cold | Hot |
|
|
||||||
|---------------|-----------:|------------:|
|
|
||||||
| **gitstatus** | **291 ms** | **30.9 ms** |
|
|
||||||
| git | 876 ms | 295 ms |
|
|
||||||
| lg2 | 1730 ms | 1310 ms |
|
|
||||||
|
|
||||||
gitstatusd is substantially faster than the alternatives, especially on hot runs. Note that hot runs
|
|
||||||
are of primary importance to the main use case of gitstatus in interactive shells.
|
|
||||||
|
|
||||||
The performance of `git status` fluctuated wildly in this benchmarks for reasons unknown to the
|
|
||||||
author. Moreover, performance is sticky -- once `git status` settles around a number, it stays
|
|
||||||
there for a long time. Numbers as diverse as 295, 352, 663 and 730 had been observed on hot runs on
|
|
||||||
the same repository. The number in the table is the lowest (fastest or best) that `git status` had
|
|
||||||
shown.
|
|
||||||
|
|
||||||
### Describe
|
|
||||||
|
|
||||||
In this benchmark all tools were computing the equivalent of `git describe --tags --exact-match`
|
|
||||||
to find tags that resolve to the same commit as `HEAD`. Lower numbers are better.
|
|
||||||
|
|
||||||
| Tool | Cold | Hot |
|
|
||||||
|---------------|------------:|--------------:|
|
|
||||||
| **gitstatus** | **4.04 ms** | **0.0345 ms** |
|
|
||||||
| git | 18.0 ms | 14.5 ms |
|
|
||||||
| lg2 | 185 ms | 45.2 ms |
|
|
||||||
|
|
||||||
gitstatusd is once again faster than the alternatives, more so on hot runs.
|
|
||||||
|
|
||||||
## Why fast
|
|
||||||
|
|
||||||
Since gitstatusd doesn't have to print all staged/unstaged/untracked files but only report
|
|
||||||
whether there are any, it can terminate repository scan early. It can also remember which files
|
|
||||||
were dirty on the previous run and check them first on the next run to avoid the scan entirely if
|
|
||||||
the files are still dirty. However, the benchmarks above were performed in a clean repository where
|
|
||||||
these shortcuts do not trigger. All benchmarked tools had to do the same work -- check the status
|
|
||||||
of every file in the index to see if it has changed, check every directory for newly created files,
|
|
||||||
etc. And yet, gitstatusd came ahead by a large margin. This section describes what it does that
|
|
||||||
makes it so fast.
|
|
||||||
|
|
||||||
Most of the following comparisons are done against libgit2 rather than git because of the author's
|
|
||||||
familiarity with the former but not the with latter. libgit2 has clean, well-documented APIs and an
|
|
||||||
elegant implementation, which makes it so much easier to work with and to analyze performance
|
|
||||||
bottlenecks.
|
|
||||||
|
|
||||||
### Summary for the impatient
|
|
||||||
|
|
||||||
Under the benchmark conditions described above, the equivalent of libgit2's
|
|
||||||
`git_diff_index_to_workdir` (the most expensive part of `status` command) is 46.3 times faster in
|
|
||||||
gitstatusd. The speedup comes from the following sources.
|
|
||||||
|
|
||||||
* gitstatusd uses more efficient data structures and algorithms and employs performance-conscious
|
|
||||||
coding style throughout the codebase. This reduces CPU time in userspace by 32x compared to libgit2.
|
|
||||||
* gitstatusd uses less expensive system calls and makes fewer of them. This reduces CPU time spent
|
|
||||||
in kernel by 1.9x.
|
|
||||||
* gitstatusd can utilize multiple cores to scan index and workdir in parallel with almost perfect
|
|
||||||
scaling. This reduces total run time by 12.4x while having virtually no effect on total CPU time.
|
|
||||||
|
|
||||||
### Problem statement
|
|
||||||
|
|
||||||
The most resource-intensive part of the `status` command is finding the difference between _index_
|
|
||||||
and _workdir_ (`git_diff_index_to_workdir` in libgit2). Index is a list of all files in the git
|
|
||||||
repository with their last modification times. This is an obvious simplification but it suffices for
|
|
||||||
this exposition. On disk, index is stored sorted by file path. Here's an example of git index:
|
|
||||||
|
|
||||||
| File | Last modification time |
|
|
||||||
|-------------|-----------------------:|
|
|
||||||
| Makefile | 2019-04-01T14:12:32Z |
|
|
||||||
| src/hello.c | 2019-04-01T14:12:00Z |
|
|
||||||
| src/hello.h | 2019-04-01T14:12:32Z |
|
|
||||||
|
|
||||||
This list needs to be compared to the list of files in the working directory. If any of the files
|
|
||||||
listed in the index are missing from the workdir or have different last modification time, they are
|
|
||||||
"unstaged" in gitstatusd parlance. If you run `git status`, they'll be shown as "changes not staged
|
|
||||||
for commit". Thus, any implementation of `status` command has to call `stat()` or one of its
|
|
||||||
variants on every file in the index.
|
|
||||||
|
|
||||||
In addition, all files in the working directory for which there is no entry in the index at all are
|
|
||||||
"untracked". `git status` will show them as "untracked files". Finding untracked files requires some
|
|
||||||
form of work directory traversal.
|
|
||||||
|
|
||||||
### Single-threaded scan
|
|
||||||
|
|
||||||
Let's see how `git_diff_index_to_workdir` from libgit2 accomplishes these tasks. Here's its CPU
|
|
||||||
profile from 200 hot runs over chromium repository.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
(The CPU profile was created with [gperftools](https://github.com/gperftools/gperftools) and
|
|
||||||
rendered with [pprof](https://github.com/google/pprof)).
|
|
||||||
|
|
||||||
We can see `__GI__lxstat` taking a lot of time. This is the `stat()` call for every file in the
|
|
||||||
index. We can also identify `__opendir`, `__readdir` and `__GI___close_nocancel` -- glibc wrappers
|
|
||||||
for reading the contents of a directory. This is for finding untracked files. Out of the total 232
|
|
||||||
seconds, 111 seconds -- or 47.7% -- was spent on these calls. The rest is computation -- comparing
|
|
||||||
strings, sorting arrays, etc.
|
|
||||||
|
|
||||||
Now let's take a look at the CPU profile of gitstatusd on the same task.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The first impression is that this profile looks pruned. This isn't an artifact. The profile was
|
|
||||||
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 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
|
|
||||||
than in libgit2.
|
|
||||||
|
|
||||||
So, one reason gitstatusd is fast is that it has efficient diffing code -- very little time is spent
|
|
||||||
outside of kernel. However, if we look closely, we can notice that system calls in gitstatusd are
|
|
||||||
_also_ faster than in libgit2. For example, libgit2 spent 72.07 seconds in `__GI__lxstat` while
|
|
||||||
gitstatusd spent only 48.82 seconds in `__GI___fxstatat`. There are two reasons for this difference.
|
|
||||||
First, libgit2 makes more `stat()` calls than is strictly required. It's not necessary to stat
|
|
||||||
directories because index only has files. There are 25k directories in chromium repository (and 300k
|
|
||||||
files) -- that's 25k `stat()` calls that could be avoided. The second reason is that libgit2 and
|
|
||||||
gitstatusd use different flavors of `stat()`. libgit2 uses `lstat()`, which takes a path to the file
|
|
||||||
as input. Its performance is linear in the number of subdirectories in the path because it needs to
|
|
||||||
perform a lookup for every one of them and to check permissions. gitstatusd uses `fstatat()`, which
|
|
||||||
takes a file descriptor to the parent directory and a name of the file. Just a single lookup, less
|
|
||||||
CPU time.
|
|
||||||
|
|
||||||
Similarly to `lstat()` vs `fstatat()`, it's faster to open files and directories with `openat()`
|
|
||||||
from the parent directory file descriptor than with regular `open()` that accepts full file path.
|
|
||||||
gitstatusd takes advantage of `openat()` to open directories as fast as possible. It opens about 90%
|
|
||||||
of the directories (this depends on the actual directory structure of the repository) from the
|
|
||||||
immediate parent -- the most efficient way -- and the remaining 10% it opens from the repository's
|
|
||||||
root directory. The reason it's done this way is to keep the maximum number of simultaneously open
|
|
||||||
file descriptors bounded. libgit2 can have O(repository depth) simultaneously open file descriptors,
|
|
||||||
which may be OK for a single-threaded application but can balloon to a large number when scans are
|
|
||||||
done by many threads simultaneously, like in gitstatusd.
|
|
||||||
|
|
||||||
There is no equivalent to `__opendir` or `__readdir` in the gitstatusd profile because it uses the
|
|
||||||
equivalent of [untracked cache](https://git-scm.com/docs/git-update-index#_untracked_cache) from
|
|
||||||
git. On the first scan of the workdir gitstatusd lists all files just like libgit2. But, unlike
|
|
||||||
libgit2, it remembers the last modification time of every directory along with the list of
|
|
||||||
untracked files under it. On the next scan, gitstatusd can skip listing files in directories whose
|
|
||||||
last modification time hasn't changed.
|
|
||||||
|
|
||||||
To summarize, here's what gitstatusd was doing when the CPU profile was captured:
|
|
||||||
|
|
||||||
1. `__libc_openat64`: Open every directory for which there are files in the index.
|
|
||||||
2. `__GI___fxstat`: Check last modification time of the directory. Since it's the same as on the
|
|
||||||
last scan, this directory has the same list of untracked files as before, which is empty (the
|
|
||||||
repository is clean).
|
|
||||||
3. `__GI___fxstatat`: Check last modification time for every file in the index that belongs to this
|
|
||||||
directory.
|
|
||||||
4. `__libc_close`: Close the file descriptor to the directory.
|
|
||||||
|
|
||||||
Here's how the very first scan of a repository looks like in gitstatusd:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
(Some glibc functions are mislabel on this profile. `explicit_bzero` and `__nss_passwd_lookup` are
|
|
||||||
in reality `strcmp` and `memcmp`.)
|
|
||||||
|
|
||||||
This is a superset of the previous -- hot -- profile, with an extra `syscall` and string sorting for
|
|
||||||
directory listing. gitstatusd uses `getdents64` Linux system call directly, bypassing the glibc
|
|
||||||
wrapper that libgit2 uses. This is 23% faster. The details of this optimization can be found in a
|
|
||||||
[separate document](docs/listdir.md).
|
|
||||||
|
|
||||||
### Multithreading
|
|
||||||
|
|
||||||
The diffing algorithm in gitstatusd was designed from the ground up with the intention of using it
|
|
||||||
concurrently from multiple threads. With a fast SSD, `status` is CPU bound, so taking advantage of
|
|
||||||
all available CPU cores is an obvious way to yield results faster.
|
|
||||||
|
|
||||||
gitstatusd exhibits almost perfect scaling from multithreading. Engaging all cores allows it to
|
|
||||||
produce results 12.4 times faster than in single-threaded execution. This is on Intel i9-7900X with
|
|
||||||
10 cores (20 with hyperthreading) with single-core frequency of 4.3GHz and all-core frequency of
|
|
||||||
4.0GHz.
|
|
||||||
|
|
||||||
Note: `git status` also uses all available cores in some parts of its algorithm while `lg2` does
|
|
||||||
everything in a single thread.
|
|
||||||
|
|
||||||
### Postprocessing
|
|
||||||
|
|
||||||
Once the difference between the index and the workdir is found, we have a list of _candidates_ --
|
|
||||||
files that may be unstaged or untracked. To make the final judgement, these files need to be checked
|
|
||||||
against `.gitignore` rules and a few other things.
|
|
||||||
|
|
||||||
gitstatusd uses [patched libgit2](https://github.com/romkatv/libgit2) for this step. This fork
|
|
||||||
adds several optimizations that make libgit2 faster. The patched libgit2 performs more than twice
|
|
||||||
as fast in the benchmark as the original even without changes in the user code (that is, in the
|
|
||||||
code that uses the libgit2 APIs). The fork also adds several API extensions, most notable of which
|
|
||||||
is the support for multi-threaded scans. If `lg2 status` is modified to take advantage of these
|
|
||||||
extensions, it outperforms the original libgit2 by a factor of 18. Lastly, the fork fixes a score of
|
|
||||||
bugs, most of which become apparent only when using libgit2 from multiple threads.
|
|
||||||
|
|
||||||
_WARNING: Changes to libgit2 are extensive but the testing they underwent isn't. It is
|
|
||||||
**not recommended** to use the patched libgit2 in production._
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
* To compile: binutils, cmake, gcc, g++, git and GNU make.
|
|
||||||
* To run: Linux, macOS, FreeBSD, Android, WSL, Cygwin or MSYS2.
|
|
||||||
|
|
||||||
## Compiling
|
|
||||||
|
|
||||||
There are prebuilt `gitstatusd` binaries in [releases](
|
|
||||||
https://github.com/romkatv/gitstatus/releases). When using the official shell bindings
|
|
||||||
provided by gitstatus, the right binary for your architecture gets downloaded automatically.
|
|
||||||
|
|
||||||
If prebuilt binaries don't work for you, you'll need to get your hands dirty.
|
|
||||||
|
|
||||||
### Compiling for personal use
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
git clone --depth=1 https://github.com/romkatv/gitstatus.git
|
|
||||||
cd gitstatus
|
|
||||||
./build -w -s -d docker
|
|
||||||
```
|
|
||||||
|
|
||||||
Users in China can use the official mirror on gitee.com for faster download.<br>
|
|
||||||
中国大陆用户可以使用 gitee.com 上的官方镜像加速下载.
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
git clone --depth=1 https://gitee.com/romkatv/gitstatus.git
|
|
||||||
cd gitstatus
|
|
||||||
./build -w -s -d docker
|
|
||||||
```
|
|
||||||
|
|
||||||
- If it says that `-d docker` is not supported on your OS, remove this flag.
|
|
||||||
- If it says that `-s` is not supported on your OS, remove this flag.
|
|
||||||
- If it tell you to install docker but you cannot or don't want to, remove `-d docker`.
|
|
||||||
- If it says that some command is missing, install it.
|
|
||||||
|
|
||||||
If everything goes well, the newly built binary will appear in `./usrbin`. It'll be picked up
|
|
||||||
by shell bindings automatically.
|
|
||||||
|
|
||||||
When you update shell bindings, they may refuse to work with the binary you've built earlier. In
|
|
||||||
this case you'll need to rebuild.
|
|
||||||
|
|
||||||
If you are using gitstatus through [Powerlevel10k](https://github.com/romkatv/powerlevel10k), the
|
|
||||||
instructions are the same except that you don't need to clone gitstatus. Instead, change your
|
|
||||||
current directory to `/path/to/powerlevel10k/gitstatus` (`/path/to/powerlevel10k` is the directory
|
|
||||||
where you've installed Powerlevel10k) and run `./build -w -s -d docker` from there as described
|
|
||||||
above.
|
|
||||||
|
|
||||||
### Compiling for distribution
|
|
||||||
|
|
||||||
It's currently neither easy nor recommended to package and distribute gitstatus. There are no
|
|
||||||
instructions you can follow that would allow you to easily update your package when new versions of
|
|
||||||
gitstatus are released. This may change in the future but not soon.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
GNU General Public License v3.0. See [LICENSE](LICENSE). Contributions are covered by the same
|
|
||||||
license.
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
# Fewer than 47 columns will probably work. Haven't tried it.
|
|
||||||
typeset -gr __p9k_wizard_columns=47
|
|
||||||
# The bottleneck is ask_tails with nerd fonts. Everything else works fine with 12 lines.
|
|
||||||
typeset -gr __p9k_wizard_lines=14
|
|
||||||
typeset -gr __p9k_zd=${ZDOTDIR:-$HOME}
|
|
||||||
typeset -gr __p9k_zd_u=${${${(q)__p9k_zd}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
|
||||||
typeset -gr __p9k_zshrc=${${:-$__p9k_zd/.zshrc}:A}
|
|
||||||
typeset -gr __p9k_zshrc_u=$__p9k_zd_u/.zshrc
|
|
||||||
typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
|
||||||
|
|
||||||
function _p9k_can_configure() {
|
|
||||||
[[ $1 == '-q' ]] && local -i q=1 || local -i q=0
|
|
||||||
function $0_error() {
|
|
||||||
(( q )) || print -rP "%1F[ERROR]%f %Bp10k configure%b: $1" >&2
|
|
||||||
}
|
|
||||||
typeset -g __p9k_cfg_path_o=${POWERLEVEL9K_CONFIG_FILE:=${ZDOTDIR:-~}/.p10k.zsh}
|
|
||||||
typeset -g __p9k_cfg_basename=${__p9k_cfg_path_o:t}
|
|
||||||
typeset -g __p9k_cfg_path=${__p9k_cfg_path_o:A}
|
|
||||||
typeset -g __p9k_cfg_path_u=${${${(q)__p9k_cfg_path_o}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
|
||||||
{
|
|
||||||
[[ -e $__p9k_zd ]] || { $0_error "$__p9k_zd_u does not exist"; return 1 }
|
|
||||||
[[ -d $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not a directory"; return 1 }
|
|
||||||
[[ ! -d $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a directory"; return 1 }
|
|
||||||
[[ ! -d $__p9k_zshrc ]] || { $0_error "$__p9k_zshrc_u is a directory"; return 1 }
|
|
||||||
|
|
||||||
local dir=${__p9k_cfg_path:h}
|
|
||||||
while [[ ! -e $dir && $dir != ${dir:h} ]]; do dir=${dir:h}; done
|
|
||||||
if [[ ! -d $dir ]]; then
|
|
||||||
$0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is not a directory"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [[ ! -w $dir ]]; then
|
|
||||||
$0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is readonly"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || {
|
|
||||||
$0_error "$__p9k_cfg_path_u is a special file"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
[[ ! -e $__p9k_zshrc || -f $__p9k_zshrc || -h $__p9k_zshrc ]] || {
|
|
||||||
$0_error "$__p9k_zshrc_u a special file"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
[[ ! -e $__p9k_zshrc || -r $__p9k_zshrc ]] || {
|
|
||||||
$0_error "$__p9k_zshrc_u is not readable"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
local style
|
|
||||||
for style in lean lean-8colors classic rainbow pure; do
|
|
||||||
[[ -r $__p9k_root_dir/config/p10k-$style.zsh ]] || {
|
|
||||||
$0_error "$__p9k_root_dir_u/config/p10k-$style.zsh is not readable"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
done
|
|
||||||
|
|
||||||
(( LINES >= __p9k_wizard_lines && COLUMNS >= __p9k_wizard_columns )) || {
|
|
||||||
$0_error "terminal size too small; must be at least $__p9k_wizard_columns columns by $__p9k_wizard_lines lines"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
[[ -t 0 && -t 1 ]] || {
|
|
||||||
$0_error "no TTY"
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
} always {
|
|
||||||
unfunction $0_error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function p9k_configure() {
|
|
||||||
eval "$__p9k_intro"
|
|
||||||
_p9k_can_configure || return
|
|
||||||
(
|
|
||||||
set -- -f
|
|
||||||
builtin source $__p9k_root_dir/internal/wizard.zsh
|
|
||||||
)
|
|
||||||
local ret=$?
|
|
||||||
case $ret in
|
|
||||||
0) builtin source $__p9k_cfg_path; _p9k__force_must_init=1;;
|
|
||||||
69) return 0;;
|
|
||||||
*) return $ret;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
1174
internal/icons.zsh
1174
internal/icons.zsh
File diff suppressed because it is too large
Load Diff
|
|
@ -1,197 +0,0 @@
|
||||||
battery: use the same technique as in vpn_ip to avoid reset=2.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no
|
|
||||||
gitstatus.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- call vcs_info on worker. the tricky question is what to display while "loading".
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add _SHOW_SYSTEM to all *env segments.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- support states in SHOW_ON_COMMAND: POWERLEVEL9K_SEGMENT_STATE_SHOW_ON_COMMAND='...'
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
add POWERLEVEL9K_${SEGMENT}_${STATE}_SHOW_IN_DIR='pwd_pattern'; implement the same way as
|
|
||||||
SHOW_ON_UPGLOB. how should it interact with POWERLEVEL9K_${SEGMENT}_DISABLED_DIR_PATTERN?
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
add `p10k upglob`; returns 0 on match and sets REPLY to the directory where match was found.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
when directory cannot be shortened any further, start chopping off segments from the left and
|
|
||||||
replacing the chopped off part with `…`. e.g., `…/x/anchor/y/anchor`. the shortest dir
|
|
||||||
representation is thus `…/last` or `…/last` depending on whether the last segment is an anchor.
|
|
||||||
the replacement parameter's value is `…/` (with a slash) to allow for `x/anchor/y/anchor`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add to faq: how do i display an environment variable in prompt? link it from "extensible"
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add to faq: how do i display an icon in prompt? link it from "extensible"
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add root_indicator to config templates
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- test chruby and add it to config templates
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add ssh to config templates
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add swift version to config templates; see if there is a good pattern for PROJECT_ONLY
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add swiftenv
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- add faq: how to customize directory shortening? mention POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER,
|
|
||||||
POWERLEVEL9K_DIR_MAX_LENGTH and co., and truncate_to_last.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
fix a bug in zsh: https://github.com/romkatv/powerlevel10k/issues/502. to reproduce:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
emulate zsh -o prompt_percent -c 'print -P "%F{#ff0000}red%F{green}%B bold green"'
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
add `p10k explain` that prints something like this:
|
|
||||||
|
|
||||||
```text
|
|
||||||
segment icons meaning
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
---
|
|
||||||
--
|
|
||||||
status ✔ ✘ exit code of the last command
|
|
||||||
```
|
|
||||||
|
|
||||||
implement it the hard way: for every enabled segment go over all its {state,icon} pairs, resolve
|
|
||||||
the icon (if not absolute), apply VISUAL_IDENTIFIER_EXPANSION, remove leading and trailing
|
|
||||||
whitespace and print without formatting (sort of like `print -P | cat`); print segment names in
|
|
||||||
green and icons in bold; battery can have an unlimited number of icons, so `...` would be needed
|
|
||||||
(based on total length of concatenated icons rather than the number of icons); user-defined
|
|
||||||
segments would have "unknown" icons by default (yellow and not bold); can allow them to
|
|
||||||
participate by defining `explainprompt_foo` that populates array `reply` with strings like this:
|
|
||||||
'-s STATE -i LOCK_ICON +r'; the first element must be segment description.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
add `docker_context` prompt segment; similar to `kubecontext`; the data should come from
|
|
||||||
`currentContext` field in `~/.docker/config.json` (according to
|
|
||||||
https://github.com/starship/starship/issues/995); there is also `DOCKER_CONTEXT`; more info:
|
|
||||||
https://docs.docker.com/engine/reference/commandline/context_use; also
|
|
||||||
https://github.com/starship/starship/pull/996.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
support `env`, `ionice` and `strace` precommands in `parser.zsh`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add ruler to configuration wizard. Options: `─`, `·`, `╌`, `┄`, `▁`, `═`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add frame styles to the wizard.
|
|
||||||
|
|
||||||
```text
|
|
||||||
╭─
|
|
||||||
╰─
|
|
||||||
|
|
||||||
┌─
|
|
||||||
└─
|
|
||||||
|
|
||||||
┏━
|
|
||||||
┗━
|
|
||||||
|
|
||||||
╔═
|
|
||||||
╚═
|
|
||||||
|
|
||||||
▛▀
|
|
||||||
▙▄
|
|
||||||
```
|
|
||||||
|
|
||||||
Prompt connection should have matching options.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add `POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_MIRROR_SEPARATOR`. If set, left segments get separated with
|
|
||||||
`POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR` followed by `POWERLEVEL9K_LEFT_SEGMENT_MIRROR_SEPARATOR`.
|
|
||||||
Each is drawn without background. The first with the foreground of left segment, the second with
|
|
||||||
the background of right segment. To insert space in between, embed it in
|
|
||||||
`POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_MIRROR_SEPARATOR`.
|
|
||||||
`POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR` is unused.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add *Segment Connection* screen to configuration wizard with options *Fused*, *Touching* and
|
|
||||||
*Disjoint*. The last two differ by the absence/presence of space between `SEGMENT_SEPARATOR` and
|
|
||||||
`SEGMENT_MIRROR_SEPARATOR`.
|
|
||||||
|
|
||||||
*Fused* requires line separator (there is already a screen for it) but the other two options require
|
|
||||||
two filled separators similar to heads and tail. Figure out how to present this choice.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Optimize auto-wizard check.
|
|
||||||
|
|
||||||
```text
|
|
||||||
time ( repeat 1000 [[ -z "${parameters[(I)POWERLEVEL9K_*~(POWERLEVEL9K_MODE|POWERLEVEL9K_CONFIG_FILE)]}" ]] )
|
|
||||||
user=0.21s system=0.05s cpu=99% total=0.264
|
|
||||||
|
|
||||||
time ( repeat 1000 [[ -z "${parameters[(I)POWERLEVEL9K_*]}" ]] )
|
|
||||||
user=0.17s system=0.00s cpu=99% total=0.175
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add the equivalent of `P9K_PYTHON_VERSION` to all `*env` segments where it makes sense.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Define `P9K_ICON` on initialization. Fill it with `$icon`. Duplicate every key that ends in `_ICON`.
|
|
||||||
Respect `POWERLEVEL9K_VCS_STASH_ICON` overrides but not anything with segment name or state.
|
|
||||||
|
|
||||||
Define `POWERLEVEL9K_VCS_*` parameters in config templates for all symbols used in
|
|
||||||
`my_git_formatter`. Add missing entries to `icons`. Use `$P9K_ICON[...]` within `my_git_formatter`.
|
|
||||||
Add a screen to the wizard to choose between clear and circled icons.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Add a screen to the wizard asking whether to set `POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'`.
|
|
||||||
Show it only if there is `$HOME/.git`. By default this parameter should be commented out.
|
|
||||||
9524
internal/p10k.zsh
9524
internal/p10k.zsh
File diff suppressed because it is too large
Load Diff
|
|
@ -1,382 +0,0 @@
|
||||||
typeset -grA __p9k_pb_cmd_skip=(
|
|
||||||
'}' 'always' # handled specially
|
|
||||||
'{' ''
|
|
||||||
'{' ''
|
|
||||||
'|' ''
|
|
||||||
'||' ''
|
|
||||||
'&' ''
|
|
||||||
'&&' ''
|
|
||||||
'|&' ''
|
|
||||||
'&!' ''
|
|
||||||
'&|' ''
|
|
||||||
')' ''
|
|
||||||
'(' ''
|
|
||||||
'()' ''
|
|
||||||
'!' ''
|
|
||||||
';' ''
|
|
||||||
'if' ''
|
|
||||||
'fi' ''
|
|
||||||
'elif' ''
|
|
||||||
'else' ''
|
|
||||||
'then' ''
|
|
||||||
'while' ''
|
|
||||||
'until' ''
|
|
||||||
'do' ''
|
|
||||||
'done' ''
|
|
||||||
'esac' ''
|
|
||||||
'end' ''
|
|
||||||
'coproc' ''
|
|
||||||
'nocorrect' ''
|
|
||||||
'noglob' ''
|
|
||||||
'time' ''
|
|
||||||
'[[' '\]\]'
|
|
||||||
'((' '\)\)'
|
|
||||||
'case' '\)|esac'
|
|
||||||
';;' '\)|esac'
|
|
||||||
';&' '\)|esac'
|
|
||||||
';|' '\)|esac'
|
|
||||||
'foreach' '\(*\)'
|
|
||||||
)
|
|
||||||
|
|
||||||
typeset -grA __p9k_pb_precommand=(
|
|
||||||
'-' ''
|
|
||||||
'builtin' ''
|
|
||||||
'command' ''
|
|
||||||
'exec' '-[^a]#[a]'
|
|
||||||
'nohup' ''
|
|
||||||
'setsid' ''
|
|
||||||
'eatmydata' ''
|
|
||||||
'catchsegv' ''
|
|
||||||
'pkexec' '--user'
|
|
||||||
'doas' '-[^aCu]#[acU]'
|
|
||||||
'nice' '-[^n]#[n]|--adjustment'
|
|
||||||
'stdbuf' '-[^ioe]#[ioe]|--(input|output|error)'
|
|
||||||
'sudo' '-[^aghpuUCcrtT]#[aghpuUCcrtT]|--(close-from|group|host|prompt|role|type|other-user|command-timeout|user)'
|
|
||||||
'ssh-agent' '-[^aEPt]#[aEPt]'
|
|
||||||
'tabbed' '-[^gnprtTuU]#[gnprtTuU]'
|
|
||||||
'chronic' ''
|
|
||||||
'ifne' ''
|
|
||||||
)
|
|
||||||
|
|
||||||
typeset -grA __p9k_pb_redirect=(
|
|
||||||
'&>' ''
|
|
||||||
'>' ''
|
|
||||||
'>&' ''
|
|
||||||
'<' ''
|
|
||||||
'<&' ''
|
|
||||||
'<>' ''
|
|
||||||
'&>|' ''
|
|
||||||
'>|' ''
|
|
||||||
'&>>' ''
|
|
||||||
'>>' ''
|
|
||||||
'>>&' ''
|
|
||||||
'&>>|' ''
|
|
||||||
'>>|' ''
|
|
||||||
'<<<' ''
|
|
||||||
)
|
|
||||||
|
|
||||||
typeset -grA __p9k_pb_term=(
|
|
||||||
'|' ''
|
|
||||||
'||' ''
|
|
||||||
';' ''
|
|
||||||
'&' ''
|
|
||||||
'&&' ''
|
|
||||||
'|&' ''
|
|
||||||
'&!' ''
|
|
||||||
'&|' ''
|
|
||||||
';;' ''
|
|
||||||
';&' ''
|
|
||||||
';|' ''
|
|
||||||
'(' ''
|
|
||||||
')' ''
|
|
||||||
'()' '' # handled specially
|
|
||||||
'}' '' # handled specially
|
|
||||||
)
|
|
||||||
|
|
||||||
typeset -grA __p9k_pb_term_skip=(
|
|
||||||
'(' '\)'
|
|
||||||
';;' '\)|esac'
|
|
||||||
';&' '\)|esac'
|
|
||||||
';|' '\)|esac'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Usage: _p9k_parse_buffer <buffer> [token-limit]
|
|
||||||
#
|
|
||||||
# Parses the specified command line buffer and populates array P9K_COMMANDS
|
|
||||||
# with commands from it. Terminates early and returns 1 if there are more
|
|
||||||
# tokens than the specified limit.
|
|
||||||
#
|
|
||||||
# Broken:
|
|
||||||
#
|
|
||||||
# ---------------
|
|
||||||
# : $(x)
|
|
||||||
# ---------------
|
|
||||||
# : `x`
|
|
||||||
# ---------------
|
|
||||||
# ${x/}
|
|
||||||
# ---------------
|
|
||||||
# - -- x
|
|
||||||
# ---------------
|
|
||||||
# command -p -p x
|
|
||||||
# ---------------
|
|
||||||
# *
|
|
||||||
# ---------------
|
|
||||||
# x=$y; $x
|
|
||||||
# ---------------
|
|
||||||
# alias x=y; y
|
|
||||||
# ---------------
|
|
||||||
# x <<END
|
|
||||||
# ; END
|
|
||||||
# END
|
|
||||||
# ---------------
|
|
||||||
# Setup:
|
|
||||||
# setopt interactive_comments
|
|
||||||
# alias x='#'
|
|
||||||
# Punchline:
|
|
||||||
# x; y
|
|
||||||
# ---------------
|
|
||||||
#
|
|
||||||
# More brokenness with non-standard options (ignore_braces, ignore_close_braces, etc.).
|
|
||||||
function _p9k_parse_buffer() {
|
|
||||||
[[ ${2:-0} == <-> ]] || return 2
|
|
||||||
|
|
||||||
local rcquotes
|
|
||||||
[[ -o rcquotes ]] && rcquotes=rcquotes
|
|
||||||
|
|
||||||
eval "$__p9k_intro"
|
|
||||||
setopt no_nomatch $rcquotes
|
|
||||||
|
|
||||||
typeset -ga P9K_COMMANDS=()
|
|
||||||
|
|
||||||
local -r id='(<->|[[:alpha:]_][[:IDENT:]]#)'
|
|
||||||
local -r var="\$$id|\${$id}|\"\$$id\"|\"\${$id}\""
|
|
||||||
|
|
||||||
local -i e ic c=${2:-'1 << 62'}
|
|
||||||
local skip n s r state token cmd prev
|
|
||||||
local -a aln alp alf v
|
|
||||||
|
|
||||||
if [[ -o interactive_comments ]]; then
|
|
||||||
ic=1
|
|
||||||
local tokens=(${(Z+C+)1})
|
|
||||||
else
|
|
||||||
local tokens=(${(z)1})
|
|
||||||
fi
|
|
||||||
|
|
||||||
{
|
|
||||||
while (( $#tokens )); do
|
|
||||||
(( e = $#state ))
|
|
||||||
|
|
||||||
while (( $#tokens == alp[-1] )); do
|
|
||||||
aln[-1]=()
|
|
||||||
alp[-1]=()
|
|
||||||
if (( $#tokens == alf[-1] )); then
|
|
||||||
alf[-1]=()
|
|
||||||
(( e = 0 ))
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
while (( c-- > 0 )) || return; do
|
|
||||||
token=$tokens[1]
|
|
||||||
tokens[1]=()
|
|
||||||
if (( $+galiases[$token] )); then
|
|
||||||
(( $aln[(eI)p$token] )) && break
|
|
||||||
s=$galiases[$token]
|
|
||||||
n=p$token
|
|
||||||
elif (( e )); then
|
|
||||||
break
|
|
||||||
elif (( $+aliases[$token] )); then
|
|
||||||
(( $aln[(eI)p$token] )) && break
|
|
||||||
s=$aliases[$token]
|
|
||||||
n=p$token
|
|
||||||
elif [[ $token == ?*.?* ]] && (( $+saliases[${token##*.}] )); then
|
|
||||||
r=${token##*.}
|
|
||||||
(( $aln[(eI)s$r] )) && break
|
|
||||||
s=${saliases[$r]%% #}
|
|
||||||
n=s$r
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
aln+=$n
|
|
||||||
alp+=$#tokens
|
|
||||||
[[ $s == *' ' ]] && alf+=$#tokens
|
|
||||||
(( ic )) && tokens[1,0]=(${(Z+C+)s}) || tokens[1,0]=(${(z)s})
|
|
||||||
done
|
|
||||||
|
|
||||||
case $token in
|
|
||||||
'<<'(|-))
|
|
||||||
state=h
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
*('`'|['<>=$']'(')*)
|
|
||||||
if [[ $token == ('`'[^'`']##'`'|'"`'[^'`']##'`"'|'$('[^')']##')'|'"$('[^')']##')"'|['<>=']'('[^')']##')') ]]; then
|
|
||||||
s=${${token##('"'|)(['$<>']|)?}%%?('"'|)}
|
|
||||||
(( ic )) && tokens+=(';' ${(Z+C+)s}) || tokens+=(';' ${(z)s})
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $state in
|
|
||||||
*r)
|
|
||||||
state[-1]=
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
a)
|
|
||||||
if [[ $token == $skip ]]; then
|
|
||||||
if [[ $token == '{' ]]; then
|
|
||||||
P9K_COMMANDS+=$cmd
|
|
||||||
cmd=
|
|
||||||
state=
|
|
||||||
else
|
|
||||||
skip='{'
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
state=t
|
|
||||||
fi
|
|
||||||
;& # fall through
|
|
||||||
t|p*)
|
|
||||||
if (( $+__p9k_pb_term[$token] )); then
|
|
||||||
if [[ $token == '()' ]]; then
|
|
||||||
state=
|
|
||||||
else
|
|
||||||
P9K_COMMANDS+=$cmd
|
|
||||||
if [[ $token == '}' ]]; then
|
|
||||||
state=a
|
|
||||||
skip=always
|
|
||||||
else
|
|
||||||
skip=$__p9k_pb_term_skip[$token]
|
|
||||||
state=${skip:+s}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
cmd=
|
|
||||||
continue
|
|
||||||
elif [[ $state == t ]]; then
|
|
||||||
continue
|
|
||||||
elif [[ $state == *x ]]; then
|
|
||||||
if (( $+__p9k_pb_redirect[$token] )); then
|
|
||||||
prev=
|
|
||||||
state[-1]=r
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
state[-1]=
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
s)
|
|
||||||
if [[ $token == $~skip ]]; then
|
|
||||||
state=
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
h)
|
|
||||||
while (( $#tokens )); do
|
|
||||||
(( e = ${tokens[(i)${(Q)token}]} ))
|
|
||||||
if [[ $tokens[e-1] == ';' && $tokens[e+1] == ';' ]]; then
|
|
||||||
tokens[1,e]=()
|
|
||||||
break
|
|
||||||
else
|
|
||||||
tokens[1,e]=()
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
while (( $#alp && alp[-1] >= $#tokens )); do
|
|
||||||
aln[-1]=()
|
|
||||||
alp[-1]=()
|
|
||||||
done
|
|
||||||
state=t
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if (( $+__p9k_pb_redirect[${token#<0-255>}] )); then
|
|
||||||
state+=r
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $token == *'$'* ]]; then
|
|
||||||
if [[ $token == $~var ]]; then
|
|
||||||
n=${${token##[^[:IDENT:]]}%%[^[:IDENT:]]}
|
|
||||||
[[ $token == *'"' ]] && v=("${(P)n}") || v=(${(P)n})
|
|
||||||
tokens[1,0]=(${(@qq)v})
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $state in
|
|
||||||
'')
|
|
||||||
if (( $+__p9k_pb_cmd_skip[$token] )); then
|
|
||||||
skip=$__p9k_pb_cmd_skip[$token]
|
|
||||||
[[ $token == '}' ]] && state=a || state=${skip:+s}
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [[ $token == *=* ]]; then
|
|
||||||
v=${(S)token/#(<->|([[:alpha:]_][[:IDENT:]]#(|'['*[^\\](\\\\)#']')))(|'+')=}
|
|
||||||
if (( $#v < $#token )); then
|
|
||||||
if [[ $v == '(' ]]; then
|
|
||||||
state=s
|
|
||||||
skip='\)'
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
: ${token::=${(Q)${~token}}}
|
|
||||||
;;
|
|
||||||
p2)
|
|
||||||
if [[ -n $prev ]]; then
|
|
||||||
prev=
|
|
||||||
else
|
|
||||||
: ${token::=${(Q)${~token}}}
|
|
||||||
if [[ $token == '{'$~id'}' ]]; then
|
|
||||||
state=p2x
|
|
||||||
prev=$token
|
|
||||||
else
|
|
||||||
state=p
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
;& # fall through
|
|
||||||
p)
|
|
||||||
if [[ -n $prev ]]; then
|
|
||||||
token=$prev
|
|
||||||
prev=
|
|
||||||
else
|
|
||||||
: ${token::=${(Q)${~token}}}
|
|
||||||
case $token in
|
|
||||||
'{'$~id'}') prev=$token; state=px; continue;;
|
|
||||||
[^-]*) ;;
|
|
||||||
--) state=p1; continue;;
|
|
||||||
$~skip) state=p2; continue;;
|
|
||||||
*) continue;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
p1)
|
|
||||||
if [[ -n $prev ]]; then
|
|
||||||
token=$prev
|
|
||||||
prev=
|
|
||||||
else
|
|
||||||
: ${token::=${(Q)${~token}}}
|
|
||||||
if [[ $token == '{'$~id'}' ]]; then
|
|
||||||
state=p1x
|
|
||||||
prev=$token
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if (( $+__p9k_pb_precommand[$token] )); then
|
|
||||||
prev=
|
|
||||||
state=p
|
|
||||||
skip=$__p9k_pb_precommand[$token]
|
|
||||||
cmd+=$token$'\0'
|
|
||||||
else
|
|
||||||
state=t
|
|
||||||
[[ $token == ('(('*'))'|'`'*'`'|'$'*|['<>=']'('*')'|*$'\0'*) ]] || cmd+=$token$'\0'
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
} always {
|
|
||||||
[[ $state == (px|p1x) ]] && cmd+=$prev
|
|
||||||
P9K_COMMANDS+=$cmd
|
|
||||||
P9K_COMMANDS=(${(u)P9K_COMMANDS%$'\0'})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2257
internal/wizard.zsh
2257
internal/wizard.zsh
File diff suppressed because it is too large
Load Diff
|
|
@ -1,219 +0,0 @@
|
||||||
# invoked in worker: _p9k_worker_main <pgid>
|
|
||||||
function _p9k_worker_main() {
|
|
||||||
mkfifo -- $_p9k__worker_file_prefix.fifo || return
|
|
||||||
echo -nE - s$_p9k_worker_pgid$'\x1e' || return
|
|
||||||
exec <$_p9k__worker_file_prefix.fifo || return
|
|
||||||
zf_rm -- $_p9k__worker_file_prefix.fifo || return
|
|
||||||
|
|
||||||
local -i reset
|
|
||||||
local req fd
|
|
||||||
local -a ready
|
|
||||||
local _p9k_worker_request_id
|
|
||||||
local -A _p9k_worker_fds # fd => id$'\x1f'callback
|
|
||||||
local -A _p9k_worker_inflight # id => inflight count
|
|
||||||
|
|
||||||
function _p9k_worker_reply() {
|
|
||||||
print -nr -- e${(pj:\n:)@}$'\x1e' || kill -- -$_p9k_worker_pgid
|
|
||||||
}
|
|
||||||
|
|
||||||
# usage: _p9k_worker_async <work> <callback>
|
|
||||||
function _p9k_worker_async() {
|
|
||||||
local fd async=$1
|
|
||||||
sysopen -r -o cloexec -u fd <(() { eval $async; } && print -n '\x1e') || return
|
|
||||||
(( ++_p9k_worker_inflight[$_p9k_worker_request_id] ))
|
|
||||||
_p9k_worker_fds[$fd]=$_p9k_worker_request_id$'\x1f'$2
|
|
||||||
}
|
|
||||||
|
|
||||||
trap '' PIPE
|
|
||||||
|
|
||||||
{
|
|
||||||
while zselect -a ready 0 ${(k)_p9k_worker_fds}; do
|
|
||||||
[[ $ready[1] == -r ]] || return
|
|
||||||
for fd in ${ready:1}; do
|
|
||||||
if [[ $fd == 0 ]]; then
|
|
||||||
local buf=
|
|
||||||
[[ -t 0 ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
|
||||||
if sysread -t 0 'buf[$#buf+1]'; then
|
|
||||||
while [[ $buf != *$'\x1e' ]]; do
|
|
||||||
sysread 'buf[$#buf+1]' || return
|
|
||||||
done
|
|
||||||
else
|
|
||||||
(( $? == 4 )) || return
|
|
||||||
fi
|
|
||||||
for req in ${(ps:\x1e:)buf}; do
|
|
||||||
_p9k_worker_request_id=${req%%$'\x1f'*}
|
|
||||||
() { eval $req[$#_p9k_worker_request_id+2,-1] }
|
|
||||||
(( $+_p9k_worker_inflight[$_p9k_worker_request_id] )) && continue
|
|
||||||
print -rn -- d$_p9k_worker_request_id$'\x1e' || return
|
|
||||||
done
|
|
||||||
else
|
|
||||||
local REPLY=
|
|
||||||
while true; do
|
|
||||||
if sysread -i $fd 'REPLY[$#REPLY+1]'; then
|
|
||||||
[[ $REPLY == *$'\x1e' ]] || continue
|
|
||||||
else
|
|
||||||
(( $? == 5 )) || return
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
local cb=$_p9k_worker_fds[$fd]
|
|
||||||
_p9k_worker_request_id=${cb%%$'\x1f'*}
|
|
||||||
unset "_p9k_worker_fds[$fd]"
|
|
||||||
exec {fd}>&-
|
|
||||||
if [[ $REPLY == *$'\x1e' ]]; then
|
|
||||||
REPLY[-1]=""
|
|
||||||
() { eval $cb[$#_p9k_worker_request_id+2,-1] }
|
|
||||||
fi
|
|
||||||
if (( --_p9k_worker_inflight[$_p9k_worker_request_id] == 0 )); then
|
|
||||||
unset "_p9k_worker_inflight[$_p9k_worker_request_id]"
|
|
||||||
print -rn -- d$_p9k_worker_request_id$'\x1e' || return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
} always {
|
|
||||||
kill -- -$_p9k_worker_pgid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# invoked in master: _p9k_worker_invoke <request-id> <list>
|
|
||||||
function _p9k_worker_invoke() {
|
|
||||||
[[ -n $_p9k__worker_resp_fd ]] || return
|
|
||||||
local req=$1$'\x1f'$2$'\x1e'
|
|
||||||
if [[ -n $_p9k__worker_req_fd && $+_p9k__worker_request_map[$1] == 0 ]]; then
|
|
||||||
_p9k__worker_request_map[$1]=
|
|
||||||
print -rnu $_p9k__worker_req_fd -- $req
|
|
||||||
else
|
|
||||||
_p9k__worker_request_map[$1]=$req
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function _p9k_worker_cleanup() {
|
|
||||||
# __p9k_intro bugs out here in some cases for some reason.
|
|
||||||
emulate -L zsh
|
|
||||||
[[ $_p9k__worker_shell_pid == $sysparams[pid] ]] && _p9k_worker_stop
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function _p9k_worker_stop() {
|
|
||||||
# See comments in _p9k_worker_cleanup.
|
|
||||||
emulate -L zsh
|
|
||||||
add-zsh-hook -D zshexit _p9k_worker_cleanup
|
|
||||||
[[ -n $_p9k__worker_resp_fd ]] && zle -F $_p9k__worker_resp_fd
|
|
||||||
[[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&-
|
|
||||||
[[ -n $_p9k__worker_req_fd ]] && exec {_p9k__worker_req_fd}>&-
|
|
||||||
[[ -n $_p9k__worker_pid ]] && kill -- -$_p9k__worker_pid 2>/dev/null
|
|
||||||
[[ -n $_p9k__worker_file_prefix ]] && zf_rm -f -- $_p9k__worker_file_prefix.fifo
|
|
||||||
_p9k__worker_pid=
|
|
||||||
_p9k__worker_req_fd=
|
|
||||||
_p9k__worker_resp_fd=
|
|
||||||
_p9k__worker_shell_pid=
|
|
||||||
_p9k__worker_request_map=()
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function _p9k_worker_receive() {
|
|
||||||
eval "$__p9k_intro"
|
|
||||||
|
|
||||||
[[ -z $_p9k__worker_resp_fd ]] && return
|
|
||||||
|
|
||||||
{
|
|
||||||
(( $# <= 1 )) || return
|
|
||||||
|
|
||||||
local buf resp
|
|
||||||
|
|
||||||
[[ -t $_p9k__worker_resp_fd ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
|
||||||
if sysread -i $_p9k__worker_resp_fd -t 0 'buf[$#buf+1]'; then
|
|
||||||
while [[ $buf == *[^$'\x05\x1e']$'\x05'# ]]; do
|
|
||||||
sysread -i $_p9k__worker_resp_fd 'buf[$#buf+1]' || return
|
|
||||||
done
|
|
||||||
else
|
|
||||||
(( $? == 4 )) || return
|
|
||||||
fi
|
|
||||||
|
|
||||||
local -i reset max_reset
|
|
||||||
for resp in ${(ps:\x1e:)${buf//$'\x05'}}; do
|
|
||||||
local arg=$resp[2,-1]
|
|
||||||
case $resp[1] in
|
|
||||||
d)
|
|
||||||
local req=$_p9k__worker_request_map[$arg]
|
|
||||||
if [[ -n $req ]]; then
|
|
||||||
_p9k__worker_request_map[$arg]=
|
|
||||||
print -rnu $_p9k__worker_req_fd -- $req || return
|
|
||||||
else
|
|
||||||
unset "_p9k__worker_request_map[$arg]"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
e)
|
|
||||||
() { eval $arg }
|
|
||||||
(( reset > max_reset )) && max_reset=reset
|
|
||||||
;;
|
|
||||||
s)
|
|
||||||
[[ -z $_p9k__worker_req_fd ]] || return
|
|
||||||
[[ $arg == <1-> ]] || return
|
|
||||||
_p9k__worker_pid=$arg
|
|
||||||
sysopen -w -o cloexec -u _p9k__worker_req_fd $_p9k__worker_file_prefix.fifo || return
|
|
||||||
local req=
|
|
||||||
for req in $_p9k__worker_request_map; do
|
|
||||||
print -rnu $_p9k__worker_req_fd -- $req || return
|
|
||||||
done
|
|
||||||
_p9k__worker_request_map=({${(k)^_p9k__worker_request_map},''})
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if (( max_reset == 2 )); then
|
|
||||||
_p9k__refresh_reason=worker
|
|
||||||
_p9k_set_prompt
|
|
||||||
_p9k__refresh_reason=''
|
|
||||||
fi
|
|
||||||
(( max_reset )) && _p9k_reset_prompt
|
|
||||||
return 0
|
|
||||||
} always {
|
|
||||||
(( $? )) && _p9k_worker_stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _p9k_worker_start() {
|
|
||||||
setopt monitor || return
|
|
||||||
{
|
|
||||||
[[ -n $_p9k__worker_resp_fd ]] && return
|
|
||||||
|
|
||||||
if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
|
|
||||||
local tmpdir=$TMPDIR
|
|
||||||
else
|
|
||||||
local tmpdir=/tmp
|
|
||||||
fi
|
|
||||||
_p9k__worker_file_prefix=$tmpdir/p10k.worker.$EUID.$sysparams[pid].$EPOCHSECONDS
|
|
||||||
|
|
||||||
sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
|
|
||||||
exec 0</dev/null
|
|
||||||
if [[ -n $_POWERLEVEL9K_WORKER_LOG_LEVEL ]]; then
|
|
||||||
exec 2>$_p9k__worker_file_prefix.log
|
|
||||||
setopt xtrace
|
|
||||||
else
|
|
||||||
exec 2>/dev/null
|
|
||||||
fi
|
|
||||||
builtin cd -q / || return
|
|
||||||
zmodload zsh/zselect || return
|
|
||||||
! { zselect -t0 || (( $? != 1 )) } || return
|
|
||||||
local _p9k_worker_pgid=$sysparams[pid]
|
|
||||||
_p9k_worker_main &
|
|
||||||
{
|
|
||||||
trap '' PIPE
|
|
||||||
while syswrite $'\x05'; do zselect -t 1000; done
|
|
||||||
zf_rm -f $_p9k__worker_file_prefix.fifo
|
|
||||||
kill -- -$_p9k_worker_pgid
|
|
||||||
} &
|
|
||||||
exec =true) || return
|
|
||||||
_p9k__worker_pid=$sysparams[procsubstpid]
|
|
||||||
zle -F $_p9k__worker_resp_fd _p9k_worker_receive
|
|
||||||
_p9k__worker_shell_pid=$sysparams[pid]
|
|
||||||
add-zsh-hook zshexit _p9k_worker_cleanup
|
|
||||||
} always {
|
|
||||||
(( $? )) && _p9k_worker_stop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -94,7 +94,9 @@
|
||||||
setopt no_unset extended_glob pipe_fail prompt_percent typeset_silent \
|
setopt no_unset extended_glob pipe_fail prompt_percent typeset_silent \
|
||||||
no_prompt_subst no_prompt_bang pushd_silent warn_create_global
|
no_prompt_subst no_prompt_bang pushd_silent warn_create_global
|
||||||
|
|
||||||
if [[ $ZSH_VERSION != (5.<1->*|<6->.*) || $ZSH_VERSION == 5.4(|.*) ]]; then
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
if ! is-at-least 5.1 || [[ $ZSH_VERSION == 5.4.* ]]; then
|
||||||
print -ru2 -- "[error] unsupported zsh version: $ZSH_VERSION"
|
print -ru2 -- "[error] unsupported zsh version: $ZSH_VERSION"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 61 KiB |
|
|
@ -1,83 +0,0 @@
|
||||||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
|
||||||
################################################################
|
|
||||||
# Powerlevel10k Theme
|
|
||||||
# https://github.com/romkatv/powerlevel10k
|
|
||||||
#
|
|
||||||
# Forked from Powerlevel9k Theme
|
|
||||||
# https://github.com/bhilburn/powerlevel9k
|
|
||||||
#
|
|
||||||
# Which in turn was forked from Agnoster Theme
|
|
||||||
# https://github.com/robbyrussell/oh-my-zsh/blob/74177c5320b2a1b2f8c4c695c05984b57fd7c6ea/themes/agnoster.zsh-theme
|
|
||||||
################################################################
|
|
||||||
|
|
||||||
# Temporarily change options.
|
|
||||||
'builtin' 'local' '-a' '__p9k_src_opts'
|
|
||||||
[[ ! -o 'aliases' ]] || __p9k_src_opts+=('aliases')
|
|
||||||
[[ ! -o 'sh_glob' ]] || __p9k_src_opts+=('sh_glob')
|
|
||||||
[[ ! -o 'no_brace_expand' ]] || __p9k_src_opts+=('no_brace_expand')
|
|
||||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
|
||||||
|
|
||||||
(( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}
|
|
||||||
(( $+__p9k_intro )) || {
|
|
||||||
# Leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!).
|
|
||||||
# __p9k_trapint is to work around bugs in zsh: https://www.zsh.org/mla/workers/2020/msg00612.html.
|
|
||||||
# Likewise for `trap ":"` instead of the plain `trap ""`.
|
|
||||||
typeset -gr __p9k_intro_base='emulate -L zsh -o no_hist_expand -o extended_glob -o no_prompt_bang -o prompt_percent -o no_prompt_subst -o no_aliases -o no_bg_nice -o typeset_silent -o no_rematch_pcre
|
|
||||||
(( $+__p9k_trapped )) || { local -i __p9k_trapped; trap : INT; trap "trap ${(q)__p9k_trapint:--} INT" EXIT }
|
|
||||||
local -a match mbegin mend
|
|
||||||
local -i MBEGIN MEND OPTIND
|
|
||||||
local MATCH OPTARG IFS=$'\'' \t\n\0'\'
|
|
||||||
typeset -gr __p9k_intro_locale='[[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale && { [[ -n $LC_ALL ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }'
|
|
||||||
typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }"
|
|
||||||
typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale"
|
|
||||||
typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale"
|
|
||||||
}
|
|
||||||
|
|
||||||
zmodload zsh/langinfo
|
|
||||||
|
|
||||||
function _p9k_init_locale() {
|
|
||||||
if (( ! $+__p9k_locale )); then
|
|
||||||
typeset -g __p9k_locale=
|
|
||||||
(( $+commands[locale] )) || return
|
|
||||||
local -a loc
|
|
||||||
loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) || return
|
|
||||||
(( $#loc )) || return
|
|
||||||
typeset -g __p9k_locale=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}}
|
|
||||||
fi
|
|
||||||
[[ -n $__p9k_locale ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
() {
|
|
||||||
eval "$__p9k_intro"
|
|
||||||
if (( $+__p9k_sourced )); then
|
|
||||||
(( $+functions[_p9k_setup] )) && _p9k_setup
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
|
|
||||||
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
|
|
||||||
_p9k_preinit
|
|
||||||
fi
|
|
||||||
typeset -gr __p9k_sourced=13
|
|
||||||
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
|
|
||||||
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
|
|
||||||
local f
|
|
||||||
for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh,gitstatus/install}; do
|
|
||||||
[[ $f.zwc -nt $f ]] && continue
|
|
||||||
zmodload -F zsh/files b:zf_mv b:zf_rm
|
|
||||||
local tmp=$f.tmp.$$.zwc
|
|
||||||
{
|
|
||||||
# `zf_mv -f src dst` fails on NTFS if `dst` is not writable, hence `zf_rm`.
|
|
||||||
zf_rm -f -- $f.zwc && zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc
|
|
||||||
} always {
|
|
||||||
(( $? )) && zf_rm -f -- $tmp
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
builtin source $__p9k_root_dir/internal/p10k.zsh || true
|
|
||||||
}
|
|
||||||
|
|
||||||
(( $+__p9k_instant_prompt_active )) && unsetopt prompt_cr prompt_sp || setopt prompt_cr prompt_sp
|
|
||||||
|
|
||||||
(( ${#__p9k_src_opts} )) && setopt ${__p9k_src_opts[@]}
|
|
||||||
'builtin' 'unset' '__p9k_src_opts'
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
#include "string_view.h"
|
#include "string_view.h"
|
||||||
|
|
||||||
namespace gitstatus {
|
namespace gitstatus {
|
||||||
|
|
@ -94,6 +95,7 @@ class Arena {
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* Allocate(size_t n) {
|
inline T* Allocate(size_t n) {
|
||||||
static_assert(!std::is_reference<T>(), "");
|
static_assert(!std::is_reference<T>(), "");
|
||||||
|
CHECK(n <= SIZE_MAX / sizeof(T)) << n;
|
||||||
return static_cast<T*>(Allocate(n * sizeof(T), alignof(T)));
|
return static_cast<T*>(Allocate(n * sizeof(T), alignof(T)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue