Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f179920
Merge branch 'ps/object-read-stream' into ps/packfile-store-in-odb-so…
gitster Dec 15, 2025
3d86511
Merge branch 'js/test-symlink-windows' into js/prep-symlink-windows
gitster Dec 17, 2025
00f117f
Merge branch 'jc/object-read-stream-fix' into ps/read-object-info-imp…
gitster Dec 18, 2025
b767867
doc: git-reset: reorder the forms
jvns Jan 5, 2026
2968342
doc: git-reset: clarify intro
jvns Jan 5, 2026
7fb080a
doc: git-reset: clarify `git reset [mode]`
jvns Jan 5, 2026
555c846
doc: git-reset: clarify `git reset <pathspec>`
jvns Jan 5, 2026
f1ec43d
Merge branch 'ps/odb-misc-fixes' into ps/packfile-store-in-odb-source
gitster Jan 7, 2026
480336a
packfile: create store via its owning source
pks-t Jan 9, 2026
0316c63
packfile: pass source to `prepare_pack()`
pks-t Jan 9, 2026
085de91
packfile: refactor kept-pack cache to work with packfile stores
pks-t Jan 9, 2026
eb9ec52
packfile: refactor misleading code when unusing pack windows
pks-t Jan 9, 2026
84f0e60
packfile: move packfile store into object source
pks-t Jan 9, 2026
7b330a1
packfile: only prepare owning store in `packfile_store_get_packs()`
pks-t Jan 9, 2026
8384cbc
packfile: only prepare owning store in `packfile_store_prepare()`
pks-t Jan 9, 2026
6acefa0
packfile: inline `find_kept_pack_entry()`
pks-t Jan 9, 2026
a593373
packfile: refactor `find_pack_entry()` to work on the packfile store
pks-t Jan 9, 2026
a282a8f
packfile: move MIDX into packfile store
pks-t Jan 9, 2026
f6b2625
fsck: snapshot default refs before object walk
newren Jan 9, 2026
f0af8b4
mingw: do resolve symlinks in `getcwd()`
dscho Jan 9, 2026
7997e36
init: do parse _all_ core.* settings early
dscho Jan 9, 2026
0fcbb57
strbuf_readlink(): avoid calling `readlink()` twice in corner-cases
kblees Jan 9, 2026
21f368d
strbuf_readlink(): support link targets that exceed 2*PATH_MAX
dscho Jan 9, 2026
aa7b886
trim_last_path_component(): avoid hard-coding the directory separator
kblees Jan 9, 2026
28a7e27
contrib/subtree: detect rewritten subtree commits
Jan 10, 2026
a8227ae
http-backend: write newlines to stderr when responding with errors
KJTsanaktsidis Jan 12, 2026
220f888
t1410: use test helpers in reflog rewind test
pushkarscripts Jan 11, 2026
123e818
object-file: always set OI_LOOSE when reading object info
pks-t Jan 12, 2026
7a4bd1b
packfile: always declare object info to be OI_PACKED
pks-t Jan 12, 2026
27d9486
packfile: extend `is_delta` field to allow for "unknown" state
pks-t Jan 12, 2026
57c168d
packfile: always populate pack-specific info when reading object info
pks-t Jan 12, 2026
8908c30
packfile: disentangle return value of `packed_object_info()`
pks-t Jan 12, 2026
5ff2969
packfile: skip unpacking object header for disk size requests
pks-t Jan 12, 2026
12d3b58
packfile: drop repository parameter from `packed_object_info()`
pks-t Jan 12, 2026
df971a7
refs/files: simplify iterating through root refs
pks-t Jan 12, 2026
e615643
refs/files: move fsck functions into global scope
pks-t Jan 12, 2026
5a74903
refs/files: remove `refs_check_dir` parameter
pks-t Jan 12, 2026
2fe33ae
refs/files: remove useless indirection
pks-t Jan 12, 2026
0ff9cf4
refs/files: extract function to check single ref
pks-t Jan 12, 2026
9ebccf7
refs/files: improve error handling when verifying symrefs
pks-t Jan 12, 2026
7b8c36a
refs/files: perform consistency checks for root refs
pks-t Jan 12, 2026
70b338d
fsck: drop unused fields from `struct fsck_ref_report`
pks-t Jan 12, 2026
dcecffb
refs/files: extract generic symref target checks
pks-t Jan 12, 2026
ae38c3a
refs/files: introduce function to perform normal ref checks
pks-t Jan 12, 2026
ab67f0a
refs/reftable: adapt includes to become consistent
pks-t Jan 12, 2026
78384e2
refs/reftable: extract function to retrieve backend for worktree
pks-t Jan 12, 2026
9341740
refs/reftable: fix consistency checks with worktrees
pks-t Jan 12, 2026
06d6ead
refs/reftable: introduce generic checks for refs
pks-t Jan 12, 2026
46d611c
builtin/fsck: move generic object ID checks into `refs_fsck()`
pks-t Jan 12, 2026
9727336
builtin/fsck: move generic HEAD check into `refs_fsck()`
pks-t Jan 12, 2026
8947da0
builtin/fsck: drop `fsck_head_link()`
pks-t Jan 12, 2026
d0cec08
utf8.c: prepare workaround for iconv under macOS 14/15
tboegi Jan 12, 2026
d281241
utf8.c: enable workaround for iconv under macOS 14/15
tboegi Jan 12, 2026
6edbb7b
Merge branch 'en/fsck-snapshot-ref-state'
gitster Jan 21, 2026
9813aac
Merge branch 'je/doc-reset'
gitster Jan 21, 2026
79e3055
Merge branch 'cs/rebased-subtree-split'
gitster Jan 21, 2026
0a5dcc1
Merge branch 'tb/macos-iconv-workarounds'
gitster Jan 21, 2026
dc861c9
Merge branch 'ps/ref-consistency-checks'
gitster Jan 21, 2026
e01178b
Merge branch 'ps/t1410-cleanup'
gitster Jan 21, 2026
ab72d23
Merge branch 'kt/http-backend-errors'
gitster Jan 21, 2026
d627023
Merge branch 'ps/packfile-store-in-odb-source'
gitster Jan 21, 2026
bc5cbbe
Merge branch 'ps/read-object-info-improvements'
gitster Jan 21, 2026
39d66dd
Merge branch 'js/prep-symlink-windows'
gitster Jan 21, 2026
83a69f1
Git 2.53-rc1
gitster Jan 20, 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
23 changes: 23 additions & 0 deletions Documentation/RelNotes/2.53.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ UI, Workflows & Features
`--onto` option of "git replay". Test coverage of "git replay" has
been improved.

