Skip to content

Commit f675df4

Browse files
authored
Merge branch 'master' into interactive-patch-context
2 parents b534069 + cf6f63e commit f675df4

File tree

419 files changed

+43836
-13287
lines changed

Some content is hidden

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

419 files changed

+43836
-13287
lines changed

.github/workflows/coverity.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ jobs:
147147
key: cov-build-${{ env.COVERITY_LANGUAGE }}-${{ env.COVERITY_PLATFORM }}-${{ steps.lookup.outputs.hash }}
148148
- name: build with cov-build
149149
run: |
150-
export PATH="$RUNNER_TEMP/cov-analysis/bin:$PATH" &&
150+
export PATH="$PATH:$RUNNER_TEMP/cov-analysis/bin" &&
151151
cov-configure --gcc &&
152-
cov-build --dir cov-int make
152+
if ! cov-build --dir cov-int make
153+
then
154+
cat cov-int/build-log.txt
155+
exit 1
156+
fi
153157
- name: package the build
154158
run: tar -czvf cov-int.tgz cov-int
155159
- name: submit the build to Coverity Scan

.github/workflows/main.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ jobs:
265265
run: pip install meson ninja
266266
- name: Setup
267267
shell: pwsh
268-
run: meson setup build --vsenv -Dperl=disabled -Dcredential_helpers=wincred
268+
run: meson setup build --vsenv -Dbuildtype=release -Dperl=disabled -Dcredential_helpers=wincred
269269
- name: Compile
270270
shell: pwsh
271271
run: meson compile -C build
@@ -408,12 +408,27 @@ jobs:
408408
jobname: ${{matrix.vector.jobname}}
409409
CC: ${{matrix.vector.cc}}
410410
CI_JOB_IMAGE: ${{matrix.vector.image}}
411+
CUSTOM_PATH: /custom
411412
runs-on: ubuntu-latest
412413
container: ${{matrix.vector.image}}
413414
steps:
414415
- name: prepare libc6 for actions
415416
if: matrix.vector.jobname == 'linux32'
416417
run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6
418+
- name: install git in container
419+
run: |
420+
if command -v git
421+
then
422+
: # nothing to do
423+
elif command -v apk
424+
then
425+
apk add --update git
426+
elif command -v dnf
427+
then
428+
dnf -yq update && dnf -yq install git
429+
else
430+
apt-get -q update && apt-get -q -y install git
431+
fi
417432
- uses: actions/checkout@v4
418433
- run: ci/install-dependencies.sh
419434
- run: useradd builder --create-home

.gitlab-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ build:msvc-meson:
173173
test:msvc-meson:
174174
extends: .msvc-meson
175175
stage: test
176-
when: manual
177176
timeout: 6h
178177
needs:
179178
- job: "build:msvc-meson"

Documentation/BreakingChanges.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ These features will be removed.
183183
timeframe, in preference to its synonym "--annotate-stdin". Git 3.0
184184
removes the support for "--stdin" altogether.
185185

186+
* The git-whatchanged(1) command has outlived its usefulness more than
187+
10 years ago, and takes more keystrokes to type than its rough
188+
equivalent `git log --raw`. We have nominated the command for
189+
removal, have changed the command to refuse to work unless the
190+
`--i-still-use-this` option is given, and asked the users to report
191+
when they do so. So far there hasn't been a single complaint.
192+
+
193+
The command will be removed.
186194

187195
== Superseded features that will not be deprecated
188196

Documentation/CodingGuidelines

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ For C programs:
315315
encouraged to have a blank line between the end of the declarations
316316
and the first statement in the block.
317317

318+
- Do not explicitly initialize global variables to 0 or NULL;
319+
instead, let BSS take care of the zero initialization.
320+
318321
- NULL pointers shall be written as NULL, not as 0.
319322

