Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
86c9c14
Merge branch 'bc/use-sha256-by-default-in-3.0' into ps/config-wo-the-…
gitster Jul 17, 2025
26ef887
t7510: add test cases for non-absolute gpg program
424ever Jul 22, 2025
9ce196e
config: drop `git_config()` wrapper
pks-t Jul 23, 2025
83bd9e0
config: drop `git_config_clear()` wrapper
pks-t Jul 23, 2025
7807051
config: drop `git_config_get()` wrapper
pks-t Jul 23, 2025
2f12425
config: drop `git_config_get_value()` wrapper
pks-t Jul 23, 2025
8e7110d
config: drop `git_config_get_value()` wrapper
pks-t Jul 23, 2025
4f5ba82
config: drop `git_config_get_string_multi()` wrapper
pks-t Jul 23, 2025
627d08c
config: drop `git_config_get_string()` wrapper
pks-t Jul 23, 2025
cba3c02
config: drop `git_config_get_string()` wrapper
pks-t Jul 23, 2025
3fda14d
config: drop `git_config_get_int()` wrapper
pks-t Jul 23, 2025
d57f078
config: drop `git_config_get_ulong()` wrapper
pks-t Jul 23, 2025
5d215a7
config: drop `git_config_get_bool()` wrapper
pks-t Jul 23, 2025
122e38c
config: drop `git_config_set_in_file()` wrapper
pks-t Jul 23, 2025
b1659e6
config: drop `git_config_set_gently()` wrapper
pks-t Jul 23, 2025
e957ed2
config: drop `git_config_set()` wrapper
pks-t Jul 23, 2025
62c1ed3
config: drop `git_config_set_in_file_gently()` wrapper
pks-t Jul 23, 2025
adf9e5f
config: drop `git_config_set_multivar_in_file_gently()` wrapper
pks-t Jul 23, 2025
1bb3e41
config: drop `git_config_get_multivar_gently()` wrapper
pks-t Jul 23, 2025
a538250
config: drop `git_config_set_multivar()` wrapper
pks-t Jul 23, 2025
00271bb
config: remove unused `the_repository` wrappers
pks-t Jul 23, 2025
08b7758
config: move Git config parsing into "environment.c"
pks-t Jul 23, 2025
b06408b
config: fix sign comparison warnings
pks-t Jul 23, 2025
5345ca1
t9350: redirect input to only fast-import
chriscool Jul 25, 2025
6585575
ref-cache: use 'size_t' instead of int for length
KarthikNayak Jul 28, 2025
a7c8a4c
for-each-ref: fix documentation argument ordering
KarthikNayak Jul 28, 2025
fa0f4e4
for-each-ref: reword the documentation for '--start-after'
KarthikNayak Jul 28, 2025
ed9cc21
t6302: add test combining '--start-after' with '--exclude'
KarthikNayak Jul 28, 2025
444ad14
ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1'
KarthikNayak Jul 28, 2025
f609dc4
builtin: unmark git-switch and git-restore as experimental
jltobler Jul 28, 2025
7e29431
blame: remove parameter detailed in get_commit_info()
hanyang-tony Jul 28, 2025
c26ecaf
t7510: use $PWD instead of $(pwd) inside PATH
peff Jul 25, 2025
5247da0
meson: ensure correct "clar-decls.h" header is used
pks-t Jul 29, 2025
671b283
t: use test_grep in t3701 and t4055
NinjaInShade Jul 29, 2025
97b99a9
t: use test_config in t4055
NinjaInShade Jul 29, 2025
2b0a2db
add-patch: respect diff.context configuration
NinjaInShade Jul 29, 2025
2b3ae04
add-patch: add diff.context command line overrides
NinjaInShade Jul 29, 2025
9b07811
test-hashmap: document why it is no longer used but still there
gitster Jul 30, 2025
f3ef347
t7450: inspect the correct path a broken code would write to
Jul 31, 2025
711a208
interactive: do strip trailing CRLF from input
j6t Jul 31, 2025
4ac3302
CodingGuidelines: clarify that S_release() does not reinitialize
gitster Aug 1, 2025
cca758d
doc: fast-import: contextualize the hardware cost
LemmingAvalanche Aug 1, 2025
3bdd897
meson: tolerate errors from git ls-files --deduplicate
mstorsjo Aug 1, 2025
5f277fc
mingw_open_existing: handle directories better
rimrul Aug 3, 2025
ce6ccba
mingw: drop Windows 7-specific work-around
dscho Aug 3, 2025
51f9b62
mingw_rename: support ReFS on Windows 2022
dscho Aug 3, 2025
f559d42
mingw: support Windows Server 2016 again
dscho Aug 3, 2025
41ca6a9
Merge branch 'hy/blame-simplify-get-commit-info'
gitster Aug 4, 2025
8e75941
Merge branch 'cc/t9350-cleanup'
gitster Aug 4, 2025
fab5968
Merge branch 'jb/t7510-gpg-program-path'
gitster Aug 4, 2025
0dc39a6
Merge branch 'jt/switch-restore-no-longer-experimental'
gitster Aug 4, 2025
10be1c4
Merge branch 'kn/for-each-ref-skip-updates'
gitster Aug 4, 2025
540aaa6
Merge branch 'ps/config-wo-the-repository'
gitster Aug 4, 2025
d63f334
Merge branch 'lm/add-p-context'
gitster Aug 4, 2025
817d661
Merge branch 'js/mingw-fixes'
gitster Aug 4, 2025
c4c628f
Merge branch 'ps/meson-clar-decls-fix'
gitster Aug 4, 2025
ea58ada
Merge branch 'js/prompt-crlf-fix'
gitster Aug 4, 2025
d8f795e
Merge branch 'ch/t7450-recursive-clone-test-fix'
gitster Aug 4, 2025
67424f5
Merge branch 'jc/doc-release-vs-clear'
gitster Aug 4, 2025
dc87d07
Merge branch 'ms/meson-with-ancient-git-wo-ls-files-dedup'
gitster Aug 4, 2025
67fd255
Merge branch 'kh/doc-fast-import-historical'
gitster Aug 4, 2025
f674965
Merge branch 'jc/test-hashmap-is-still-here'
gitster Aug 4, 2025
721c9e5
Git 2.51-rc0
gitster Aug 4, 2025
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
5 changes: 3 additions & 2 deletions Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ For C programs:
- `S_init()` initializes a structure without allocating the
structure itself.