* The split command in "git subtree" (in contrib/) has been taught to
deal better with rebased history.

* The iconv library on macOS fails to correctly handle stateful
ISO/IEC 2022 encoded strings. Work it around instead of replacing
it wholesale from homebrew.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -96,6 +103,13 @@ Performance, Internal Implementation, Development Support etc.
* Import newer version of "clar", unit testing framework.
(merge 84071a6dea ps/clar-integers later to maint).

* The packfile_store data structure is moved from object store to odb
source.

* The object-info API has been cleaned up.

* Further preparation to upstream symbolic link support on Windows.


Fixes since v2.52
-----------------
Expand Down Expand Up @@ -259,6 +273,13 @@ Fixes since v2.52
"git stash export/import" recently introduced.
(merge 02fc44a989 bc/doc-stash-import-export later to maint).

* "git fsck" used inconsistent set of refs to show a confused
warning, which has been corrected.

* Some error messages from the http transport layer lacked the
terminating newline, which has been corrected.
(merge a8227ae8d5 kt/http-backend-errors later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 46207a54cc qj/doc-http-bad-want-response later to maint).
(merge df90eccd93 kh/doc-commit-extra-references later to maint).
Expand Down Expand Up @@ -288,3 +309,5 @@ Fixes since v2.52
(merge 6c5c7e7071 ac/t1420-use-more-direct-check later to maint).
(merge 2ac93bfcbc ds/builtin-doc-update later to maint).
(merge 3f051fc9c9 kh/doc-patch-id later to maint).
(merge 555c8464e5 je/doc-reset later to maint).
(merge 220f888d7e ps/t1410-cleanup later to maint).
6 changes: 6 additions & 0 deletions Documentation/fsck-msgids.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
`badGpgsig`::
(ERROR) A tag contains a bad (truncated) signature (e.g., `gpgsig`) header.

