Skip to content

Commit 4b0faca

Browse files
authored
Prepare for v2.47.0.windows.2 (#5221)
At the moment, the Git maintainer is on vacation. While there _is_ an interim maintainer, it seems as if v2.47.1 will need to wait for "the end of the month". However, I do not have the luxury of waiting for the end of the month, as #5199 is stacking up comments relating various degrees of upset over the lack of a new Git for Windows version that fixes fetches/pushes via SSH. To make it truly worth the effort, let's integrate a couple of topics that have been integrated into upstream Git's `master` and `next` branches in the meantime, topics I consider important enough to be fast-tracked into a new Git for Windows version, since we already have the need for one: - 53d9f27 Merge branch 'jh/config-unset-doc-fix' Fixes incorrect documentation - a89881e Merge branch 'js/doc-platform-support-link-fix' Fixes broken links in the documentation - 784986f Merge branch 'jk/fsmonitor-event-listener-race-fix' CI-only: fixes 6h timeouts in the `osx-*` jobs - 59bf8d2 Merge branch 'ps/cache-tree-w-broken-index-entry' into next Fixes segmentation faults e.g. after a checkout failed due to invalid filenames and there is now a half-valid Git index - ffd5653 Merge branch 'pb/clar-build-fix' into next I suspect that this might cause some flakiness in (parallel) CI builds, even if I have not personally noticed those flakes. - fe0f4bc Merge branch 'db/submodule-fetch-with-remote-name-fix' into next Seems like a bug fix submodule users might want - 6860bff Merge branch 'sk/msvc-warnings' into next This _should_ only affect builds with MS Visual C (which Git for Windows does not use for the official builds), it's still a good idea to do, if only to align with upstream Git's code.
2 parents 6b6f8e4 + a306a68 commit 4b0faca

21 files changed

+249
-78
lines changed

Documentation/git-config.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SYNOPSIS
1212
'git config list' [<file-option>] [<display-option>] [--includes]
1313
'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>
1414
'git config set' [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>
15-
'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> <value>
15+
'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>
1616
'git config rename-section' [<file-option>] <old-name> <new-name>
1717
'git config remove-section' [<file-option>] <name>
1818
'git config edit' [<file-option>]

Documentation/technical/platform-support.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ will be fixed in a later release:
4949
notice problems before they are considered "done with review"; whereas
5050
watching `master` means the stable branch could break for your platform, but
5151
you have a decent chance of avoiding a tagged release breaking you. See "The
52-
Policy" in link:../howto/maintain-git.txt["How to maintain Git"] for an
52+
Policy" in link:../howto/maintain-git.html["How to maintain Git"] for an
5353
overview of which branches are used in the Git project, and how.
5454

5555
* The bug report should include information about what platform you are using.
@@ -125,7 +125,7 @@ Compatible on `next`
125125

126126
To avoid reactive debugging and fixing when changes hit a release or stable, you
127127
can aim to ensure `next` always works for your platform. (See "The Policy" in
128-
link:../howto/maintain-git.txt["How to maintain Git"] for an overview of how
128+
link:../howto/maintain-git.html["How to maintain Git"] for an overview of how
129129
`next` is used in the Git project.) To do that:
130130

131131
* You should add a runner for your platform to the GitHub Actions or GitLab CI

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,7 @@ $(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUI
39753975
done >$@
39763976
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
39773977
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
3978+
$(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite
39783979
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
39793980
$(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)
39803981
$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS

builtin/config.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static const char *const builtin_config_usage[] = {
1919
N_("git config list [<file-option>] [<display-option>] [--includes]"),
2020
N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>"),
2121
N_("git config set [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>"),
22-
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> <value>"),
22+
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>"),
2323
N_("git config rename-section [<file-option>] <old-name> <new-name>"),
2424
N_("git config remove-section [<file-option>] <name>"),
2525
N_("git config edit [<file-option>]"),
@@ -43,7 +43,7 @@ static const char *const builtin_config_set_usage[] = {
4343
};
4444

4545
static const char *const builtin_config_unset_usage[] = {
46-
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> <value>"),
46+
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>"),
4747
NULL
4848
};
4949

builtin/fsmonitor--daemon.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,9 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
12081208
* system event listener thread so that we have the IPC handle
12091209
* before we need it.
12101210
*/
1211-
if (ipc_server_run_async(&state->ipc_server_data,
1212-
state->path_ipc.buf, &ipc_opts,
1213-
handle_client, state))
1211+
if (ipc_server_init_async(&state->ipc_server_data,
1212+
state->path_ipc.buf, &ipc_opts,
1213+
handle_client, state))
12141214
return error_errno(
12151215
_("could not start IPC thread pool on '%s'"),
12161216
state->path_ipc.buf);

builtin/submodule--helper.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,14 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet,
23332333
strvec_pushf(&cp.args, "--depth=%d", depth);
23342334
if (oid) {
23352335
char *hex = oid_to_hex(oid);
2336-
char *remote = get_default_remote();
2336+
char *remote;
2337+
int code;
2338+
2339+
code = get_default_remote_submodule(module_path, &remote);
2340+
if (code) {
2341+
child_process_clear(&cp);
2342+
return code;
2343+
}
23372344

23382345
strvec_pushl(&cp.args, remote, hex, NULL);
23392346
free(remote);

cache-tree.c

+73-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define USE_THE_REPOSITORY_VARIABLE
22

33
#include "git-compat-util.h"
4+
#include "gettext.h"
45
#include "hex.h"
56
#include "lockfile.h"
67
#include "tree.h"
@@ -865,15 +866,15 @@ int cache_tree_matches_traversal(struct cache_tree *root,
865866
return 0;
866867
}
867868

868-
static void verify_one_sparse(struct index_state *istate,
869-
struct strbuf *path,
870-
int pos)
869+
static int verify_one_sparse(struct index_state *istate,
870+
struct strbuf *path,
871+
int pos)
871872
{
872873
struct cache_entry *ce = istate->cache[pos];
873-
874874
if (!S_ISSPARSEDIR(ce->ce_mode))
875-
BUG("directory '%s' is present in index, but not sparse",
876-
path->buf);
875+
return error(_("directory '%s' is present in index, but not sparse"),
876+
path->buf);
877+
return 0;
877878
}
878879

879880
/*
@@ -882,6 +883,7 @@ static void verify_one_sparse(struct index_state *istate,
882883
* 1 - Restart verification - a call to ensure_full_index() freed the cache
883884
* tree that is being verified and verification needs to be restarted from
884885
* the new toplevel cache tree.
886+
* -1 - Verification failed.
885887
*/
886888
static int verify_one(struct repository *r,
887889
struct index_state *istate,
@@ -891,18 +893,23 @@ static int verify_one(struct repository *r,
891893
int i, pos, len = path->len;
892894
struct strbuf tree_buf = STRBUF_INIT;
893895
struct object_id new_oid;
896+
int ret;
894897

895898
for (i = 0; i < it->subtree_nr; i++) {
896899
strbuf_addf(path, "%s/", it->down[i]->name);
897-
if (verify_one(r, istate, it->down[i]->cache_tree, path))
898-
return 1;
900+
ret = verify_one(r, istate, it->down[i]->cache_tree, path);
901+
if (ret)
902+
goto out;
903+
899904
strbuf_setlen(path, len);
900905
}
901906

902907
if (it->entry_count < 0 ||
903908
/* no verification on tests (t7003) that replace trees */
904-
lookup_replace_object(r, &it->oid) != &it->oid)
905-
return 0;
909+
lookup_replace_object(r, &it->oid) != &it->oid) {
910+
ret = 0;
911+
goto out;
912+
}
906913

907914
if (path->len) {
908915
/*
@@ -912,19 +919,26 @@ static int verify_one(struct repository *r,
912919
*/
913920
int is_sparse = istate->sparse_index;
914921
pos = index_name_pos(istate, path->buf, path->len);
915-
if (is_sparse && !istate->sparse_index)
916-
return 1;
922+
if (is_sparse && !istate->sparse_index) {
923+
ret = 1;
924+
goto out;
925+
}
917926

918927
if (pos >= 0) {
919-
verify_one_sparse(istate, path, pos);
920-
return 0;
928+
ret = verify_one_sparse(istate, path, pos);
929+
goto out;
921930
}
922931

923932
pos = -pos - 1;
924933
} else {
925934
pos = 0;
926935
}
927936

937+
if (it->entry_count + pos > istate->cache_nr) {
938+
ret = error(_("corrupted cache-tree has entries not present in index"));
939+
goto out;
940+
}
941+
928942
i = 0;
929943
while (i < it->entry_count) {
930944
struct cache_entry *ce = istate->cache[pos + i];
@@ -935,16 +949,23 @@ static int verify_one(struct repository *r,
935949
unsigned mode;
936950
int entlen;
937951

938-
if (ce->ce_flags & (CE_STAGEMASK | CE_INTENT_TO_ADD | CE_REMOVE))
939-
BUG("%s with flags 0x%x should not be in cache-tree",
940-
ce->name, ce->ce_flags);
952+
if (ce->ce_flags & (CE_STAGEMASK | CE_INTENT_TO_ADD | CE_REMOVE)) {
953+
ret = error(_("%s with flags 0x%x should not be in cache-tree"),
954+
ce->name, ce->ce_flags);
955+
goto out;
956+
}
957+
941958
name = ce->name + path->len;
942959
slash = strchr(name, '/');
943960
if (slash) {
944961
entlen = slash - name;
962+
945963
sub = find_subtree(it, ce->name + path->len, entlen, 0);
946-
if (!sub || sub->cache_tree->entry_count < 0)
947-
BUG("bad subtree '%.*s'", entlen, name);
964+
if (!sub || sub->cache_tree->entry_count < 0) {
965+
ret = error(_("bad subtree '%.*s'"), entlen, name);
966+
goto out;
967+
}
968+
948969
oid = &sub->cache_tree->oid;
949970
mode = S_IFDIR;
950971
i += sub->cache_tree->entry_count;
@@ -957,27 +978,50 @@ static int verify_one(struct repository *r,
957978
strbuf_addf(&tree_buf, "%o %.*s%c", mode, entlen, name, '\0');
958979
strbuf_add(&tree_buf, oid->hash, r->hash_algo->rawsz);
959980
}
981+
960982
hash_object_file(r->hash_algo, tree_buf.buf, tree_buf.len, OBJ_TREE,
961983
&new_oid);
962-
if (!oideq(&new_oid, &it->oid))
963-
BUG("cache-tree for path %.*s does not match. "
964-
"Expected %s got %s", len, path->buf,
965-
oid_to_hex(&new_oid), oid_to_hex(&it->oid));
984+
985+
if (!oideq(&new_oid, &it->oid)) {
986+
ret = error(_("cache-tree for path %.*s does not match. "
987+
"Expected %s got %s"), len, path->buf,
988+
oid_to_hex(&new_oid), oid_to_hex(&it->oid));
989+
goto out;
990+
}
991+
992+
ret = 0;
993+
out:
966994
strbuf_setlen(path, len);
967995
strbuf_release(&tree_buf);
968-
return 0;
996+
return ret;
969997
}
970998

971-
void cache_tree_verify(struct repository *r, struct index_state *istate)
999+
int cache_tree_verify(struct repository *r, struct index_state *istate)
9721000
{
9731001
struct strbuf path = STRBUF_INIT;
1002+
int ret;
9741003

975-
if (!istate->cache_tree)
976-
return;
977-
if (verify_one(r, istate, istate->cache_tree, &path)) {
1004+
if (!istate->cache_tree) {
1005+
ret = 0;
1006+
goto out;
1007+
}
1008+
1009+
ret = verify_one(r, istate, istate->cache_tree, &path);
1010+
if (ret < 0)
1011+
goto out;
1012+
if (ret > 0) {
9781013
strbuf_reset(&path);
979-
if (verify_one(r, istate, istate->cache_tree, &path))
1014+
1015+
ret = verify_one(r, istate, istate->cache_tree, &path);
1016+
if (ret < 0)
1017+
goto out;
1018+
if (ret > 0)
9801019
BUG("ensure_full_index() called twice while verifying cache tree");
9811020
}
1021+
1022+
ret = 0;
1023+
1024+
out:
9821025
strbuf_release(&path);
1026+
return ret;
9831027
}

cache-tree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
3333

3434
int cache_tree_fully_valid(struct cache_tree *);
3535
int cache_tree_update(struct index_state *, int);
36-
void cache_tree_verify(struct repository *, struct index_state *);
36+
int cache_tree_verify(struct repository *, struct index_state *);
3737

3838
/* bitmasks to write_index_as_tree flags */
3939
#define WRITE_TREE_MISSING_OK 1

compat/compiler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
static inline void get_compiler_info(struct strbuf *info)
1111
{
12-
int len = info->len;
12+
size_t len = info->len;
1313
#ifdef __clang__
1414
strbuf_addf(info, "clang: %s\n", __clang_version__);
1515
#elif defined(__GNUC__)
@@ -27,7 +27,7 @@ static inline void get_compiler_info(struct strbuf *info)
2727

2828
static inline void get_libc_info(struct strbuf *info)
2929
{
30-
int len = info->len;
30+
size_t len = info->len;
3131

3232
#ifdef __GLIBC__
3333
strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());

compat/fsmonitor/fsm-listen-darwin.c

+6
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
516516
}
517517
data->stream_started = 1;
518518

519+
/*
520+
* Our fs event listener is now running, so it's safe to start
521+
* serving client requests.
522+
*/
523+
ipc_server_start_async(state->ipc_server_data);
524+
519525
pthread_mutex_lock(&data->dq_lock);
520526
pthread_cond_wait(&data->dq_finished, &data->dq_lock);
521527
pthread_mutex_unlock(&data->dq_lock);

compat/fsmonitor/fsm-listen-win32.c

+6
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,12 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
741741
start_rdcw_watch(data->watch_gitdir) == -1)
742742
goto force_error_stop;
743743

744+
/*
745+
* Now that we've established the rdcw watches, we can start
746+
* serving clients.
747+
*/
748+
ipc_server_start_async(state->ipc_server_data);
749+
744750
for (;;) {
745751
dwWait = WaitForMultipleObjects(data->nr_listener_handles,
746752
data->hListener,

0 commit comments

Comments
 (0)