<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/log-tree.h, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-09-17T00:59:53Z</updated>
<entry>
<title>color: use git_colorbool enum type to store colorbools</title>
<updated>2025-09-17T00:59:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-09-16T23:13:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e9330ae4b820147c98e723399e9438c8bee60a80'/>
<id>urn:sha1:e9330ae4b820147c98e723399e9438c8bee60a80</id>
<content type='text'>
We traditionally used "int" to store and pass around the values defined
by "enum git_colorbool" (which were originally just #define macros).
Using an int doesn't produce incorrect results, but using the actual
enum makes the intent of the code more clear.

It would be nice if the compiler could catch cases where we used the
enum and an int interchangeably, since it's very easy to accidentally
check the boolean true/false of a colorbool like:

  if (branch_use_color)

This is wrong because GIT_COLOR_UNKNOWN and GIT_COLOR_AUTO evaluate to
true in C, even though we may ultimately decide not to use color. But C
is pretty happy to convert between ints and enums (even with various
-Wenum-* warnings). So this sadly doesn't protect us from such mistakes,
but it hopefully does make the code easier to read.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase-update-refs: extract load_branch_decorations</title>
<updated>2024-10-09T17:52:45Z</updated>
<author>
<name>Nicolas Guichard</name>
<email>nicolas@guichard.eu</email>
</author>
<published>2024-10-09T07:58:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68c9fcb027b4bd2e5d10618829937ee50503c281'/>
<id>urn:sha1:68c9fcb027b4bd2e5d10618829937ee50503c281</id>
<content type='text'>
Extract load_branch_decorations from todo_list_add_update_ref_commands so
it can be re-used in make_script_with_merges.

Since it can now be called multiple times, use non-static lists and place
it next to load_ref_decorations to re-use the decoration_loaded guard.

Signed-off-by: Nicolas Guichard &lt;nicolas@guichard.eu&gt;
Acked-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>format-patch: return an allocated string from log_write_email_headers()</title>
<updated>2024-03-20T00:54:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-03-20T00:35:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=305a68143cc0e9b714d71417efa9f0162dd07221'/>
<id>urn:sha1:305a68143cc0e9b714d71417efa9f0162dd07221</id>
<content type='text'>
When pretty-printing a commit in the email format, we have to fill in
the "after subject" field of the pretty_print_context with any extra
headers the user provided (e.g., from "--to" or "--cc" options) plus any
special MIME headers.

We return an out-pointer that sometimes points to a newly heap-allocated
string and sometimes not. To avoid leaking, we store the allocated
version in a buffer with static lifetime, which is ugly. Worse, as we
extend the header feature, we'll end up having to repeat this ugly
pattern.

Instead, let's have our out-pointer pass ownership back to the caller,
and duplicate the string when necessary. This does mean one extra
allocation per commit when you use extra headers, but in the context of
format-patch which is showing diffs, I don't think that's even
measurable.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pretty: add pointer and tag options to %(decorate)</title>
<updated>2023-08-21T18:40:10Z</updated>
<author>
<name>Andy Koppe</name>
<email>andy.koppe@gmail.com</email>
</author>
<published>2023-08-20T18:50:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f1f8a258567268974b9bbd012c33ad219a31aa0e'/>
<id>urn:sha1:f1f8a258567268974b9bbd012c33ad219a31aa0e</id>
<content type='text'>
Add pointer and tag options to %(decorate) format, to allow to override
the " -&gt; " string used to show where HEAD points and the "tag: " string
used to mark tags.

Document in pretty-formats.txt and test in t4205-log-pretty-formats.sh.

Signed-off-by: Andy Koppe &lt;andy.koppe@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>decorate: refactor format_decorations()</title>
<updated>2023-08-21T18:40:09Z</updated>
<author>
<name>Andy Koppe</name>
<email>andy.koppe@gmail.com</email>
</author>
<published>2023-08-20T18:50:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a3883a6532163f0a53a7b202f32bf8fe565af056'/>
<id>urn:sha1:a3883a6532163f0a53a7b202f32bf8fe565af056</id>
<content type='text'>
Rename the format_decorations_extended function to format_decorations
and drop the format_decorations wrapper macro. Pass the prefix, suffix
and separator strings as a single 'struct format_decorations' pointer
argument instead of separate arguments. Use default values defined in
the function when either the struct pointer or any of the struct fields
are NULL. This is to ease extension with additional options.

Signed-off-by: Andy Koppe &lt;andy.koppe@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>log-tree: replace include of revision.h with simple forward declaration</title>
<updated>2023-06-21T20:39:53Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-05-16T06:33:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0fd2e21571ac3a26e898fa6ce130894fd408080e'/>
<id>urn:sha1:0fd2e21571ac3a26e898fa6ce130894fd408080e</id>
<content type='text'>
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>log-tree.h: remove unused function declarations</title>
<updated>2021-10-01T21:39:46Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-10-01T10:37:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=067e73c8aee9aeb05eac939205274cd2ad8b7cae'/>
<id>urn:sha1:067e73c8aee9aeb05eac939205274cd2ad8b7cae</id>
<content type='text'>
The init_log_tree_opt() and log_tree_opt_parse() functions were
removed in cd2bdc53094 (Common option parsing for "git log --diff" and
friends, 2006-04-14), but not their corresponding *.h declaration.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>format-patch: make output filename configurable</title>
<updated>2020-11-10T01:44:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-11-06T21:56:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3baf58bfb4bcfe201970abeffa8e1396d2324250'/>
<id>urn:sha1:3baf58bfb4bcfe201970abeffa8e1396d2324250</id>
<content type='text'>
For the past 15 years, we've used the hardcoded 64 as the length
limit of the filename of the output from the "git format-patch"
command.  Since the value is shorter than the 80-column terminal, it
could grow without line wrapping a bit.  At the same time, since the
value is longer than half of the 80-column terminal, we could fit
two or more of them in "ls" output on such a terminal if we allowed
to lower it.

Introduce a new command line option --filename-max-length=&lt;n&gt; and a
new configuration variable format.filenameMaxLength to override the
hardcoded default.

While we are at it, remove a check that the name of output directory
does not exceed PATH_MAX---this check is pointless in that by the
time control reaches the function, the caller would already have
done an equivalent of "mkdir -p", so if the system does not like an
overly long directory name, the control wouldn't have reached here,
and otherwise, we know that the system allowed the output directory
to exist.  In the worst case, we will get an error when we try to
open the output file and handle the error correctly anyway.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>log: add log.excludeDecoration config option</title>
<updated>2020-04-16T18:05:48Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2020-04-16T14:15:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6be5e6764aabd4b418f7f365254518ec44c38d8'/>
<id>urn:sha1:a6be5e6764aabd4b418f7f365254518ec44c38d8</id>
<content type='text'>
In 'git log', the --decorate-refs-exclude option appends a pattern
to a string_list. This list is used to prevent showing some refs
in the decoration output, or even by --simplify-by-decoration.

Users may want to use their refs space to store utility refs that
should not appear in the decoration output. For example, Scalar [1]
runs a background fetch but places the "new" refs inside the
refs/scalar/hidden/&lt;remote&gt;/* refspace instead of refs/&lt;remote&gt;/*
to avoid updating remote refs when the user is not looking. However,
these "hidden" refs appear during regular 'git log' queries.

A similar idea to use "hidden" refs is under consideration for core
Git [2].

Add the 'log.excludeDecoration' config option so users can exclude
some refs from decorations by default instead of needing to use
--decorate-refs-exclude manually. The config value is multi-valued
much like the command-line option. The documentation is careful to
point out that the config value can be overridden by the
--decorate-refs option, even though --decorate-refs-exclude would
always "win" over --decorate-refs.

Since the 'log.excludeDecoration' takes lower precedence to
--decorate-refs, and --decorate-refs-exclude takes higher
precedence, the struct decoration_filter needed another field.
This led also to new logic in load_ref_decorations() and
ref_filter_match().

There are several tests in t4202-log.sh that test the
--decorate-refs-(include|exclude) options, so these are extended.
Since the expected output is already stored as a file, most tests
could simply replace a "--decorate-refs-exclude" option with an
in-line config setting. Other tests involve the precedence of
the config option compared to command-line options and needed more
modification.

[1] https://github.com/microsoft/scalar
[2] https://lore.kernel.org/git/77b1da5d3063a2404cd750adfe3bb8be9b6c497d.1585946894.git.gitgitgadget@gmail.com/

Helped-by: Junio C Hamano &lt;gister@pobox.com&gt;
Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>format-patch: make cover letters always text/plain</title>
<updated>2018-05-02T03:55:00Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2018-05-02T02:20:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=50cd54ef4e6f4279683b61417a35de7297b55b9d'/>
<id>urn:sha1:50cd54ef4e6f4279683b61417a35de7297b55b9d</id>
<content type='text'>
When formatting a series of patches using --attach and --cover-letter,
the cover letter lacks the closing MIME boundary, violating RFC 2046.
Certain clients, such as Thunderbird, discard the message body in such a
case.

Since the cover letter is just one part and sending it as
multipart/mixed is not very useful, always emit it as text/plain,
avoiding the boundary problem altogether.

Reported-by: Patrick Hemmer &lt;git@stormcloud9.net&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