`badHeadTarget`::
(ERROR) The `HEAD` ref is a symref that does not refer to a branch.

`badHeaderContinuation`::
(ERROR) A continuation header (such as for `gpgsig`) is unexpectedly truncated.

Expand Down Expand Up @@ -41,6 +44,9 @@
`badRefName`::
(ERROR) A ref has an invalid format.

`badRefOid`::
(ERROR) A ref points to an invalid object ID.

`badReferentName`::
(ERROR) The referent name of a symref is invalid.

Expand Down
111 changes: 57 additions & 54 deletions Documentation/git-reset.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,67 @@ git-reset(1)

NAME
----
git-reset - Reset current HEAD to the specified state
git-reset - Set `HEAD` or the index to a known state

SYNOPSIS
--------
[synopsis]
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
git reset [-q] [<tree-ish>] [--] <pathspec>...
git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]
git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]

DESCRIPTION
-----------
In the first three forms, copy entries from _<tree-ish>_ to the index.
In the last form, set the current branch head (`HEAD`) to _<commit>_,
optionally modifying index and working tree to match.
The _<tree-ish>_/_<commit>_ defaults to `HEAD` in all forms.

`git reset [-q] [<tree-ish>] [--] <pathspec>...`::
`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`::
These forms reset the index entries for all paths that match the
_<pathspec>_ to their state at _<tree-ish>_. (It does not affect
the working tree or the current branch.)
+
This means that `git reset <pathspec>` is the opposite of `git add
<pathspec>`. This command is equivalent to
`git restore [--source=<tree-ish>] --staged <pathspec>...`.
+
After running `git reset <pathspec>` to update the index entry, you can
use linkgit:git-restore[1] to check the contents out of the index to
the working tree. Alternatively, using linkgit:git-restore[1]
and specifying a commit with `--source`, you
can copy the contents of a path out of a commit to the index and to the
working tree in one go.
`git reset` does either of the following:

`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`::
Interactively select hunks in the difference between the index
and _<tree-ish>_ (defaults to `HEAD`). The chosen hunks are applied
in reverse to the index.
+
This means that `git reset -p` is the opposite of `git add -p`, i.e.
you can use it to selectively reset hunks. See the "Interactive Mode"
section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
1. `git reset [<mode>] <commit>` changes which commit `HEAD` points to. This
makes it possible to undo various Git operations, for example commit, merge,
rebase, and pull.
2. When you specify files or directories or pass `--patch`, `git reset` updates
the staged version of the specified files.

`git reset [<mode>] [<commit>]`::
This form resets the current branch head to _<commit>_ and
possibly updates the index (resetting it to the tree of _<commit>_) and
the working tree depending on _<mode>_. Before the operation, `ORIG_HEAD`
is set to the tip of the current branch. If _<mode>_ is omitted,
defaults to `--mixed`. The _<mode>_ must be one of the following:
Set the current branch head (`HEAD`) to point at _<commit>_.
Depending on _<mode>_, also update the working directory and/or index
to match the contents of _<commit>_.
_<commit>_ defaults to `HEAD`.
Before the operation, `ORIG_HEAD` is set to the tip of the current branch.
+
The _<mode>_ must be one of the following (default `--mixed`):
+
--
`--soft`::
Does not touch the index file or the working tree at all (but
resets the head to _<commit>_, just like all modes do). This leaves
all your changed files "Changes to be committed", as `git status`
would put it.

