Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bc6a6cf
strbuf: pass correct alloc to strbuf_attach() in strbuf_reencode()
vaidas-shopify Mar 17, 2026
a4fddb0
strbuf_attach: fix call sites to pass correct alloc
vaidas-shopify Mar 17, 2026
640657f
http: add support for HTTP 429 rate limit retries
vaidas-shopify Mar 17, 2026
1d6fd6d
t5315: use test_path_is_file for loose-object check
bilalobe Mar 19, 2026
dd0b14a
Merge branch 'jk/diff-highlight-identical-pairs' into jk/diff-highlig…
gitster Mar 20, 2026
41529f9
diff-highlight: mention build instructions
peff Mar 23, 2026
550097a
diff-highlight: drop perl version dependency back to 5.8
scottchiefbaker Mar 23, 2026
05002f6
diff-highlight: check diff-highlight exit status in tests
peff Mar 23, 2026
0c49b95
t: add matching negative attributes to test_decode_color
peff Mar 23, 2026
e57daf9
diff-highlight: use test_decode_color in tests
peff Mar 23, 2026
c6bc53a
diff-highlight: test color config
peff Mar 23, 2026
bd958e9
diff-highlight: allow module callers to pass in color config
scottchiefbaker Mar 23, 2026
6689a6e
diff-highlight: fetch all config with one process
peff Mar 23, 2026
649c768
remote-curl: fall back to default hash outside repo
jayatheerthkulkarni Mar 24, 2026
4e5dc60
refspec: fix typo in comment
jayatheerthkulkarni Mar 24, 2026
2d733b9
Merge branch 'ps/build-tweaks' into rs/use-strvec-pushv
gitster Mar 24, 2026
250e977
use strvec_pushv() to add another strvec
gitster Mar 24, 2026
3ad4921
t0061: simplify .bat test
peff Mar 25, 2026
4be77c7
repo: factor repo usage strings into shared macros
MahiKassa Mar 25, 2026
abd728c
repo: show subcommand-specific help text
MahiKassa Mar 25, 2026
bd66ed3
regexp: leave a pointer to resurrect workaround for Homebrew
gitster Mar 23, 2026
0a39ec2
Merge branch 'vp/http-rate-limit-retries'
gitster Apr 1, 2026
8744cef
Merge branch 'jk/diff-highlight-more'
gitster Apr 1, 2026
11f494d
Merge branch 'bk/t5315-test-path-is-helpers'
gitster Apr 1, 2026
51a7490
Merge branch 'rs/use-strvec-pushv'
gitster Apr 1, 2026
0f85c4c
Merge branch 'jc/macos-homebrew-wo-reg-enhanced'
gitster Apr 1, 2026
9d49880
Merge branch 'mk/repo-help-strings'
gitster Apr 1, 2026
93841d0
Merge branch 'jk/t0061-bat-test-update'
gitster Apr 1, 2026
949f59e
Merge branch 'kj/refspec-parsing-outside-repository'
gitster Apr 1, 2026
cf2139f
The 24th batch
gitster Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Documentation/RelNotes/2.54.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ UI, Workflows & Features
line number when it encounters a corrupt patch, and correctly
resets the line counter when processing multiple patch files.

* The HTTP transport learned to react to "429 Too Many Requests".

* "git repo info -h" and "git repo structure -h" limit their help output
to the part that is specific to the subcommand.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -253,6 +258,15 @@ Performance, Internal Implementation, Development Support etc.
of branches interpret_branch_name() function has been changed to
use a dedicated enum type.

* Various updates to contrib/diff-highlight, including documentation
updates, test improvements, and color configuration handling.

* Code paths that loop over another array to push each element into a
strvec have been rewritten to use strvec_pushv() instead.

* In case homebrew breaks REG_ENHANCED again, leave a in-code comment
to suggest use of our replacement regex as a workaround.


Fixes since v2.53
-----------------
Expand Down Expand Up @@ -420,6 +434,17 @@ Fixes since v2.53
* "git apply -p<n>" parses <n> more carefully now.
(merge d05d84c5f5 mf/apply-p-no-atoi later to maint).

* A test to run a .bat file with whitespaces in the name with arguments
with whitespaces in them was flaky in that sometimes it got killed
before it produced expected side effects, which has been rewritten to
make it more robust.
(merge 3ad4921838 jk/t0061-bat-test-update later to maint).

* "git ls-remote '+refs/tags/*:refs/tags/*' https://..." run outside a
repository would dereference a NULL while trying to see if the given
refspec is a single-object refspec, which has been corrected.
(merge 4e5dc601dd kj/refspec-parsing-outside-repository later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge d79fff4a11 jk/remote-tracking-ref-leakfix later to maint).
(merge 7a747f972d dd/t5403-modernise later to maint).
Expand Down
26 changes: 26 additions & 0 deletions Documentation/config/http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,32 @@ http.keepAliveCount::
unset, curl's default value is used. Can be overridden by the
`GIT_HTTP_KEEPALIVE_COUNT` environment variable.