- `S_release()` releases a structure's contents without freeing the
structure.
- `S_release()` releases a structure's contents without reinitializing
the structure for immediate reuse, and without freeing the structure
itself.

- `S_clear()` is equivalent to `S_release()` followed by `S_init()`
such that the structure is directly usable after clearing it. When
Expand Down
21 changes: 21 additions & 0 deletions Documentation/RelNotes/2.51.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ UI, Workflows & Features
* "git for-each-ref" learns "--start-after" option to help
applications that want to page its output.

* "git switch" and "git restore" are declared to be no longer
experimental.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -269,6 +272,18 @@ including security updates, are included in this release.
few test helper programs are now closed.
(merge 0f1b33815b hl/test-helper-fd-close later to maint).

* Interactive prompt code did not correctly strip CRLF from the end
of line on Windows.
(merge 711a20827b js/prompt-crlf-fix later to maint).

* The config API had a set of convenience wrapper functions that
implicitly use the_repository instance; they have been removed and
inlined at the calling sites.

* "git add/etc -p" now honor the diff.context configuration variable,
and also they learn to honor the -U<n> command-line option.
(merge 2b3ae04011 lm/add-p-context later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge b257adb571 lo/my-first-ow-doc-update later to maint).
(merge 8b34b6a220 ly/sequencer-update-squash-is-fixup-only later to maint).
Expand Down Expand Up @@ -299,3 +314,9 @@ including security updates, are included in this release.
(merge 26552cb62a jk/unleak-reflog-expire-entry later to maint).
(merge 339d95fda9 jc/ci-print-test-failures-fix later to maint).
(merge 8c3add51a8 cb/meson-avoid-broken-macos-pcre2 later to maint).
(merge 5247da07b8 ps/meson-clar-decls-fix later to maint).
(merge f3ef347bb2 ch/t7450-recursive-clone-test-fix later to maint).
(merge 4ac3302a1a jc/doc-release-vs-clear later to maint).
(merge 3bdd897413 ms/meson-with-ancient-git-wo-ls-files-dedup later to maint).
(merge cca758d324 kh/doc-fast-import-historical later to maint).
(merge 9b0781196a jc/test-hashmap-is-still-here later to maint).
6 changes: 0 additions & 6 deletions Documentation/config/core.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -696,12 +696,6 @@ core.unsetenvvars::
Defaults to `PERL5LIB` to account for the fact that Git for
Windows insists on using its own Perl interpreter.