320323
- When declaring pointers, the star sides with the variable
@@ -877,6 +880,17 @@ Characters are also surrounded by underscores:
877880
As a side effect, backquoted placeholders are correctly typeset, but
878881
this style is not recommended.
879882

883+
When documenting multiple related `git config` variables, place them on
884+
a separate line instead of separating them by commas. For example, do
885+
not write this:
886+
`core.var1`, `core.var2`::
887+
Description common to `core.var1` and `core.var2`.
888+
889+
Instead write this:
890+
`core.var1`::
891+
`core.var2`::
892+
Description common to `core.var1` and `core.var2`.
893+
880894
Synopsis Syntax
881895

882896
The synopsis (a paragraph with [synopsis] attribute) is automatically

Documentation/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ cmds_txt = cmds-ancillaryinterrogators.adoc \
317317

318318
$(cmds_txt): cmd-list.made
319319

320-
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
321-
$(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
320+
cmd-list.made: cmd-list.sh ../command-list.txt $(MAN1_TXT)
321+
$(QUIET_GEN)$(SHELL_PATH) ./cmd-list.sh .. . $(cmds_txt) && \
322322
date >$@
323323

324324
mergetools-%.adoc: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
@@ -398,9 +398,9 @@ user-manual.html: user-manual.xml $(XSLT)
398398
git.info: user-manual.texi
399399
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
400400

401-
user-manual.texi: user-manual.xml
401+
user-manual.texi: user-manual.xml fix-texi.sh
402402
$(QUIET_DB2TEXI)$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@+ && \
403-
$(PERL_PATH) fix-texi.perl <$@+ >$@ && \
403+
$(SHELL_PATH) fix-texi.sh <$@+ >$@ && \
404404
$(RM) $@+
405405

406406
user-manual.pdf: user-manual.xml
@@ -510,7 +510,12 @@ lint-docs-meson:
510510
awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \
511511
grep -v -e '#' -e '^$$' | \
512512
sort >tmp-meson-diff/meson.adoc && \
513-
ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \
513+
ls git*.adoc scalar.adoc | \
514+
grep -v -e git-bisect-lk2009.adoc \
515+
-e git-pack-redundant.adoc \
516+
-e git-tools.adoc \
517+
-e git-whatchanged.adoc \
518+
>tmp-meson-diff/actual.adoc && \
514519
if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \
515520
echo "Meson man pages differ from actual man pages:"; \
516521
diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \

Documentation/MyFirstContribution.adoc

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ the list by sending an email to <[email protected]>
4040
The https://lore.kernel.org/git[archive] of this mailing list is
4141
available to view in a browser.
4242

43-
==== https://groups.google.com/forum/#!forum/git-mentoring[[email protected]]
44-
45-
This mailing list is targeted to new contributors and was created as a place to
46-
post questions and receive answers outside of the public eye of the main list.
47-
Veteran contributors who are especially interested in helping mentor newcomers
48-
are present on the list. In order to avoid search indexers, group membership is
49-
required to view messages; anyone can join and no approval is required.
50-
5143
==== https://web.libera.chat/#git-devel[#git-devel] on Libera Chat
5244

5345
This IRC channel is for conversations between Git contributors. If someone is
@@ -150,15 +142,31 @@ command in `builtin/psuh.c`. Create that file, and within it, write the entry
150142
point for your command in a function matching the style and signature:
151143

152144
----
153-
int cmd_psuh(int argc, const char **argv, const char *prefix)
145+
int cmd_psuh(int argc UNUSED, const char **argv UNUSED,
146+
const char *prefix UNUSED, struct repository *repo UNUSED)
154147
----
155148

149+
A few things to note:
150+
151+
* A subcommand implementation takes its command line arguments
152+
in `int argc` + `const char **argv`, like `main()` would.
153+
154+
* It also takes two extra parameters, `prefix` and `repo`. What
155+
they mean will not be discussed until much later.
156+
157+
* Because this first example will not use any of the parameters,
158+
your compiler will give warnings on unused parameters. As the
159+
list of these four parameters is mandated by the API to add
160+
new built-in commands, you cannot omit them. Instead, you add
161+
`UNUSED` to each of them to tell the compiler that you *know*
162+
you are not (yet) using it.
163+
156164
We'll also need to add the declaration of psuh; open up `builtin.h`, find the
157165
declaration for `cmd_pull`, and add a new line for `psuh` immediately before it,
158166
in order to keep the declarations alphabetically sorted:
159167

160168
----
161-
int cmd_psuh(int argc, const char **argv, const char *prefix);
169+
int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);
162170
----
163171