--
`--mixed`::
Resets the index but not the working tree (i.e., the changed files
are preserved but not marked for commit) and reports what has not
been updated. This is the default action.
Leave your working directory unchanged.
Update the index to match the new `HEAD`, so nothing will be staged.
+
If `-N` is specified, removed paths are marked as intent-to-add (see
If `-N` is specified, mark removed paths as intent-to-add (see
linkgit:git-add[1]).

`--soft`::
Leave your working tree files and the index unchanged.
For example, if you have no staged changes, you can use
`git reset --soft HEAD~5; git commit`
to combine the last 5 commits into 1 commit. This works even with
changes in the working tree, which are left untouched, but such usage
can lead to confusion.

`--hard`::
Resets the index and working tree. Any changes to tracked files in the
working tree since _<commit>_ are discarded. Any untracked files or
directories in the way of writing any tracked files are simply deleted.
Overwrite all files and directories with the version from _<commit>_,
and may overwrite untracked files. Tracked files not in _<commit>_ are
removed so that the working tree matches _<commit>_.
Update the index to match the new `HEAD`, so nothing will be staged.

`--merge`::
Resets the index and updates the files in the working tree that are
different between _<commit>_ and `HEAD`, but keeps those which are
Reset the index and update the files in the working tree that are
different between _<commit>_ and `HEAD`, but keep those which are
different between the index and working tree (i.e. which have changes
which have not been added).
Mainly exists to reset unmerged index entries, like those left behind by
`git am -3` or `git switch -m` in certain situations.
If a file that is different between _<commit>_ and the index has
unstaged changes, reset is aborted.
+
In other words, `--merge` does something like a `git read-tree -u -m <commit>`,
but carries forward unmerged index entries.

`--keep`::
Resets index entries and updates files in the working tree that are
Expand All @@ -98,6 +79,28 @@ but carries forward unmerged index entries.
the submodules' `HEAD` to be detached at that commit.
--

`git reset [-q] [<tree-ish>] [--] <pathspec>...`::
`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`::
For all specified files or directories, set the staged version to
the version from the given commit or tree (which defaults to `HEAD`).
+
This means that `git reset <pathspec>` is the opposite of `git add
<pathspec>`: it unstages all changes to the specified file(s) or
directories. This is equivalent to `git restore --staged <pathspec>...`.
+
In this mode, `git reset` updates only the index (without updating the `HEAD` or
working tree files). If you want to update the files as well as the index
entries, use linkgit:git-restore[1].

`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`::
Interactively select changes from the difference between the index
and the specified commit or tree (which defaults to `HEAD`).
The index is modified using the chosen changes.
+
This means that `git reset -p` is the opposite of `git add -p`, i.e.
you can use it to selectively unstage changes. See the "Interactive Mode"
section of linkgit:git-add[1] to learn how to use the `--patch` option.

See "Reset, restore and revert" in linkgit:git[1] for the differences
between the three commands.

Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1687,11 +1687,21 @@ ifeq ($(uname_S),Darwin)
BASIC_CFLAGS += -I/sw/include
BASIC_LDFLAGS += -L/sw/lib
endif
ifeq ($(shell test -d /opt/sw/lib && echo y),y)
BASIC_CFLAGS += -I/opt/sw/include
BASIC_LDFLAGS += -L/opt/sw/lib
ifeq ($(shell test -e /opt/sw/lib/libiconv.dylib && echo y),y)
HAS_GOOD_LIBICONV = Yes
endif
endif
endif
ifndef NO_DARWIN_PORTS
ifeq ($(shell test -d /opt/local/lib && echo y),y)
BASIC_CFLAGS += -I/opt/local/include
BASIC_LDFLAGS += -L/opt/local/lib
ifeq ($(shell test -e /opt/local/lib/libiconv.dylib && echo y),y)
HAS_GOOD_LIBICONV = Yes
endif
endif
endif
ifndef NO_APPLE_COMMON_CRYPTO
Expand All @@ -1714,6 +1724,7 @@ endif
ifdef USE_HOMEBREW_LIBICONV
ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)
ICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv
HAS_GOOD_LIBICONV = Yes
endif
endif
endif
Expand Down Expand Up @@ -1859,6 +1870,11 @@ ifndef NO_ICONV
endif
EXTLIBS += $(ICONV_LINK) -liconv
endif
ifdef NEEDS_GOOD_LIBICONV
ifndef HAS_GOOD_LIBICONV
BASIC_CFLAGS += -DICONV_RESTART_RESET
endif
endif
endif
ifdef ICONV_OMITS_BOM
BASIC_CFLAGS += -DICONV_OMITS_BOM
Expand Down
3 changes: 1 addition & 2 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,7 @@ static void batch_object_write(const char *obj_name,
data->info.sizep = &data->size;

if (pack)
ret = packed_object_info(the_repository, pack,
offset, &data->info);
ret = packed_object_info(pack, offset, &data->info);
else
ret = odb_read_object_info_extended(the_repository->objects,
&data->oid, &data->info,
Expand Down
37 changes: 23 additions & 14 deletions builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ static void end_packfile(void)
idx_name = keep_pack(create_index());

/* Register the packfile with core git's machinery. */
new_p = packfile_store_load_pack(pack_data->repo->objects->packfiles,
new_p = packfile_store_load_pack(pack_data->repo->objects->sources->packfiles,
idx_name, 1);
if (!new_p)
die(_("core Git rejected index %s"), idx_name);
Expand Down Expand Up @@ -955,7 +955,7 @@ static int store_object(
struct object_id *oidout,
uintmax_t mark)
{
struct packfile_store *packs = the_repository->objects->packfiles;
struct odb_source *source;
void *out, *delta;
struct object_entry *e;
unsigned char hdr[96];
Expand All @@ -979,7 +979,11 @@ static int store_object(
if (e->idx.offset) {
duplicate_count_by_type[type]++;
return 1;
} else if (packfile_list_find_oid(packfile_store_get_packs(packs), &oid)) {
}

for (source = the_repository->objects->sources; source; source = source->next) {
if (!packfile_list_find_oid(packfile_store_get_packs(source->packfiles), &oid))
continue;
e->type = type;
e->pack_id = MAX_PACK_ID;
e->idx.offset = 1; /* just not zero! */
Expand Down Expand Up @@ -1096,10 +1100,10 @@ static void truncate_pack(struct hashfile_checkpoint *checkpoint)

static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
{
struct packfile_store *packs = the_repository->objects->packfiles;
size_t in_sz = 64 * 1024, out_sz = 64 * 1024;
unsigned char *in_buf = xmalloc(in_sz);
unsigned char *out_buf = xmalloc(out_sz);
struct odb_source *source;
struct object_entry *e;
struct object_id oid;
unsigned long hdrlen;
Expand Down Expand Up @@ -1179,24 +1183,29 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
if (e->idx.offset) {
duplicate_count_by_type[OBJ_BLOB]++;
truncate_pack(&checkpoint);
goto out;
}

} else if (packfile_list_find_oid(packfile_store_get_packs(packs), &oid)) {
for (source = the_repository->objects->sources; source; source = source->next) {
if (!packfile_list_find_oid(packfile_store_get_packs(source->packfiles), &oid))
continue;
e->type = OBJ_BLOB;
e->pack_id = MAX_PACK_ID;
e->idx.offset = 1; /* just not zero! */
duplicate_count_by_type[OBJ_BLOB]++;
truncate_pack(&checkpoint);

} else {
e->depth = 0;
e->type = OBJ_BLOB;
e->pack_id = pack_id;
e->idx.offset = offset;
e->idx.crc32 = crc32_end(pack_file);
object_count++;
object_count_by_type[OBJ_BLOB]++;
goto out;
}

e->depth = 0;
e->type = OBJ_BLOB;
e->pack_id = pack_id;
e->idx.offset = offset;
e->idx.crc32 = crc32_end(pack_file);
object_count++;
object_count_by_type[OBJ_BLOB]++;

out:
free(in_buf);
free(out_buf);
}
Expand Down
Loading