core.restrictinheritedhandles::
Windows-only: override whether spawned processes inherit only standard
file handles (`stdin`, `stdout` and `stderr`) or all handles. Can be
`auto`, `true` or `false`. Defaults to `auto`, which means `true` on
Windows 7 and later, and `false` on older Windows versions.

core.createObject::
You can set this to 'link', in which case a hardlink followed by
a delete of the source are used to make sure that object creation
Expand Down
10 changes: 10 additions & 0 deletions Documentation/diff-context-options.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
`-U<n>`::
`--unified=<n>`::
Generate diffs with _<n>_ lines of context. Defaults to `diff.context`
or 3 if the config option is unset.

`--inter-hunk-context=<n>`::
Show the context between diff hunks, up to the specified _<number>_
of lines, thereby fusing hunks that are close to each other.
Defaults to `diff.interHunkContext` or 0 if the config option
is unset.
2 changes: 2 additions & 0 deletions Documentation/git-add.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ This effectively runs `add --interactive`, but bypasses the
initial command menu and directly jumps to the `patch` subcommand.
See ``Interactive mode'' for details.

include::diff-context-options.adoc[]

`-e`::
`--edit`::
Open the diff vs. the index in an editor and let the user
Expand Down
2 changes: 2 additions & 0 deletions Documentation/git-checkout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
Note that this option uses the no overlay mode by default (see also
`--overlay`), and currently doesn't support overlay mode.

include::diff-context-options.adoc[]

`--ignore-other-worktrees`::
`git checkout` refuses when the wanted branch is already checked
out or otherwise in use by another worktree. This option makes
Expand Down
2 changes: 2 additions & 0 deletions Documentation/git-commit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ OPTIONS
which changes to commit. See linkgit:git-add[1] for
details.

include::diff-context-options.adoc[]

`-C <commit>`::
`--reuse-message=<commit>`::
Take an existing _<commit>_ object, and reuse the log message
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-fast-import.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ amount of memory usage and processing time. Assuming the frontend
is able to keep up with fast-import and feed it a constant stream of data,
import times for projects holding 10+ years of history and containing
100,000+ individual commits are generally completed in just 1-2
hours on quite modest (~$2,000 USD) hardware.
hours on quite modest hardware (~$2,000 USD in 2007).

