Skip to content

Commit c55e1f0

Browse files
authored
Merge pull request #7 from git/master
Enhance documentation and refactor repository configuration
2 parents 1b3e991 + 9a0c470 commit c55e1f0

500 files changed

Lines changed: 5964 additions & 4103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.b4-cover-template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ ${diffstat}
88
${range_diff}
99
---
1010
base-commit: ${base_commit}
11+
change-id: ${change_id}
1112
${prerequisites}

Documentation/MyFirstContribution.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,11 @@ effect which had not occurred to you. It is always okay to ask for clarification
14771477
if you aren't sure why a change was suggested, or what the reviewer is asking
14781478
you to do.
14791479

1480+
When replying to review comments, quote only the parts of the message that are
1481+
relevant to your response. It is usually helpful to trim away unrelated context,
1482+
such as large portions of the patch that are not being discussed, while keeping
1483+
enough quoted text for readers to understand what you are responding to.
1484+
14801485
Make sure your email client has a plaintext email mode and it is turned on; the
14811486
Git list rejects HTML email. Please also follow the mailing list etiquette
14821487
outlined in the

Documentation/RelNotes/2.55.0.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ Performance, Internal Implementation, Development Support etc.
8585
* Promisor remote handling has been refactored and fixed in
8686
preparation for auto-configuration of advertised remotes.
8787
88-
* Rust support is enabled by default (but still allows opting out) in
89-
some future version of Git.
88+
* Rust support is enabled by default (but still allows opting out);
89+
in Git version 3.0, Rust will become mandatory.
9090
9191
* Preparation of the xdiff/ codebase to work with Rust.
9292

Documentation/RelNotes/2.56.0.adoc

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ UI, Workflows & Features
4343
output has been optimized to reserve a column for marks (caret,
4444
question mark, or asterisk) only when such marks are actually shown.
4545

46+
* Option parsing with 'git rev-parse --parseopt' and in most 'git'
47+
subcommands has been updated to exit with 0 (instead of 129) when the
48+
help option ('-h' or '--help') is requested directly by the user,
49+
aligning with standard Unix convention.
50+
51+
* The '[includeIf "condition"]' conditional inclusion facility for
52+
configuration files has been taught to use the location of the
53+
worktree in its condition.
54+
55+
* The usage string and SYNOPSIS for 'git fast-export' have been
56+
standardized to make them consistent with each other and with other
57+
commands.
58+
4659

