Compare

99d74db4e62c84ef54a7c977ca6da7a06999c94a..cee3798cb4a54f1011ce0bcd36d47b79dafbb894

Merge branch 'bc/maintenance-doc-markup-fix-for-asciidoc'

Mark-up fix for 'git maintenance' documentation pages.

* bc/maintenance-doc-markup-fix-for-asciidoc:
  doc: fix conjoined maintenance strategies in git-config(1)

Junio C Hamano <gitster@pobox.com> · 2026-09-14 04:53 UTC

Browse files
24 files changed, +469 −134
modified .github/workflows/main.yml
@@ -413,9 +413,9 @@ jobs:
413 413 # A RHEL 8 compatible distro. Supported until 2029-05-31.
414 414 - jobname: almalinux-8
415 415 image: almalinux:8
416 - # Supported until 2026-08-31.
417 - - jobname: debian-11
418 - image: debian:11
416 + # Supported until 2028-06-30.
417 + - jobname: debian-12
418 + image: debian:12
419 419 env:
420 420 jobname: ${{matrix.vector.jobname}}
421 421 CC: ${{matrix.vector.cc}}
modified .gitlab-ci.yml
@@ -71,9 +71,9 @@ test:linux:
71 71 # A RHEL 8 compatible distro. Supported until 2029-05-31.
72 72 - jobname: almalinux-8
73 73 image: almalinux:8
74 - # Supported until 2026-08-31.
75 - - jobname: debian-11
76 - image: debian:11
74 + # Supported until 2028-06-30.
75 + - jobname: debian-12
76 + image: debian:12
77 77 artifacts:
78 78 paths:
79 79 - t/failed-test-artifacts
modified Documentation/RelNotes/2.56.0.adoc
@@ -144,6 +144,10 @@ UI, Workflows & Features
144 144 remote-tracking branch cannot be uniquely identified, which has
145 145 been corrected.
146 146
147 + * The 'git replay' command has been taught the '--linearize' option to
148 + drop merge commits and linearize the replayed history, mimicking 'git
149 + rebase --no-rebase-merges'.
150 +
147 151
148 152 Performance, Internal Implementation, Development Support etc.
149 153 --------------------------------------------------------------
@@ -498,6 +502,22 @@ Performance, Internal Implementation, Development Support etc.
498 502 refactored to use the internal apply API directly, avoiding the need
499 503 to spawn a 'git apply' subprocess.
500 504
505 + * The memory ownership of argv elements passed to the revision
506 + machinery has been made more robust by keeping logically "freed"
507 + elements alive until the rev_info struct is released, preventing
508 + use-after-free bugs when options store references to them.
509 +
510 + * The object lookup machinery has been taught to gracefully recover
511 + when a multi-pack-index points to an owning pack that was removed
512 + during a concurrent geometric repack, and 'git replay' has been
513 + fixed to not segfault when reading such missing objects.
514 +
515 + * A collection of patches from Git for Windows has been upstreamed,
516 + mostly focusing on simplifying and robustifying build configurations
517 + for MinGW/MSYS2, dropping obsolete compatibility options, and allowing
518 + the main 'git.exe' to be used directly without the extra wrapper
519 + process on Windows.
520 +
501 521
502 522 Fixes since v2.55
503 523 -----------------
@@ -779,6 +799,29 @@ Fixes since v2.55
779 799 the path originally recorded in the file was absolute, and this new
780 800 capability is used to correctly detect such mismatches.
781 801
802 + * GitHub Actions CI workflow runs triggered by pull requests have
803 + been configured to cancel older runs when a new push is made to the
804 + same pull request.
805 + (merge a251b1bd21 hn/ci-cancel-stale-pr-runs later to maint).
806 +
807 + * The string extraction logic for the branch name and worktree name
808 + from the given path in 'git worktree add' has been corrected and
809 + simplified to avoid out-of-bounds reads and improper handling of
810 + trailing slashes.
811 + (merge 2e8a9d94b0 rs/worktree-add-basename-fixes later to maint).
812 +
813 + * The CI job for Debian 11 has been updated to use Debian 12, as the
814 + former is now out of the LTS period.
815 + (merge 00fa850235 jk/ci-bump-debian-to-12 later to maint).
816 +
817 + * The CI script to install dependencies for the documentation build
818 + has been updated to install asciidoctor directly via the system
819 + package manager instead of pinning to an older version via gem.
820 + Additionally, an obsolete variable used for retired Azure Pipelines
821 + environments has been removed.
822 + (merge 1c1eed13bd jk/ci-use-system-asciidoctor later to maint).
823 +
782 824 * Other code cleanup, docfix, build fix, etc.
783 825 (merge 026636128f ss/submittingpatches-typofix later to maint).
784 826 (merge d2af22cc21 jc/rerere-doc-typofix later to maint).
827 + (merge c486c1df72 hk/typofix later to maint).
modified Documentation/config/maintenance.adoc
@@ -41,6 +41,7 @@ The possible strategies are:
41 41 This repacking strategy is a full replacement for the `gc` strategy and is
42 42 recommended for large repositories. This is the default strategy for manual
43 43 maintenance.
44 + +
44 45 * `incremental`: This setting optimizes for performing small maintenance
45 46 activities that do not delete any data. This does not schedule the `gc`
46 47 task, but runs the `prefetch` and `commit-graph` tasks hourly, the
modified GIT-VERSION-GEN
@@ -1,6 +1,6 @@
1 1 #!/bin/sh
2 2
3 - DEF_VER=v2.55.GIT
3 + DEF_VER=v2.56.0-rc0
4 4
5 5 LF='
6 6 '
modified builtin/mktree.c
@@ -125,7 +125,6 @@ static void mktree_line(struct repository *repo, char *buf, int nul_term_line, i
125 125 oi.typep = &obj_type;
126 126 if (odb_read_object_info_extended(repo->objects, &oid, &oi,
127 127 OBJECT_INFO_LOOKUP_REPLACE |
128 - OBJECT_INFO_QUICK |
129 128 OBJECT_INFO_SKIP_FETCH_OBJECT) < 0)
130 129 obj_type = -1;
131 130
@@ -200,8 +199,11 @@ int cmd_mktree(int ac,
200 199 puts(oid_to_hex(&oid));
201 200 fflush(stdout);
202 201 }
202 + for (int i = 0; i < used; i++)
203 + free(entries[i]);
203 204 used=0; /* reset tree entry buffer for re-use in batch mode */
204 205 }
206 + free(entries);
205 207 strbuf_release(&sb);
206 208
207 209 return 0;
modified builtin/pack-objects.c
@@ -1790,7 +1790,7 @@ static int want_object_in_pack_mtime(const struct object_id *oid,
1790 1790 struct multi_pack_index *m = get_multi_pack_index(files->packed);
1791 1791 struct pack_entry e;
1792 1792
1793 - if (m && fill_midx_entry(m, oid, &e, NULL)) {
1793 + if (m && midx_fill_entry(m, oid, &e, NULL) == MIDX_FILL_HIT) {
1794 1794 want = want_object_in_pack_one(e.p, oid, exclude, found_pack, found_offset, found_mtime);
1795 1795 if (want != -1)
1796 1796 return want;
modified ci/install-dependencies.sh
@@ -164,10 +164,9 @@ sparse)
164 164 libexpat-dev gettext zlib1g-dev sparse
165 165 ;;
166 166 Documentation)
167 - sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make
167 + sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make ruby \
168 + asciidoctor
168 169
169 - test -n "$ALREADY_HAVE_ASCIIDOCTOR" ||
170 - sudo gem install --version 1.5.8 asciidoctor
171 170 sudo gem install concurrent-ruby
172 171 ;;
173 172 esac
modified compat/mingw.c
@@ -3157,6 +3157,45 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
3157 3157 return -1;
3158 3158 }
3159 3159
3160 + #ifdef ENSURE_MSYSTEM_IS_SET
3161 + #if !defined(RUNTIME_PREFIX) || !defined(HAVE_WPGMPTR) || !defined(MINGW_PREFIX)
3162 + static size_t append_system_bin_dirs(char *path UNUSED, size_t size UNUSED)
3163 + {
3164 + return 0;
3165 + }
3166 + #else
3167 + static size_t append_system_bin_dirs(char *path, size_t size)
3168 + {
3169 + char prefix[32768];
3170 + const char *slash;
3171 + size_t len = xwcstoutf(prefix, _wpgmptr, sizeof(prefix)), off = 0;
3172 +
3173 + if (len == 0 || len >= sizeof(prefix) ||
3174 + !(slash = find_last_dir_sep(prefix)))
3175 + return 0;
3176 + /* strip trailing `git.exe` */
3177 + len = slash - prefix;
3178 +
3179 + /* strip trailing `cmd` or `<mingw-prefix>\bin` or `bin` or `libexec\git-core` */
3180 + if (strip_suffix_mem(prefix, &len, "\\" MINGW_PREFIX "\\libexec\\git-core") ||
3181 + strip_suffix_mem(prefix, &len, "\\" MINGW_PREFIX "\\bin"))
3182 + off += xsnprintf(path + off, size - off,
3183 + "%.*s\\" MINGW_PREFIX "\\bin;", (int)len, prefix);
3184 + else if (strip_suffix_mem(prefix, &len, "\\cmd") ||
3185 + strip_suffix_mem(prefix, &len, "\\bin") ||
3186 + strip_suffix_mem(prefix, &len, "\\libexec\\git-core"))
3187 + off += xsnprintf(path + off, size - off,
3188 + "%.*s\\" MINGW_PREFIX "\\bin;", (int)len, prefix);
3189 + else
3190 + return 0;
3191 +
3192 + off += xsnprintf(path + off, size - off,
3193 + "%.*s\\usr\\bin;", (int)len, prefix);
3194 + return off;
3195 + }
3196 + #endif
3197 + #endif
3198 +
3160 3199 static void setup_windows_environment(void)
3161 3200 {
3162 3201 char *tmp = getenv("TMPDIR");
@@ -3208,6 +3247,35 @@ static void setup_windows_environment(void)
3208 3247 if (!tmp && (tmp = getenv("USERPROFILE")))
3209 3248 setenv("HOME", tmp, 1);
3210 3249 }
3250 +
3251 + if (!getenv("PLINK_PROTOCOL"))
3252 + setenv("PLINK_PROTOCOL", "ssh", 0);
3253 +
3254 + #ifdef ENSURE_MSYSTEM_IS_SET
3255 + if (!(tmp = getenv("MSYSTEM")) || !tmp[0]) {
3256 + const char *home = getenv("HOME"), *path = getenv("PATH");
3257 + char buf[32768];
3258 + size_t off = 0;
3259 +
3260 + setenv("MSYSTEM", ENSURE_MSYSTEM_IS_SET, 1);
3261 +
3262 + if (home)
3263 + off += xsnprintf(buf + off, sizeof(buf) - off,
3264 + "%s\\bin;", home);
3265 + off += append_system_bin_dirs(buf + off, sizeof(buf) - off);
3266 + if (path)
3267 + off += xsnprintf(buf + off, sizeof(buf) - off,
3268 + "%s", path);
3269 + else if (off > 0)
3270 + buf[off - 1] = '\0';
3271 + else
3272 + buf[0] = '\0';
3273 + setenv("PATH", buf, 1);
3274 + }
3275 + #endif
3276 +
3277 + if (!getenv("LC_ALL") && !getenv("LC_CTYPE") && !getenv("LANG"))
3278 + setenv("LC_CTYPE", "C.UTF-8", 1);
3211 3279 }
3212 3280
3213 3281 int mingw_platform_has_symlinks(void)
modified config.mak.uname
@@ -465,14 +465,8 @@ ifeq ($(uname_S),Windows)
465 465 GIT_VERSION := $(GIT_VERSION).MSVC
466 466 pathsep = ;
467 467 # Assume that this is built in Git for Windows' SDK
468 - ifeq (MINGW32,$(MSYSTEM))
469 - prefix = /mingw32
470 - else
471 - ifeq (CLANGARM64,$(MSYSTEM))
472 - prefix = /clangarm64
473 - else
474 - prefix = /mingw64
475 - endif
468 + ifneq (,$(MSYSTEM))
469 + prefix = $(MINGW_PREFIX)
476 470 endif
477 471 # Prepend MSVC 64-bit tool-chain to PATH.
478 472 #
@@ -525,7 +519,8 @@ ifeq ($(uname_S),Windows)
525 519 NO_POSIX_GOODIES = UnfortunatelyYes
526 520 NATIVE_CRLF = YesPlease
527 521 DEFAULT_HELP_FORMAT = html
528 - ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
522 + SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
523 + ifneq (,$(MINGW_PREFIX))
529 524 # Move system config into top-level /etc/
530 525 ETC_GITCONFIG = ../etc/gitconfig
531 526 ETC_GITATTRIBUTES = ../etc/gitattributes
@@ -541,7 +536,9 @@ endif
541 536 compat/win32/pthread.o compat/win32/syslog.o \
542 537 compat/win32/trace2_win32_process_info.o \
543 538 compat/win32/dirent.o
544 - COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
539 + COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY \
540 + -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\"" \
541 + -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
545 542 BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
546 543 # invalidcontinue.obj allows Git's source code to close the same file
547 544 # handle twice, or to access the osfhandle of an already-closed stdout
@@ -718,6 +715,7 @@ ifeq ($(uname_S),MINGW)
718 715 FSMONITOR_DAEMON_BACKEND = win32
719 716 FSMONITOR_OS_SETTINGS = win32
720 717
718 + SKIP_DASHED_BUILT_INS = YabbaDabbaDoo
721 719 RUNTIME_PREFIX = YesPlease
722 720 HAVE_WPGMPTR = YesWeDo
723 721 NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
@@ -756,26 +754,25 @@ ifeq ($(uname_S),MINGW)
756 754 ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
757 755 BASIC_LDFLAGS += -Wl,--dynamicbase
758 756 endif
759 - ifeq (MINGW32,$(MSYSTEM))
760 - prefix = /mingw32
761 - HOST_CPU = i686
762 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
763 - endif
764 - ifeq (MINGW64,$(MSYSTEM))
765 - prefix = /mingw64
766 - HOST_CPU = x86_64
767 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
768 - else ifeq (CLANGARM64,$(MSYSTEM))
769 - prefix = /clangarm64
770 - HOST_CPU = aarch64
771 - BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
772 - else
773 - COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
774 - BASIC_LDFLAGS += -Wl,--large-address-aware
757 + ifneq (,$(MSYSTEM))
758 + ifeq ($(MINGW_PREFIX),$(filter-out /%,$(MINGW_PREFIX)))
759 + # Override if empty or does not start with a slash
760 + MINGW_PREFIX := /$(shell echo '$(MSYSTEM)' | tr A-Z a-z)
761 + endif
762 + prefix = $(MINGW_PREFIX)
763 + HOST_CPU = $(patsubst %-w64-mingw32,%,$(MINGW_CHOST))
764 + BASIC_LDFLAGS += -Wl,--pic-executable
765 + COMPAT_CFLAGS += -DDETECT_MSYS_TTY \
766 + -DENSURE_MSYSTEM_IS_SET="\"$(MSYSTEM)\"" \
767 + -DMINGW_PREFIX="\"$(patsubst /%,%,$(MINGW_PREFIX))\""
768 + ifeq (MINGW32,$(MSYSTEM))
769 + BASIC_LDFLAGS += -Wl,--large-address-aware
770 + endif
771 + # Move system config into top-level /etc/
772 + ETC_GITCONFIG = ../etc/gitconfig
773 + ETC_GITATTRIBUTES = ../etc/gitattributes
775 774 endif
776 - CC = gcc
777 - COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
778 - -fstack-protector-strong
775 + COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -fstack-protector-strong
779 776 EXTLIBS += -lntdll
780 777 EXTRA_PROGRAMS += headless-git$X
781 778 INSTALL = /bin/install
@@ -783,11 +780,7 @@ ifeq ($(uname_S),MINGW)
783 780 HAVE_LIBCHARSET_H = YesPlease
784 781 USE_GETTEXT_SCHEME = fallthrough
785 782 USE_LIBPCRE = YesPlease
786 - ifeq (/mingw64,$(subst 32,64,$(subst clangarm,mingw,$(prefix))))
787 - # Move system config into top-level /etc/
788 - ETC_GITCONFIG = ../etc/gitconfig
789 - ETC_GITATTRIBUTES = ../etc/gitattributes
790 - endif
783 + NO_PYTHON =
791 784 endif
792 785 ifeq ($(uname_S),QNX)
793 786 COMPAT_CFLAGS += -DSA_RESTART=0
modified contrib/buildsystems/CMakeLists.txt
@@ -256,7 +256,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
256 256 _CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe" NO_SYMLINK_HEAD UNRELIABLE_FSTAT
257 257 NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
258 258 OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
259 - HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM)
259 + HAVE_WPGMPTR HAVE_RTLGENRANDOM)
260 + if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64")
261 + add_compile_definitions(ENSURE_MSYSTEM_IS_SET="MINGW64" MINGW_PREFIX="mingw64")
262 + elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "arm64")
263 + add_compile_definitions(ENSURE_MSYSTEM_IS_SET="CLANGARM64" MINGW_PREFIX="clangarm64")
264 + elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x86")
265 + add_compile_definitions(ENSURE_MSYSTEM_IS_SET="MINGW32" MINGW_PREFIX="mingw32")
266 + endif()
260 267 list(APPEND compat_SOURCES
261 268 compat/mingw.c
262 269 compat/winansi.c
modified gitk-git/README.md
@@ -79,13 +79,14 @@ are also accepted.
79 79 All commits must be signed off (use `git commit --signoff`) and should
80 80 have commit messages prefixed with `gitk:`.
81 81
82 - Email Patches
83 - -------------
84 -
85 82 Send patches to git@vger.kernel.org and CC j6t@kdbg.org. See the Git
86 83 project's [patch submission guidelines](https://git-scm.com/docs/SubmittingPatches)
87 84 for detailed instructions on creating and sending patches.
88 85
86 + Please do not submit work that originated from AI, because this project
87 + is down-streamed to the Git project, which has a rather
88 + [strict AI guideline](https://git-scm.com/docs/SubmittingPatches#ai).
89 +
89 90 License
90 91 =======
91 92
modified gitk-git/gitk
@@ -11801,8 +11801,6 @@ proc prefspage_general {notebook} {
11801 11801 }
11802 11802
11803 11803 proc prefspage_colors {notebook} {
11804 - global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
11805 - global diffbgcolors linkfgcolor
11806 11804 global themeloader
11807 11805
11808 11806 set page [create_prefs_page $notebook.colors]
@@ -11834,75 +11832,72 @@ proc prefspage_colors {notebook} {
11834 11832
11835 11833 ttk::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold
11836 11834 grid $page.cdisp - -sticky w -pady 10
11837 - label $page.bg -padx 40 -relief sunk -background $bgcolor
11838 - ttk::button $page.bgbut -text [mc "Background"] \
11839 - -command [list choosecolor bgcolor {} $page [mc "background"]]
11840 - grid x $page.bgbut $page.bg -sticky w
11841 -
11842 - label $page.fg -padx 40 -relief sunk -background $fgcolor
11843 - ttk::button $page.fgbut -text [mc "Foreground"] \
11844 - -command [list choosecolor fgcolor {} $page [mc "foreground"]]
11845 - grid x $page.fgbut $page.fg -sticky w
11846 -
11847 - label $page.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
11848 - ttk::button $page.diffoldbut -text [mc "Diff: old lines"] \
11849 - -command [list choosecolor diffcolors 0 $page [mc "diff old lines"]]
11850 - grid x $page.diffoldbut $page.diffold -sticky w
11851 -
11852 - label $page.diffoldbg -padx 40 -relief sunk -background [lindex $diffbgcolors 0]
11853 - ttk::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \
11854 - -command [list choosecolor diffbgcolors 0 $page [mc "diff old lines bg"]]
11855 - grid x $page.diffoldbgbut $page.diffoldbg -sticky w
11856 -
11857 - label $page.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
11858 - ttk::button $page.diffnewbut -text [mc "Diff: new lines"] \
11859 - -command [list choosecolor diffcolors 1 $page [mc "diff new lines"]]
11860 - grid x $page.diffnewbut $page.diffnew -sticky w
11861 -
11862 - label $page.diffnewbg -padx 40 -relief sunk -background [lindex $diffbgcolors 1]
11863 - ttk::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \
11864 - -command [list choosecolor diffbgcolors 1 $page [mc "diff new lines bg"]]
11865 - grid x $page.diffnewbgbut $page.diffnewbg -sticky w
11866 -
11867 - label $page.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
11868 - ttk::button $page.hunksepbut -text [mc "Diff: hunk header"] \
11869 - -command [list choosecolor diffcolors 2 $page [mc "diff hunk header"]]
11870 - grid x $page.hunksepbut $page.hunksep -sticky w
11871 -
11872 - label $page.markbgsep -padx 40 -relief sunk -background $markbgcolor
11873 - ttk::button $page.markbgbut -text [mc "Marked line bg"] \
11874 - -command [list choosecolor markbgcolor {} $page [mc "marked line background"]]
11875 - grid x $page.markbgbut $page.markbgsep -sticky w
11876 -
11877 - label $page.selbgsep -padx 40 -relief sunk -background $selectbgcolor
11878 - ttk::button $page.selbgbut -text [mc "Select bg"] \
11879 - -command [list choosecolor selectbgcolor {} $page [mc "background"]]
11880 - grid x $page.selbgbut $page.selbgsep -sticky w
11881 -
11882 - label $page.linkfg -padx 40 -relief sunk -background $linkfgcolor
11883 - ttk::button $page.linkfgbut -text [mc "Link"] \
11884 - -command [list choosecolor linkfgcolor {} $page [mc "link"]]
11885 - grid x $page.linkfgbut $page.linkfg -sticky w
11835 +
11836 + set coloruielems [list \
11837 + bg bgcolor {} \
11838 + [mc "Background"] \
11839 + [mc "choose background color"] \
11840 + fg fgcolor {} \
11841 + [mc "Main text"] \
11842 + [mc "choose main text color"] \
11843 + selbg selectbgcolor {} \
11844 + [mc "Selected text background"] \
11845 + [mc "choose background color of selected text"] \
11846 + linkfg linkfgcolor {} \
11847 + [mc "Link text"] \
11848 + [mc "choose color of link text"] \
11849 + diffold diffcolors 0 \
11850 + [mc "Old line text"] \
11851 + [mc "choose text color of old lines"] \
11852 + diffoldbg diffbgcolors 0 \
11853 + [mc "Old line background"] \
11854 + [mc "choose background color of old lines"] \
11855 + diffnew diffcolors 1 \
11856 + [mc "New line text"] \
11857 + [mc "choose text color of new lines"] \
11858 + diffnewbg diffbgcolors 1 \
11859 + [mc "New line background"] \
11860 + [mc "choose background color of new lines"] \
11861 + hunksep diffcolors 2 \
11862 + [mc "Hunk header text"] \
11863 + [mc "choose text color of hunk headers"] \
11864 + markbg markbgcolor {} \
11865 + [mc "Marked line background"] \
11866 + [mc "choose background color of marked lines"] \
11867 + ]
11868 +
11869 + foreach {uielem colorvar idx label title} $coloruielems {
11870 + ttk::label $page.$uielem -text $label
11871 + button $page.${uielem}btn -padx 40 -pady 0 -borderwidth 2 \
11872 + -command [list choosecolor $colorvar $idx $page $title]
11873 + grid x $page.$uielem $page.${uielem}btn -sticky w -pady 1
11874 + }
11886 11875
11887 11876 grid columnconfigure $page 2 -weight 1
11877 + prefspage_set_colorswatches $page
11888 11878
11889 11879 return $page
11890 11880 }
11891 11881
11892 11882 proc prefspage_set_colorswatches {page} {
11893 - global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
11883 + global bgcolor fgcolor diffcolors selectbgcolor markbgcolor
11894 11884 global diffbgcolors linkfgcolor
11895 11885
11896 - $page.bg configure -background $bgcolor
11897 - $page.fg configure -background $fgcolor
11898 - $page.diffold configure -background [lindex $diffcolors 0]
11899 - $page.diffoldbg configure -background [lindex $diffbgcolors 0]
11900 - $page.diffnew configure -background [lindex $diffcolors 1]
11901 - $page.diffnewbg configure -background [lindex $diffbgcolors 1]
11902 - $page.hunksep configure -background [lindex $diffcolors 2]
11903 - $page.markbgsep configure -background $markbgcolor
11904 - $page.selbgsep configure -background $selectbgcolor
11905 - $page.linkfg configure -background $linkfgcolor
11886 + set coloruielems [list \
11887 + bg $bgcolor \
11888 + fg $fgcolor \
11889 + diffold [lindex $diffcolors 0] \
11890 + diffoldbg [lindex $diffbgcolors 0] \
11891 + diffnew [lindex $diffcolors 1] \
11892 + diffnewbg [lindex $diffbgcolors 1] \
11893 + hunksep [lindex $diffcolors 2] \
11894 + markbg $markbgcolor \
11895 + selbg $selectbgcolor \
11896 + linkfg $linkfgcolor \
11897 + ]
11898 + foreach {uielem color} $coloruielems {
11899 + $page.${uielem}btn configure -background $color -activebackground $color
11900 + }
11906 11901 }
11907 11902
11908 11903 proc prefspage_fonts {notebook} {
@@ -12019,11 +12014,11 @@ proc choose_themeloader {prefspage} {
12019 12014 }
12020 12015 }
12021 12016
12022 - proc choosecolor {v vi prefspage x} {
12017 + proc choosecolor {v vi prefspage title} {
12023 12018 global $v
12024 12019
12025 12020 set c [tk_chooseColor -initialcolor [lindex [set $v] $vi] \
12026 - -title [mc "Gitk: choose color for %s" $x]]
12021 + -title "Gitk: $title"]
12027 12022 if {$c eq {}} return
12028 12023 lset $v $vi $c
12029 12024 set_gui_colors
modified meson.build
@@ -1318,7 +1318,6 @@ elif host_machine.system() == 'windows'
1318 1318
1319 1319 libgit_c_args += [
1320 1320 '-DDETECT_MSYS_TTY',
1321 - '-DENSURE_MSYSTEM_IS_SET',
1322 1321 '-DNATIVE_CRLF',
1323 1322 '-DNOGDI',
1324 1323 '-DNO_POSIX_GOODIES',
@@ -1328,6 +1327,20 @@ elif host_machine.system() == 'windows'
1328 1327 '-D__USE_MINGW_ANSI_STDIO=0',
1329 1328 ]
1330 1329
1330 + msystem = get_option('msystem')
1331 + if msystem != ''
1332 + mingw_prefix = get_option('mingw_prefix')
1333 + if mingw_prefix == ''
1334 + mingw_prefix = msystem.to_lower()
1335 + elif mingw_prefix.startswith('/')
1336 + mingw_prefix = mingw_prefix.substring(1)
1337 + endif
1338 + libgit_c_args += [
1339 + '-DENSURE_MSYSTEM_IS_SET="' + msystem + '"',
1340 + '-DMINGW_PREFIX="' + mingw_prefix + '"'
1341 + ]
1342 + endif
1343 +
1331 1344 libgit_dependencies += compiler.find_library('ntdll')
1332 1345 libgit_include_directories += 'compat/win32'
1333 1346 if compiler.get_id() == 'msvc'
modified meson_options.txt
@@ -21,6 +21,10 @@ option('runtime_prefix', type: 'boolean', value: false,
21 21 description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
22 22 option('sane_tool_path', type: 'array', value: [],
23 23 description: 'An array of paths to pick up tools from in case the normal tools are broken or lacking.')
24 + option('msystem', type: 'string', value: '',
25 + description: 'Fall-back on Windows when MSYSTEM is not set.')
26 + option('mingw_prefix', type: 'string', value: '',
27 + description: 'Fall-back on Windows when MINGW_PREFIX is not set.')
24 28
25 29 # Build information compiled into Git and other parts like documentation.
26 30 option('build_date', type: 'string', value: '',
modified midx.c
@@ -589,23 +589,23 @@ uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos)
589 589 (off_t)pos * MIDX_CHUNK_OFFSET_WIDTH);
590 590 }
591 591
592 - int fill_midx_entry(struct multi_pack_index *m,
593 - const struct object_id *oid,
594 - struct pack_entry *e,
595 - struct packed_git **bad_pack)
592 + enum midx_fill_result midx_fill_entry(struct multi_pack_index *m,
593 + const struct object_id *oid,
594 + struct pack_entry *e,
595 + struct packed_git **bad_pack)
596 596 {
597 597 uint32_t pos;
598 598 uint32_t pack_int_id;
599 599 struct packed_git *p;
600 600
601 601 if (!bsearch_midx(oid, m, &pos))
602 - return 0;
602 + return MIDX_FILL_MISS;
603 603
604 604 midx_for_object(&m, pos);
605 605 pack_int_id = nth_midxed_pack_int_id(m, pos);
606 606
607 607 if (prepare_midx_pack(m, pack_int_id))
608 - return 0;
608 + return MIDX_FILL_OWNER_UNAVAILABLE;
609 609 p = m->packs[pack_int_id - m->num_packs_in_base];
610 610
611 611 /*
@@ -616,19 +616,19 @@ int fill_midx_entry(struct multi_pack_index *m,
616 616 * loaded!
617 617 */
618 618 if (!is_pack_valid(p))
619 - return 0;
619 + return MIDX_FILL_OWNER_UNAVAILABLE;
620 620
621 621 if (oidset_size(&p->bad_objects) &&
622 622 oidset_contains(&p->bad_objects, oid)) {
623 623 if (bad_pack && !*bad_pack)
624 624 *bad_pack = p;
625 - return 0;
625 + return MIDX_FILL_MISS;
626 626 }
627 627
628 628 e->offset = nth_midxed_offset(m, pos);
629 629 e->p = p;
630 630
631 - return 1;
631 + return MIDX_FILL_HIT;
632 632 }
633 633
634 634 /* Match "foo.idx" against either "foo.pack" _or_ "foo.idx". */
@@ -1032,7 +1032,7 @@ int verify_midx_file(struct odb_source_packed *source, unsigned flags)
1032 1032
1033 1033 nth_midxed_object_oid(&oid, m, pairs[i].pos);
1034 1034
1035 - if (!fill_midx_entry(m, &oid, &e, NULL)) {
1035 + if (midx_fill_entry(m, &oid, &e, NULL) != MIDX_FILL_HIT) {
1036 1036 midx_report(_("failed to load pack entry for oid[%d] = %s"),
1037 1037 pairs[i].pos, oid_to_hex(&oid));
1038 1038 continue;
modified midx.h
@@ -117,8 +117,25 @@ uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos);
117 117 struct object_id *nth_midxed_object_oid(struct object_id *oid,
118 118 struct multi_pack_index *m,
119 119 uint32_t n);
120 - int fill_midx_entry(struct multi_pack_index *m, const struct object_id *oid,
121 - struct pack_entry *e, struct packed_git **bad_pack);
120 + /*
121 + * Result of looking an object up in a multi-pack-index. MIDX_FILL_HIT means
122 + * "e was filled in"; the two miss variants distinguish an object the midx does
123 + * not know about (MIDX_FILL_MISS) from one it does know about but whose owning
124 + * pack we can no longer open (MIDX_FILL_OWNER_UNAVAILABLE -- the signature of a
125 + * concurrent repack having removed that pack). A known-bad (corrupt) object
126 + * reports MIDX_FILL_MISS but also sets *bad_pack, if provided, to the owning
127 + * pack so the caller can tell "corrupt" apart from "absent".
128 + */
129 + enum midx_fill_result {
130 + MIDX_FILL_MISS = 0,
131 + MIDX_FILL_HIT,
132 + MIDX_FILL_OWNER_UNAVAILABLE,
133 + };
134 +
135 + enum midx_fill_result midx_fill_entry(struct multi_pack_index *m,
136 + const struct object_id *oid,
137 + struct pack_entry *e,
138 + struct packed_git **bad_pack);
122 139 int midx_contains_pack(struct multi_pack_index *m,
123 140 const char *idx_or_pack_name);
124 141 int midx_layer_contains_pack(struct multi_pack_index *m,
modified odb/source-packed.c
@@ -17,13 +17,18 @@
17 17 static int find_pack_entry(struct odb_source_packed *store,
18 18 const struct object_id *oid,
19 19 struct pack_entry *e,
20 + enum object_info_flags flags,
20 21 struct packed_git **bad_pack)
21 22 {
22 23 struct packfile_list_entry *l;
24 + enum midx_fill_result midx_result = MIDX_FILL_MISS;
23 25
24 26 odb_source_prepare(&store->base, 0);
25 - if (store->midx && fill_midx_entry(store->midx, oid, e, bad_pack))
26 - return 1;
27 + if (store->midx) {
28 + midx_result = midx_fill_entry(store->midx, oid, e, bad_pack);
29 + if (midx_result == MIDX_FILL_HIT)
30 + return 1;
31 + }
27 32
28 33 for (l = store->packs.head; l; l = l->next) {
29 34 struct packed_git *p = l->pack;
@@ -35,6 +40,33 @@ static int find_pack_entry(struct odb_source_packed *store,
35 40 }
36 41 }
37 42
43 + /*
44 + * Recovery for a concurrent-repack race: a stale MIDX may still name a
45 + * vanished owning pack even though the object survives in another pack
46 + * the same MIDX covers. The regular fallback above skips MIDX-covered
47 + * packs, and repreparing the on-disk pack set does not reload the
48 + * borrowed, cached MIDX, so scan its packs directly for the survivor.
49 + *
50 + * Do this only on the second read, by which point repreparing packs has
51 + * already had a chance to find an object merely relocated into a new,
52 + * uncovered pack; only a genuine hidden duplicate reaches here.
53 + */
54 + if (midx_result == MIDX_FILL_OWNER_UNAVAILABLE &&
55 + (flags & OBJECT_INFO_SECOND_READ)) {
56 + struct multi_pack_index *m = store->midx;
57 + uint32_t i;
58 +
59 + for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) {
60 + struct packed_git *p;
61 +
62 + if (prepare_midx_pack(m, i))
63 + continue;
64 + p = nth_midxed_pack(m, i);
65 + if (p && packfile_fill_entry(p, oid, e, bad_pack))
66 + return 1;
67 + }
68 + }
69 +
38 70 return 0;
39 71 }
40 72
@@ -57,7 +89,7 @@ static enum odb_read_status odb_source_packed_read_object_info(struct odb_source
57 89 if (flags & OBJECT_INFO_SECOND_READ)
58 90 odb_source_prepare(source, ODB_PREPARE_FLUSH_CACHES);
59 91
60 - if (!find_pack_entry(packed, oid, &e, &bad_pack)) {
92 + if (!find_pack_entry(packed, oid, &e, flags, &bad_pack)) {
61 93 /*
62 94 * The lookup may have failed because the object is known to be
63 95 * corrupt in one of the packfiles. Report the object as
@@ -105,7 +137,7 @@ static int odb_source_packed_read_object_stream(struct odb_stream **out,
105 137 struct odb_source_packed *packed = odb_source_packed_downcast(source);
106 138 struct pack_entry e;
107 139
108 - if (!find_pack_entry(packed, oid, &e, NULL))
140 + if (!find_pack_entry(packed, oid, &e, 0, NULL))
109 141 return -1;
110 142
111 143 return packfile_read_object_stream(out, oid, e.p, e.offset);
@@ -611,7 +643,7 @@ static int odb_source_packed_freshen_object(struct odb_source *source,
611 643 timesp = &times;
612 644 }
613 645
614 - if (!find_pack_entry(packed, oid, &e, NULL))
646 + if (!find_pack_entry(packed, oid, &e, 0, NULL))
615 647 return 0;
616 648 if (e.p->is_cruft)
617 649 return 0;
modified replay.c
@@ -336,6 +336,13 @@ static struct commit *pick_regular_commit(struct repository *repo,
336 336 merge_opt->ancestor = NULL;
337 337 merge_opt->branch2 = NULL;
338 338
339 + if (result->clean < 0) {
340 + error(_("merge of %s onto %s failed"),
341 + oid_to_hex(&pickme->object.oid),
342 + oid_to_hex(&replayed_base->object.oid));
343 + return NULL;
344 + }
345 +
339 346 if (!result->clean)
340 347 return NULL;
341 348
modified t/helper/test-read-midx.c
@@ -82,7 +82,7 @@ static int read_midx_file(const char *object_dir, const char *checksum,
82 82 for (i = 0; i < m->num_objects; i++) {
83 83 nth_midxed_object_oid(&oid, m,
84 84 i + m->num_objects_in_base);
85 - fill_midx_entry(m, &oid, &e, NULL);
85 + midx_fill_entry(m, &oid, &e, NULL);
86 86
87 87 printf("%s %"PRIu64"\t%s\n",
88 88 oid_to_hex(&oid), e.offset, e.p->pack_name);
modified t/t0060-path-utils.sh
@@ -602,7 +602,8 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX wor
602 602 echo "echo HERE" | write_script pretend/libexec/git-core/git-here &&
603 603 GIT_EXEC_PATH= ./pretend/bin/git here >actual &&
604 604 echo HERE >expect &&
605 - test_cmp expect actual'
605 + test_cmp expect actual
606 + '
606 607
607 608 test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
608 609 git config yes.path "%(prefix)/yes" &&
@@ -611,4 +612,34 @@ test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works'
611 612 test_cmp expect actual
612 613 '
613 614
615 + test_expect_success MINGW,RUNTIME_PREFIX 'MSYSTEM/PATH is adjusted if necessary' '
616 + if test -z "$MINGW_PREFIX"
617 + then
618 + MINGW_PREFIX="/$(echo "${MSYSTEM:-MINGW64}" | tr A-Z a-z)"
619 + fi &&
620 + mkdir -p "$HOME"/bin pretend"$MINGW_PREFIX"/bin \
621 + pretend"$MINGW_PREFIX"/libexec/git-core pretend/usr/bin &&
622 + cp "$GIT_EXEC_PATH"/git.exe pretend"$MINGW_PREFIX"/bin/ &&
623 + cp "$GIT_EXEC_PATH"/git.exe pretend"$MINGW_PREFIX"/libexec/git-core/ &&
624 + # copy the .dll files, if any (happens when building via CMake)
625 + if test -n "$(ls "$GIT_EXEC_PATH"/*.dll 2>/dev/null)"
626 + then
627 + cp "$GIT_EXEC_PATH"/*.dll pretend"$MINGW_PREFIX"/bin/ &&
628 + cp "$GIT_EXEC_PATH"/*.dll pretend"$MINGW_PREFIX"/libexec/git-core/
629 + fi &&
630 + echo "env | grep MSYSTEM=" | write_script "$HOME"/bin/git-test-home &&
631 + echo "echo ${MINGW_PREFIX#/}" | write_script pretend"$MINGW_PREFIX"/bin/git-test-bin &&
632 + echo "echo usr" | write_script pretend/usr/bin/git-test-bin2 &&
633 +
634 + (
635 + MSYSTEM= &&
636 + GIT_EXEC_PATH= &&
637 + pretend"$MINGW_PREFIX"/libexec/git-core/git.exe test-home >actual &&
638 + pretend"$MINGW_PREFIX"/libexec/git-core/git.exe test-bin >>actual &&
639 + pretend"$MINGW_PREFIX"/bin/git.exe test-bin2 >>actual
640 + ) &&
641 + test_write_lines MSYSTEM=$MSYSTEM "${MINGW_PREFIX#/}" usr >expect &&
642 + test_cmp expect actual
643 + '
644 +
614 645 test_done
modified t/t1010-mktree.sh
@@ -69,4 +69,52 @@ test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
69 69 test_must_fail git mktree <all.withsub
70 70 '
71 71
72 + test_expect_success PIPE 'mktree --batch survives a concurrent repack retiring a pack' '
73 + test_when_finished "rm -fr race" &&
74 + git init race &&
75 + (
76 + cd race &&
77 + test_commit seed &&
78 + a=$(echo A | git hash-object -w --stdin) &&
79 + b=$(echo B | git hash-object -w --stdin) &&
80 + echo "$a" | git pack-objects .git/objects/pack/pack >pack-a &&
81 + echo "$b" | git pack-objects .git/objects/pack/pack >pack-b &&
82 +
83 + # Drop the loose copies so the blobs resolve only through the
84 + # packs the multi-pack-index names.
85 + git prune-packed &&
86 + git multi-pack-index write &&
87 + printf "100644 blob %s\ta\n" "$a" >tree-a &&
88 + printf "100644 blob %s\tb\n" "$b" >tree-b &&
89 +
90 + victim=".git/objects/pack/pack-$(cat pack-b)" &&
91 + mkfifo in out &&
92 +
93 + # mktree --batch stays resident, so its pack view predates the
94 + # repack below; feed it one tree at a time over a fifo. The
95 + # subshell exit closes the fifos, letting mktree see EOF and quit.
96 + (git mktree --batch <in >out 2>err &) &&
97 + exec 9>in &&
98 + exec 8<out &&
99 +
100 + # The first tree makes the reader cache its (soon stale) view.
101 + cat tree-a >&9 && echo >&9 && read tree_a <&8 &&
102 +
103 + # Mimic a concurrent repack: a replacement pack holds every
104 + # object, and the pack for b loses its .idx (its .pack lingers),
105 + # matching the order in which unlink_pack_path() removes files.
106 + git cat-file --batch-all-objects --batch-check="%(objectname)" >oids &&
107 + git pack-objects .git/objects/pack/pack <oids >/dev/null &&
108 + rm -f "$victim.idx" &&
109 +
110 + # Resolving b used to fail, as its QUICK lookup accepted the
111 + # miss; without QUICK the reader repreps and finds b in the
112 + # replacement pack.
113 + cat tree-b >&9 && echo >&9 && read tree_b <&8 &&
114 + exec 9>&- &&
115 +
116 + test -n "$tree_b"
117 + )
118 + '
119 +
72 120 test_done
modified t/t3650-replay-basics.sh
@@ -672,4 +672,38 @@ test_expect_success 'replay --revert with --linearize reverts a range containing
672 672 test_must_fail git cat-file -e $tip:Y.t
673 673 '
674 674
675 + test_expect_success 'replay fails without segfault when objects are missing' '
676 + test_when_finished "rm -fr unreadable" &&
677 + git init unreadable &&
678 + (
679 + cd unreadable &&
680 +
681 + test_write_lines l1 l2 l3 l4 l5 l6 l7 l8 >f &&
682 + git add f &&
683 + git commit -m base &&
684 + git branch base &&
685 +
686 + test_write_lines l1 l2 l3 l4 l5 l6 l7 CHANGED >f &&
687 + git commit -am side &&
688 + git branch side &&
689 +
690 + git switch -c onto base &&
691 + test_write_lines CHANGED l2 l3 l4 l5 l6 l7 l8 >f &&
692 + git commit -am onto &&
693 +
694 + # The replay works while every object is readable.
695 + git replay --onto onto base..side &&
696 +
697 + # Removing the onto tree makes parse_tree() fail during the
698 + # incore merge, driving clean < 0 with a NULL result tree.
699 + onto_tree=$(git rev-parse onto^{tree}) &&
700 + obj=$(test_oid_to_path "$onto_tree") &&
701 + mv .git/objects/${obj} saved-tree &&
702 +
703 + # Ensure replay gracefully handles the missing object
704 + test_must_fail git replay --onto onto base..side 2>err &&
705 + test_grep -e "Could not read" -e "collecting merge info failed" err
706 + )
707 + '
708 +
675 709 test_done
modified t/t5319-multi-pack-index.sh
@@ -1393,4 +1393,44 @@ test_expect_success 'pack.preferBitmapTips interprets patterns as hierarchy' '
1393 1393 )
1394 1394 '
1395 1395
1396 + test_expect_success 'lookup recovers object whose midx-owning pack was removed' '
1397 + test_when_finished "rm -fr repo" &&
1398 + git init repo &&
1399 + (
1400 + cd repo &&
1401 +
1402 + # "keep" ends up only in the big pack; "dup" is deliberately
1403 + # placed in two packs so the midx has to choose an owner.
1404 + test_commit keep &&
1405 + echo duplicated-content >dup &&
1406 + git add dup &&
1407 + git commit -m dup &&
1408 + dup_oid=$(git rev-parse HEAD:dup) &&
1409 +
1410 + # Roll every object, including dup, into a single big pack.
1411 + git repack -adq &&
1412 +
1413 + # Build a second, "moderate" pack that also contains dup, so dup
1414 + # now lives in two packs that the midx will cover.
1415 + moderate=$(echo "$dup_oid" |
1416 + git pack-objects --quiet $objdir/pack/pack) &&
1417 +
1418 + # Attribute dup to the moderate pack in the midx.
1419 + git multi-pack-index write \
1420 + --preferred-pack="pack-$moderate.idx" &&
1421 +
1422 + # Simulate a concurrent "git repack" retiring the moderate pack:
1423 + # its files disappear, but the now-stale midx still names it as
1424 + # the owner of dup. A valid copy of dup survives in the big pack.
1425 + rm -f $objdir/pack/pack-$moderate.* &&
1426 +
1427 + # The midx routes the lookup to the deleted pack, and the regular
1428 + # pack fallback skips midx-covered packs, so without recovery dup
1429 + # would appear missing even though it is physically present.
1430 + echo blob >expect &&
1431 + git cat-file -t "$dup_oid" >actual &&
1432 + test_cmp expect actual
1433 + )
1434 + '
1435 +
1396 1436 test_done