Most bottlenecks appear to be in foreign source data access (the
source just cannot extract revisions fast enough) or disk IO (fast-import
Expand Down
13 changes: 7 additions & 6 deletions Documentation/git-for-each-ref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ git-for-each-ref - Output information on each ref

SYNOPSIS
--------
[verse]
'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
[synopsis]
git for-each-ref [--count=<count>] [--shell|--perl|--python|--tcl]
[(--sort=<key>)...] [--format=<format>]
[--include-root-refs] [ --stdin | <pattern>... ]
[--points-at=<object>]
[--include-root-refs] [--points-at=<object>]
[--merged[=<object>]] [--no-merged[=<object>]]
[--contains[=<object>]] [--no-contains[=<object>]]
[--exclude=<pattern> ...] [--start-after=<marker>]
[(--exclude=<pattern>)...] [--start-after=<marker>]
[ --stdin | <pattern>... ]

DESCRIPTION
-----------
Expand Down Expand Up @@ -114,7 +114,8 @@ TAB %(refname)`.
deleted, modified or added between invocations. Output will only yield those
references which follow the marker lexicographically. Output begins from the
first reference that would come after the marker alphabetically. Cannot be
used with general pattern matching or custom sort options.
used with `--sort=<key>` or `--stdin` options, or the _<pattern>_ argument(s)
to limit the refs.

FIELD NAMES
-----------
Expand Down
2 changes: 2 additions & 0 deletions Documentation/git-reset.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ OPTIONS
separated with _NUL_ character and all other characters are taken
literally (including newlines and quotes).

include::diff-context-options.adoc[]

`--`::
Do not interpret any more arguments as options.

Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-restore.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ otherwise from the index. Use `--source` to restore from a different commit.
See "Reset, restore and revert" in linkgit:git[1] for the differences
between the three commands.

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

OPTIONS
-------
`-s <tree>`::
Expand All @@ -52,6 +50,8 @@ leave out at most one of _<rev-A>__ and _<rev-B>_, in which case it defaults to
Mode" section of linkgit:git-add[1] to learn how to operate
the `--patch` mode.

include::diff-context-options.adoc[]

`-W`::
`--worktree`::
`-S`::
Expand Down
2 changes: 2 additions & 0 deletions Documentation/git-stash.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ to learn how to operate the `--patch` mode.
The `--patch` option implies `--keep-index`. You can use
`--no-keep-index` to override this.

include::diff-context-options.adoc[]

-S::
--staged::
This option is only valid for `push` and `save` commands.
Expand Down
2 changes: 0 additions & 2 deletions Documentation/git-switch.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ Switching branches does not require a clean index and working tree
however if the operation leads to loss of local changes, unless told
otherwise with `--discard-changes` or `--merge`.

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

OPTIONS
-------
_<branch>_::
Expand Down
2 changes: 1 addition & 1 deletion Documentation/user-manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what
it does.

------------------------------------------------------------------
git_config(git_default_config);
repo_config(the_repository, git_default_config);
if (argc != 3)
usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");
if (get_sha1(argv[2], sha1))
Expand Down
45 changes: 37 additions & 8 deletions add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ static void init_color(struct repository *r, struct add_i_state *s,
free(key);
}

void init_add_i_state(struct add_i_state *s, struct repository *r)
void init_add_i_state(struct add_i_state *s, struct repository *r,
struct add_p_opt *add_p_opt)
{
const char *value;

s->r = r;
s->context = -1;
s->interhunkcontext = -1;

if (repo_config_get_value(r, "color.interactive", &value))
s->use_color = -1;
Expand Down Expand Up @@ -78,9 +81,27 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
repo_config_get_string(r, "diff.algorithm",
&s->interactive_diff_algorithm);

if (!repo_config_get_int(r, "diff.context", &s->context))
if (s->context < 0)
die(_("%s cannot be negative"), "diff.context");
if (!repo_config_get_int(r, "diff.interHunkContext", &s->interhunkcontext))
if (s->interhunkcontext < 0)
die(_("%s cannot be negative"), "diff.interHunkContext");

repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
if (s->use_single_key)
setbuf(stdin, NULL);

if (add_p_opt->context != -1) {
if (add_p_opt->context < 0)
die(_("%s cannot be negative"), "--unified");
s->context = add_p_opt->context;
}
if (add_p_opt->interhunkcontext != -1) {
if (add_p_opt->interhunkcontext < 0)
die(_("%s cannot be negative"), "--inter-hunk-context");
s->interhunkcontext = add_p_opt->interhunkcontext;
}
}

void clear_add_i_state(struct add_i_state *s)
Expand Down Expand Up @@ -969,6 +990,10 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
opts->prompt = N_("Patch update");
count = list_and_choose(s, files, opts);
if (count > 0) {
struct add_p_opt add_p_opt = {
.context = s->context,
.interhunkcontext = s->interhunkcontext,
};
struct strvec args = STRVEC_INIT;
struct pathspec ps_selected = { 0 };

Expand All @@ -979,7 +1004,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
parse_pathspec(&ps_selected,
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
PATHSPEC_LITERAL_PATH, "", args.v);
res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected);
res = run_add_p(s->r, ADD_P_ADD, &add_p_opt, NULL, &ps_selected);
strvec_clear(&args);
clear_pathspec(&ps_selected);
}
Expand Down Expand Up @@ -1014,10 +1039,13 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
if (count > 0) {
struct child_process cmd = CHILD_PROCESS_INIT;

strvec_pushl(&cmd.args, "git", "diff", "-p", "--cached",
oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree),
"--", NULL);
strvec_pushl(&cmd.args, "git", "diff", "-p", "--cached", NULL);
if (s->context != -1)
strvec_pushf(&cmd.args, "--unified=%i", s->context);
if (s->interhunkcontext != -1)
strvec_pushf(&cmd.args, "--inter-hunk-context=%i", s->interhunkcontext);
strvec_pushl(&cmd.args, oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree), "--", NULL);
for (i = 0; i < files->items.nr; i++)
if (files->selected[i])
strvec_push(&cmd.args,
Expand Down Expand Up @@ -1110,7 +1138,8 @@ static void command_prompt_help(struct add_i_state *s)
_("(empty) select nothing"));
}

int run_add_i(struct repository *r, const struct pathspec *ps)
int run_add_i(struct repository *r, const struct pathspec *ps,
struct add_p_opt *add_p_opt)
{
struct add_i_state s = { NULL };
struct print_command_item_data data = { "[", "]" };
Expand Down Expand Up @@ -1153,7 +1182,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
->util = util;
}

init_add_i_state(&s, r);
init_add_i_state(&s, r, add_p_opt);

/*
* When color was asked for, use the prompt color for
Expand Down
17 changes: 14 additions & 3 deletions add-interactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

#include "color.h"

struct add_p_opt {
int context;
int interhunkcontext;
};

#define ADD_P_OPT_INIT { .context = -1, .interhunkcontext = -1 }

struct add_i_state {
struct repository *r;
int use_color;
Expand All @@ -18,14 +25,17 @@ struct add_i_state {

int use_single_key;
char *interactive_diff_filter, *interactive_diff_algorithm;
int context, interhunkcontext;
};

void init_add_i_state(struct add_i_state *s, struct repository *r);
void init_add_i_state(struct add_i_state *s, struct repository *r,
struct add_p_opt *add_p_opt);
void clear_add_i_state(struct add_i_state *s);

struct repository;
struct pathspec;
int run_add_i(struct repository *r, const struct pathspec *ps);
int run_add_i(struct repository *r, const struct pathspec *ps,
struct add_p_opt *add_p_opt);

enum add_p_mode {
ADD_P_ADD,
Expand All @@ -36,6 +46,7 @@ enum add_p_mode {
};

int run_add_p(struct repository *r, enum add_p_mode mode,
const char *revision, const struct pathspec *ps);
struct add_p_opt *o, const char *revision,
const struct pathspec *ps);

#endif
14 changes: 9 additions & 5 deletions add-patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ static int normalize_marker(const char *p)
static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
{
struct strvec args = STRVEC_INIT;
const char *diff_algorithm = s->s.interactive_diff_algorithm;
struct strbuf *plain = &s->plain, *colored = NULL;
struct child_process cp = CHILD_PROCESS_INIT;
char *p, *pend, *colored_p = NULL, *colored_pend = NULL, marker = '\0';
Expand All @@ -424,8 +423,12 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
int res;

strvec_pushv(&args, s->mode->diff_cmd);
if (diff_algorithm)
strvec_pushf(&args, "--diff-algorithm=%s", diff_algorithm);
if (s->s.context != -1)
strvec_pushf(&args, "--unified=%i", s->s.context);
if (s->s.interhunkcontext != -1)
strvec_pushf(&args, "--inter-hunk-context=%i", s->s.interhunkcontext);
if (s->s.interactive_diff_algorithm)
strvec_pushf(&args, "--diff-algorithm=%s", s->s.interactive_diff_algorithm);
if (s->revision) {
struct object_id oid;
strvec_push(&args,
Expand Down Expand Up @@ -1760,14 +1763,15 @@ static int patch_update_file(struct add_p_state *s,
}

int run_add_p(struct repository *r, enum add_p_mode mode,
const char *revision, const struct pathspec *ps)
struct add_p_opt *o, const char *revision,
const struct pathspec *ps)
{
struct add_p_state s = {
{ r }, STRBUF_INIT, STRBUF_INIT, STRBUF_INIT, STRBUF_INIT
};
size_t i, binary_count = 0;

init_add_i_state(&s.s, r);
init_add_i_state(&s.s, r, o);

if (mode == ADD_P_STASH)
s.mode = &patch_mode_stash;
Expand Down
6 changes: 3 additions & 3 deletions apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ struct gitdiff_data {

static void git_apply_config(void)
{
git_config_get_string("apply.whitespace", &apply_default_whitespace);
git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
git_config(git_xmerge_config, NULL);
repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
repo_config(the_repository, git_xmerge_config, NULL);
}

static int parse_whitespace_option(struct apply_state *state, const char *option)
Expand Down
Loading