4760
Performance, Internal Implementation, Development Support etc.
4861
--------------------------------------------------------------
@@ -108,6 +121,91 @@ Performance, Internal Implementation, Development Support etc.
108121
the generated header file 'hook-list.h' is built before compiling
109122
files in 'builtin_sources' that depend on it.
110123
124+
* The repository discovery and repository configuration phases, which
125+
were previously intertwined in 'setup.c', have been split. Repository
126+
discovery has been updated to populate a 'struct repo_discovery'
127+
without modifying the repository state, which is then taken by
128+
repository configuration to initialize the repository, paving the way
129+
for clean unification of repository configuration.
130+
131+
* The 'SubmittingPatches' document has been updated to explicitly
132+
describe the expectation for contributors to retract or abandon their
133+
patch series when they are no longer pursuing it.
134+
135+
* The contributor guide has been updated to advise new contributors to
136+
trim irrelevant quoted text when replying to review comments, matching
137+
the existing advice given to reviewers.
138+
139+
* The build system has been updated to support building universal macOS
140+
binaries when 'Rust' is enabled, by compiling separate static archives
141+
for each target triple listed in 'RUST_TARGETS' and combining them
142+
using the macOS 'lipo' tool. The 'git-credential-osxkeychain' helper
143+
has been updated to link against '$(RUST_LIB)' when 'Rust' is enabled.
144+
145+
* The test suite has been updated to use the 'test_grep' helper instead
146+
of bare 'grep' for test assertions, allowing file contents to be
147+
printed on failure for easier debugging. A new 'greplint' linter has
148+
been introduced to detect and prevent new bare 'grep' assertions from
149+
being added to the test suite.
150+
151+
* The pipelines in 't1410-reflog.sh' have been replaced with the
152+
'test_stdout_line_count' helper to avoid suppressing the exit code of
153+
'git' commands, ensuring failures are not hidden from the test suite.
154+
155+
* The cache-scanning loop in 'next_cache_entry()' has been optimized
156+
to avoid rescanning already-unpacked index entries, preventing a
157+
quadratic performance slow-down when diffing the working tree
158+
against a commit with a pathspec matching early index entries.
159+
160+
* The global configuration variable 'ignore_case' (representing the
161+
'core.ignorecase' configuration) has been migrated into 'struct
162+
repo_config_values' to tie it to a specific repository instance.
163+
164+
* The performance of ref updates and reads using the 'reftable' backend
165+
in the presence of many deletion tombstone records has been optimized
166+
by removing the tombstone suppression flag from the merged iterator
167+
and instead skipping tombstones at higher-level call sites where
168+
iteration bounds are known.
169+
170+
* Various code paths have been hardened against potential NULL-pointer
171+
dereferences and invalid file descriptor accesses flagged by
172+
Coverity.
173+
174+
* The in-tree 'b4' cover letter template has been updated to include the
175+
'change-id' trailer, ensuring that sent tags generated by 'b4' contain
176+
the required tracking information for subsequent runs.
177+
178+
* 'git receive-pack' has been refactored to use ODB transaction
179+
interfaces instead of directly managing 'tmp_objdir' for staging
180+
incoming objects, bringing it closer to being ODB backend agnostic.
181+
182+
* The test script 't/t9811-git-p4-label-import.sh' has been
183+
modernized to use 'test_path_is_file' and 'test_path_is_missing'
184+
instead of raw 'test -f' and '! test -f' calls.
185+
186+
* A redundant strbuf_reset() call in the 'HAVE_GETDELIM' path of
187+
strbuf_getwholeline() has been removed, as getdelim() overwrites the
188+
buffer and the length is updated afterward.
189+
190+
* The object database enumeration interface odb_for_each_object() has
191+
been taught to accept object filters, allowing the underlying backends
192+
to optimize the traversal by using reachability bitmaps when
193+
available. 'git cat-file --batch-all-objects' has been updated to use
194+
this generic interface, simplifying its code and avoiding direct
195+
access to ODB backend internals.
196+
197+
* The test script 't/t1100-commit-tree-options.sh' has been modernized
198+
by converting test cases to the modern style (using single quotes and
199+
tab indentation) and moving the creation of the expected file inside
200+
the setup test so it runs under the protection of the test harness.
201+
202+
* The test script 't/t7614-merge-signoff.sh' has been updated to avoid
203+
suppressing the exit code of 'git' commands in a pipe.
204+
205+
* The 'git rev-list --no-walk' command has been corrected to restore
206+
pathspec filtering, which was lost when the streaming walk was
207+
refactored.
208+
111209
112210
Fixes since v2.55
113211
-----------------
@@ -215,3 +313,40 @@ Fixes since v2.55
215313
escape sequences that use colon-separated subfields (e.g., for
216314
256-color or true-color codes).
217315
(merge 3792b2aea4 mm/sideband-ansi-sgr-colon-fix later to maint).
316+
317+
* The 'reftable' code has been hardened against corrupted tables by
318+
fixing out-of-bounds writes, out-of-bounds reads, and abort calls
319+
during parsing.
320+
(merge ca93c27328 ps/reftable-hardening later to maint).
321+
322+
* A description in the release notes for Git 2.55.0 has been
323+
retroactively updated to clarify that Rust support is enabled by
324+
default, but still optional, and will become mandatory in Git 3.0.
325+
(merge 18b2009d14 jc/relnotes-2.55-rust-fix later to maint).
326+
327+
* The early-exit optimization in 'paint_down_to_common()' has been
328+
gated on the queue being generation-ordered, fixing a bug where
329+
'git merge-base' (without '--all') could return incorrect results
330+
on repositories with v1 commit graphs and clock skew.
331+
(merge ae68032a8d kk/commit-reach-find-all-fix later to maint).
332+
333+
* The client-side parser of the server-advertised bundle-URI list has
334+
been updated to drain the remaining response in order to avoid
335+
protocol desynchronization when the server sends a misconfigured list.
336+
Also, the server-side has been taught to omit empty configuration
337+
values instead of sending invalid key-value lines.
338+
(merge 50de1169e4 tc/bundle-uri-empty-fix later to maint).
339+
340+
* The 'topo_levels' slab was propagated only to the topmost layer of a
341+
split commit-graph chain, causing topological levels for commits in
342+
base layers to be recomputed during incremental writes. This has been
343+
corrected.
344+
345+
* The stream-based object signature verification path has been
346+
corrected to avoid double-closing the stream on read errors.
347+
(merge cfd52a74a0 ps/odb-stream-double-close-fix later to maint).
348+
349+
* The '-i' shorthand for the '--init' option, which was accepted by the
350+
'git submodule update' command until it was broken in a modernization
351+
of the option-parsing code, has been restored.
352+
(merge ff1da37f58 dm/submodule-update-i-shorthand later to maint).