164172
Be sure to `#include "builtin.h"` in your `psuh.c`. You'll also need to
@@ -174,7 +182,8 @@ Throughout the tutorial, we will mark strings for translation as necessary; you
174182
should also do so when writing your user-facing commands in the future.
175183

176184
----
177-
int cmd_psuh(int argc, const char **argv, const char *prefix)
185+
int cmd_psuh(int argc UNUSED, const char **argv UNUSED,
186+
const char *prefix UNUSED, struct repository *repo UNUSED)
178187
{
179188
printf(_("Pony saying hello goes here.\n"));
180189
return 0;
@@ -287,8 +296,9 @@ on the reference implementation linked at the top of this document.
287296
It's probably useful to do at least something besides printing out a string.
288297
Let's start by having a look at everything we get.
289298

290-
Modify your `cmd_psuh` implementation to dump the args you're passed, keeping
291-
existing `printf()` calls in place:
299+
Modify your `cmd_psuh` implementation to dump the args you're passed,
300+
keeping existing `printf()` calls in place; because the args are now
301+
used, remove the `UNUSED` macro from them:
292302

293303
----
294304
int i;
@@ -312,26 +322,27 @@ on the command line, including the name of our command. (If `prefix` is empty
312322
for you, try `cd Documentation/ && ../bin-wrappers/git psuh`). That's not so
313323
helpful. So what other context can we get?
314324

315-
Add a line to `#include "config.h"`. Then, add the following bits to the
325+
Add a line to `#include "config.h"` and `#include "repository.h"`.
326+
Then, add the following bits to the function body:
316327
function body:
317328

318329
----
319330
const char *cfg_name;
320331
321332
...
322333
323-
git_config(git_default_config, NULL);
324-
if (git_config_get_string_tmp("user.name", &cfg_name) > 0)
334+
repo_config(repo, git_default_config, NULL);
335+
if (repo_config_get_string_tmp(repo, "user.name", &cfg_name))
325336
printf(_("No name is found in config\n"));
326337
else
327338
printf(_("Your name: %s\n"), cfg_name);
328339
----
329340

330-
`git_config()` will grab the configuration from config files known to Git and
331-
apply standard precedence rules. `git_config_get_string_tmp()` will look up
341+
`repo_config()` will grab the configuration from config files known to Git and
342+
apply standard precedence rules. `repo_config_get_string_tmp()` will look up
332343
a specific key ("user.name") and give you the value. There are a number of
333344
single-key lookup functions like this one; you can see them all (and more info
334-
about how to use `git_config()`) in `Documentation/technical/api-config.adoc`.
345+
about how to use `repo_config()`) in `Documentation/technical/api-config.adoc`.
335346

336347
You should see that the name printed matches the one you see when you run:
337348

@@ -364,7 +375,7 @@ status_init_config(&s, git_status_config);
364375
----
365376

366377
But as we drill down, we can find that `status_init_config()` wraps a call
367-
to `git_config()`. Let's modify the code we wrote in the previous commit.
378+
to `repo_config()`. Let's modify the code we wrote in the previous commit.
368379

369380
Be sure to include the header to allow you to use `struct wt_status`:
370381