http.retryAfter::
Default wait time in seconds before retrying when a server returns
HTTP 429 (Too Many Requests) without a Retry-After header.
Defaults to 0 (retry immediately). When a Retry-After header is
present, its value takes precedence over this setting; however,
automatic use of the server-provided `Retry-After` header requires
libcurl 7.66.0 or later. On older versions, configure this setting
manually to control the retry delay. Can be overridden by the
`GIT_HTTP_RETRY_AFTER` environment variable.
See also `http.maxRetries` and `http.maxRetryTime`.

http.maxRetries::
Maximum number of times to retry after receiving HTTP 429 (Too Many
Requests) responses. Set to 0 (the default) to disable retries.
Can be overridden by the `GIT_HTTP_MAX_RETRIES` environment variable.
See also `http.retryAfter` and `http.maxRetryTime`.

http.maxRetryTime::
Maximum time in seconds to wait for a single retry attempt when
handling HTTP 429 (Too Many Requests) responses. If the server
requests a delay (via Retry-After header) or if `http.retryAfter`
is configured with a value that exceeds this maximum, Git will fail
immediately rather than waiting. Default is 300 seconds (5 minutes).
Can be overridden by the `GIT_HTTP_MAX_RETRY_TIME` environment
variable. See also `http.retryAfter` and `http.maxRetries`.

http.noEPSV::
A boolean which disables using of EPSV ftp command by curl.
This can be helpful with some "poor" ftp servers which don't
Expand Down
2 changes: 1 addition & 1 deletion builtin/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static void am_append_signoff(struct am_state *state)
{
struct strbuf sb = STRBUF_INIT;

strbuf_attach(&sb, state->msg, state->msg_len, state->msg_len);
strbuf_attach(&sb, state->msg, state->msg_len, state->msg_len + 1);
append_signoff(&sb, 0, 0);
state->msg = strbuf_detach(&sb, &state->msg_len);
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -3307,7 +3307,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
cat_blob_write("\n", 1);
if (oe && oe->pack_id == pack_id) {
last_blob.offset = oe->idx.offset;
strbuf_attach(&last_blob.data, buf, size, size);
strbuf_attach(&last_blob.data, buf, size, size + 1);
last_blob.depth = oe->depth;
} else
free(buf);
Expand Down
3 changes: 1 addition & 2 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)

replay.signoff = opts->signoff;

for (size_t i = 0; i < opts->trailer_args.nr; i++)
strvec_push(&replay.trailer_args, opts->trailer_args.v[i]);
strvec_pushv(&replay.trailer_args, opts->trailer_args.v);

replay.allow_ff = !(opts->flags & REBASE_FORCE);
if (opts->allow_rerere_autoupdate)
Expand Down
28 changes: 22 additions & 6 deletions builtin/repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,27 @@
#include "tree-walk.h"
#include "utf8.h"

#define REPO_INFO_USAGE \
"git repo info [--format=(lines|nul) | -z] [--all | <key>...]", \
"git repo info --keys [--format=(lines|nul) | -z]"

#define REPO_STRUCTURE_USAGE \
"git repo structure [--format=(table|lines|nul) | -z]"

static const char *const repo_usage[] = {
"git repo info [--format=(lines|nul) | -z] [--all | <key>...]",
"git repo info --keys [--format=(lines|nul) | -z]",
"git repo structure [--format=(table|lines|nul) | -z]",
NULL
REPO_INFO_USAGE,
REPO_STRUCTURE_USAGE,
NULL,
};

static const char *const repo_info_usage[] = {
REPO_INFO_USAGE,
NULL,
};

static const char *const repo_structure_usage[] = {
REPO_STRUCTURE_USAGE,
NULL,
};

typedef int get_value_fn(struct repository *repo, struct strbuf *buf);
Expand Down Expand Up @@ -214,7 +230,7 @@ static int cmd_repo_info(int argc, const char **argv, const char *prefix,
OPT_END()
};

argc = parse_options(argc, argv, prefix, options, repo_usage, 0);
argc = parse_options(argc, argv, prefix, options, repo_info_usage, 0);

if (show_keys && (all_keys || argc))
die(_("--keys cannot be used with a <key> or --all"));
Expand Down Expand Up @@ -879,7 +895,7 @@ static int cmd_repo_structure(int argc, const char **argv, const char *prefix,
OPT_END()
};

argc = parse_options(argc, argv, prefix, options, repo_usage, 0);
argc = parse_options(argc, argv, prefix, options, repo_structure_usage, 0);
if (argc)
usage(_("too many arguments"));

Expand Down
5 changes: 5 additions & 0 deletions compat/regcomp_enhanced.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