Documentation/SubmittingPatches

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,20 @@ of review.
123123
top, it gets merged to the 'master' branch and waits to become part
124124
of the next major release.
125125

126+
But sometimes things do not work as planned:
127+
128+
. If a mailing list discussion convinces you that your changes aren't
129+
ideal, please explicitly retract the topic to save the maintainer
130+
time and effort.
131+
132+
. If you must drop a topic due to shifting priorities, lack of time,
133+
or other commitments, notify the list as a courtesy so others can
134+
take over. Anyone can resurrect the topic later when they have the
135+
capacity to do so.
136+
137+
. Topics with unaddressed review comments that remain inactive for
138+
four weeks may be discarded by the maintainer.
139+
126140
In the following sections, many techniques and conventions are listed
127141
to help your patches get reviewed effectively in such a life cycle.
128142

Documentation/config.adoc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,51 @@ refer to linkgit:gitignore[5] for details. For convenience:
146146
This is the same as `gitdir` except that matching is done
147147
case-insensitively (e.g. on case-insensitive file systems)
148148

149+
`worktree`::
150+
The data that follows the keyword `worktree` and a colon is used as a
151+
glob pattern. If the working directory of the current worktree matches
152+
the pattern, the include condition is met.
153+
+
154+
The worktree location is the path where files are checked out (as returned
155+
by `git rev-parse --show-toplevel`). This is different from `gitdir`, which
156+
matches the `.git` directory path. In a linked worktree, the worktree path
157+
is the directory where that worktree's files are located, not the main
158+
repository's `.git` directory.
159+
+
160+
The pattern uses the same glob syntax as `gitdir` (including `~/`, `./`,
161+
`**/`, and trailing-`/` prefix matching). This condition will never match
162+
in a bare repository (which has no worktree).
163+
+
164+
Unlike `gitdir`, the `worktree` condition currently matches only the
165+
realpath-resolved worktree location. If the working tree was entered via a
166+
symbolic link, a pattern that uses the symbolic-link spelling may not match;
167+
use the real path instead.
168+
+
169+
This is useful when you want to apply configuration based on where the
170+
working tree is located on the filesystem. For example, a contributor who
171+
works on the same project both personally and as an employee can use
172+
different `user.name` and `user.email` values depending on which directory
173+
the worktree is checked out under:
174+
+
175+
----
176+
[includeIf "worktree:/home/user/work/"]
177+
path = ~/.config/git/work.inc
178+
[includeIf "worktree:/home/user/personal/"]
179+
path = ~/.config/git/personal.inc
180+
----
181+
+
182+
While `extensions.worktreeConfig` (see linkgit:git-worktree[1]) also supports
183+
per-worktree configuration, it stores the config inside each repository's
184+
`.git/config.worktree` file and requires running `git config --worktree`
185+
inside each worktree individually. In contrast, `includeIf "worktree:..."`
186+
can be set once in a global or system-level configuration file (e.g.
187+
`~/.config/git/config`) and applies to all repositories at once based on
188+
their worktree location.
189+
190+
`worktree/i`::
191+
This is the same as `worktree` except that matching is done
192+
case-insensitively (e.g. on case-insensitive file systems)
193+
149194
`onbranch`::
150195
The data that follows the keyword `onbranch` and a colon is taken to be a
151196
pattern with standard globbing wildcards and two additional
@@ -244,6 +289,14 @@ Example
244289
[includeIf "gitdir:~/to/group/"]
245290
path = /path/to/foo.inc
246291
292+
; include if the worktree is at /path/to/project-build
293+
[includeIf "worktree:/path/to/project-build"]
294+
path = build-config.inc
295+
296+
; include for all worktrees inside /path/to/group
297+
[includeIf "worktree:/path/to/group/"]
298+
path = group-config.inc
299+
247300
; relative paths are always relative to the including
248301
; file (if the condition is true); their location is not
249302
; affected by the condition

Documentation/git-fast-export.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git-fast-export - Git data exporter
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git fast-export' [<options>] | 'git fast-import'
12+
'git fast-export' [<options>] [<revision-range>] [[--] <path>...]
1313

1414
DESCRIPTION
1515
-----------