@@ -380,8 +391,8 @@ prepare it, and print its contents:
380391
381392
...
382393
383-
wt_status_prepare(the_repository, &status);
384-
git_config(git_default_config, &status);
394+
wt_status_prepare(repo, &status);
395+
repo_config(repo, git_default_config, &status);
385396
386397
...
387398

Documentation/MyFirstObjectWalk.adoc

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Open up a new file `builtin/walken.c` and set up the command handler:
4343
#include "builtin.h"
4444
#include "trace.h"
4545
46-
int cmd_walken(int argc, const char **argv, const char *prefix)
46+
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
4747
{
4848
trace_printf(_("cmd_walken incoming...\n"));
4949
return 0;
@@ -83,23 +83,36 @@ int cmd_walken(int argc, const char **argv, const char *prefix)
8383
}
8484
----
8585

86-
Also add the relevant line in `builtin.h` near `cmd_whatchanged()`:
86+
Also add the relevant line in `builtin.h` near `cmd_version()`:
8787

8888
----
89-
int cmd_walken(int argc, const char **argv, const char *prefix);
89+
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo);
9090
----
9191

92-
Include the command in `git.c` in `commands[]` near the entry for `whatchanged`,
92+
Include the command in `git.c` in `commands[]` near the entry for `version`,
9393
maintaining alphabetical ordering:
9494

9595
----
9696
{ "walken", cmd_walken, RUN_SETUP },
9797
----
9898

99-
Add it to the `Makefile` near the line for `builtin/worktree.o`:
99+
Add an entry for the new command in the both the Make and Meson build system,
100+
before the entry for `worktree`:
100101

102+
- In the `Makefile`:
101103
----
104+
...
102105
BUILTIN_OBJS += builtin/walken.o
106+
...
107+
----
108+
109+
- In the `meson.build` file:
110+
----
111+
builtin_sources = [
112+
...
113+
'builtin/walken.c',
114+
...
115+
]
103116
----
104117

105118
Build and test out your command, without forgetting to ensure the `DEVELOPER`
@@ -193,7 +206,7 @@ initialization functions.
193206

194207
Next, we should have a look at any relevant configuration settings (i.e.,
195208
settings readable and settable from `git config`). This is done by providing a
196-
callback to `git_config()`; within that callback, you can also invoke methods
209+
callback to `repo_config()`; within that callback, you can also invoke methods
197210
from other components you may need that need to intercept these options. Your
198211
callback will be invoked once per each configuration value which Git knows about
199212
(global, local, worktree, etc.).
@@ -221,14 +234,14 @@ static int git_walken_config(const char *var, const char *value,
221234
}
222235
----
223236

224-
Make sure to invoke `git_config()` with it in your `cmd_walken()`:
237+
Make sure to invoke `repo_config()` with it in your `cmd_walken()`:
225238

226239
----
227-
int cmd_walken(int argc, const char **argv, const char *prefix)
240+
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
228241
{
229242
...
230243
231-
git_config(git_walken_config, NULL);
244+
repo_config(repo, git_walken_config, NULL);
232245
233246
...
234247
}
@@ -250,14 +263,14 @@ We'll also need to include the `revision.h` header:
250263
251264
...
252265
253-
int cmd_walken(int argc, const char **argv, const char *prefix)
266+
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
254267
{
255268
/* This can go wherever you like in your declarations.*/
256269
struct rev_info rev;
257270
...
258271
259-
/* This should go after the git_config() call. */
260-
repo_init_revisions(the_repository, &rev, prefix);
272+
/* This should go after the repo_config() call. */
273+
repo_init_revisions(repo, &rev, prefix);
261274
262275
...
263276
}
@@ -305,7 +318,7 @@ Then let's invoke `final_rev_info_setup()` after the call to
305318
`repo_init_revisions()`:
306319

307320
----
308-
int cmd_walken(int argc, const char **argv, const char *prefix)
321+
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo)
309322
{
310323
...
311324

0 commit comments

Comments
 (0)