int git_regcomp(regex_t *preg, const char *pattern, int cflags)
{
/*
* If you are on macOS with clang and fail to compile this line,
* https://lore.kernel.org/git/458ad3c1-96df-4575-ee42-e6eb754f25f6@gmx.de/
* might be relevant.
*/
if (!(cflags & REG_EXTENDED))
cflags |= REG_ENHANCED;
return regcomp(preg, pattern, cflags);
Expand Down
59 changes: 44 additions & 15 deletions contrib/diff-highlight/DiffHighlight.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DiffHighlight;

require v5.26;
require v5.008;
use warnings FATAL => 'all';
use strict;

Expand All @@ -9,18 +9,11 @@ use File::Spec;

my $NULL = File::Spec->devnull();

# Highlight by reversing foreground and background. You could do
# other things like bold or underline if you prefer.
my @OLD_HIGHLIGHT = (
color_config('color.diff-highlight.oldnormal'),
color_config('color.diff-highlight.oldhighlight', "\x1b[7m"),
color_config('color.diff-highlight.oldreset', "\x1b[27m")
);
my @NEW_HIGHLIGHT = (
color_config('color.diff-highlight.newnormal', $OLD_HIGHLIGHT[0]),
color_config('color.diff-highlight.newhighlight', $OLD_HIGHLIGHT[1]),
color_config('color.diff-highlight.newreset', $OLD_HIGHLIGHT[2])
);
# The color theme is initially set to nothing here to allow outside callers
# to set the colors for their application. If nothing is sent in we use
# colors from git config in load_color_config().
our @OLD_HIGHLIGHT = ();
our @NEW_HIGHLIGHT = ();

my $RESET = "\x1b[m";
my $COLOR = qr/\x1b\[[0-9;]*m/;
Expand Down Expand Up @@ -138,9 +131,21 @@ sub highlight_stdin {
# of it being used in other settings. Let's handle our own
# fallback, which means we will work even if git can't be run.
sub color_config {
our $cached_config;
my ($key, $default) = @_;
my $s = `git config --get-color $key 2>$NULL`;
return length($s) ? $s : $default;

if (!defined $cached_config) {
$cached_config = {};
my $data = `git config --type=color --get-regexp '^color\.diff-highlight\.' 2>$NULL`;
for my $line (split /\n/, $data) {
my ($key, $color) = split ' ', $line, 2;
$key =~ s/^color\.diff-highlight\.// or next;
$cached_config->{$key} = $color;
}
}

my $s = $cached_config->{$key};
return defined($s) ? $s : $default;
}

sub show_hunk {
Expand Down Expand Up @@ -170,6 +175,29 @@ sub show_hunk {
$line_cb->(@queue);
}

sub load_color_config {
# If the colors were NOT set from outside this module we load them on-demand
# from the git config. Note that only one of elements 0 and 2 in each
# array is used (depending on whether you are doing set/unset on an
# attribute, or specifying normal vs highlighted coloring). So we use
# element 1 as our check for whether colors were passed in; it should
# always be set if you want highlighting to do anything.
if (!defined $OLD_HIGHLIGHT[1]) {
@OLD_HIGHLIGHT = (
color_config('oldnormal'),
color_config('oldhighlight', "\x1b[7m"),
color_config('oldreset', "\x1b[27m")
);
}
if (!defined $NEW_HIGHLIGHT[1]) {
@NEW_HIGHLIGHT = (
color_config('newnormal', $OLD_HIGHLIGHT[0]),
color_config('newhighlight', $OLD_HIGHLIGHT[1]),
color_config('newreset', $OLD_HIGHLIGHT[2])
);
};
}

sub highlight_pair {
my @a = split_line(shift);
my @b = split_line(shift);
Expand Down Expand Up @@ -218,6 +246,7 @@ sub highlight_pair {
}

if (is_pair_interesting(\@a, $pa, $sa, \@b, $pb, $sb)) {
load_color_config();
return highlight_line(\@a, $pa, $sa, \@OLD_HIGHLIGHT),
highlight_line(\@b, $pb, $sb, \@NEW_HIGHLIGHT);
}
Expand Down
19 changes: 18 additions & 1 deletion contrib/diff-highlight/README
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,21 @@ visually distracting. Non-diff lines and existing diff coloration is
preserved; the intent is that the output should look exactly the same as
the input, except for the occasional highlight.

Build/Install
-------------

You can build the `diff-highlight` script by running `make` from within
the diff-highlight directory. There is no `make install` target; you can
copy the built script to your $PATH.

You can run diff-highlight's internal tests by running `make test`. Note
that you must also build Git itself first (by running `make` from the
top-level of the project).

Use
---

You can try out the diff-highlight program with:
You can try out the built diff-highlight program with:

---------------------------------------------
git log -p --color | /path/to/diff-highlight
Expand Down Expand Up @@ -127,6 +138,12 @@ Your script may set up one or more of the following variables:
processing a logical chunk of input). The default function flushes
stdout.

- @DiffHighlight::OLD_HIGHLIGHT and @DiffHighlight::NEW_HIGHLIGHT - these
arrays specify the normal, highlighted, and reset colors (in that order)
for old/new lines. If unset, values will be retrieved by calling `git
config` (see "Color Config" above). Note that these should be the literal
color bytes (starting with an ANSI escape code), not color names.

The script may then feed lines, one at a time, to DiffHighlight::handle_line().
When lines are done processing, they will be fed to $line_cb. Note that
DiffHighlight may queue up many input lines (to analyze a whole hunk)
Expand Down
Loading