Makefile

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,14 @@ include shared.mak
500500
#
501501
# Building Rust code requires Cargo.
502502
#
503+
# Define RUST_TARGETS if you want to cross-compile. If left unspecified, it uses
504+
# the default Rust target on the system.
505+
#
506+
# On macOS, this supports specifying multiple targets, separated by a space.
507+
# This will produce a Universal static library using `lipo`.
508+
#
509+
# Example: RUST_TARGETS="aarch64-apple-darwin x86_64-apple-darwin"
510+
#
503511
# == SHA-1 and SHA-256 defines ==
504512
#
505513
# === SHA-1 backend ===
@@ -939,16 +947,19 @@ TEST_SHELL_PATH = $(SHELL_PATH)
939947

940948
LIB_FILE = libgit.a
941949

950+
ifndef NO_RUST
942951
ifdef DEBUG
943-
RUST_TARGET_DIR = target/debug
952+
RUST_BUILD_CONFIG = debug
944953
else
945-
RUST_TARGET_DIR = target/release
954+
RUST_BUILD_CONFIG = release
946955
endif
947956

948957
ifeq ($(uname_S),Windows)
949-
RUST_LIB = $(RUST_TARGET_DIR)/gitcore.lib
958+
RUST_LIB_NAME = gitcore.lib
950959
else
951-
RUST_LIB = $(RUST_TARGET_DIR)/libgitcore.a
960+
RUST_LIB_NAME = libgitcore.a
961+
endif
962+
RUST_LIB = target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)
952963
endif
953964

954965
GITLIBS = common-main.o $(LIB_FILE)
@@ -2601,6 +2612,7 @@ FUZZ_OBJS += oss-fuzz/fuzz-date.o
26012612
FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
26022613
FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
26032614
FUZZ_OBJS += oss-fuzz/fuzz-parse-attr-line.o
2615+
FUZZ_OBJS += oss-fuzz/fuzz-reftable.o
26042616
FUZZ_OBJS += oss-fuzz/fuzz-url-decode-mem.o
26052617
.PHONY: fuzz-objs
26062618
fuzz-objs: $(FUZZ_OBJS)
@@ -3019,11 +3031,35 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
30193031
$(LIB_FILE): $(LIB_OBJS)
30203032
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
30213033

3034+
ifndef NO_RUST
3035+
ifeq ($(RUST_TARGETS),)
30223036
$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
30233037
$(QUIET_CARGO)cargo build $(CARGO_ARGS)
3038+
else
3039+
ifneq ($(words $(RUST_TARGETS)),1)
3040+
ifneq ($(uname_S),Darwin)
3041+
$(error Building universal Rust libraries requires macOS (lipo is not available on $(uname_S)))
3042+
endif
3043+
endif
3044+
3045+
RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))
3046+
$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
3047+
$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*
3048+
3049+
$(RUST_LIB): $(RUST_MEMBER_LIBS)
3050+
$(call mkdir_p_parent_template)
3051+
$(QUIET_GEN)\
3052+
if test $(words $(RUST_TARGETS)) -gt 1; \
3053+
then \
3054+
lipo -create $^ -output $@; \
3055+
else \
3056+
cp $< $@; \
3057+
fi
3058+
endif
30243059

30253060
.PHONY: rust
30263061
rust: $(RUST_LIB)
3062+
endif
30273063

30283064
export DEFAULT_EDITOR DEFAULT_PAGER
30293065

@@ -4074,7 +4110,8 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
40744110
contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
40754111
$(AR) $(ARFLAGS) $@ $^
40764112

4077-
contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS
4113+
# When Rust is enabled, git-credential-osxkeychain depends on Rust symbols in $(RUST_LIB)
4114+
contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) $(RUST_LIB) GIT-LDFLAGS
40784115
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
40794116
$(filter %.o,$^) $(LIBS) -framework Security -framework CoreFoundation
40804117

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4008,7 +4008,7 @@ static int path_is_beyond_symlink_1(struct apply_state *state, struct strbuf *na
40084008
struct cache_entry *ce;
40094009

40104010
ce = index_file_exists(state->repo->index, name->buf,
4011-
name->len, ignore_case);
4011+
name->len, repo_ignore_case(the_repository));
40124012
if (ce && S_ISLNK(ce->ce_mode))
40134013
return 1;
40144014
} else {

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ int cmd_add(int argc,
581581
string_list_clear(&only_match_skip_worktree, 0);
582582
}
583583

584-
transaction = odb_transaction_begin(repo->objects);
584+
odb_transaction_begin_or_die(repo->objects, &transaction, 0);
585585

586586
ps_matched = xcalloc(pathspec.nr, 1);
587587
if (add_renormalize)

0 commit comments

Comments
 (0)