Skip to content

Commit

Permalink
Prepare for v2.47.0.windows.2 (#5221)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dscho authored Oct 22, 2024
2 parents 6b6f8e4 + a306a68 commit 4b0faca
Show file tree
Hide file tree
Showing 21 changed files with 249 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Documentation/git-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SYNOPSIS
'git config list' [<file-option>] [<display-option>] [--includes]
'git config get' [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>
'git config set' [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>
'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> <value>
'git config unset' [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>
'git config rename-section' [<file-option>] <old-name> <new-name>
'git config remove-section' [<file-option>] <name>
'git config edit' [<file-option>]
Expand Down
4 changes: 2 additions & 2 deletions Documentation/technical/platform-support.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ will be fixed in a later release:
notice problems before they are considered "done with review"; whereas
watching `master` means the stable branch could break for your platform, but
you have a decent chance of avoiding a tagged release breaking you. See "The
Policy" in link:../howto/maintain-git.txt["How to maintain Git"] for an
Policy" in link:../howto/maintain-git.html["How to maintain Git"] for an
overview of which branches are used in the Git project, and how.

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

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

* You should add a runner for your platform to the GitHub Actions or GitLab CI
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3975,6 +3975,7 @@ $(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUI
done >$@
$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h
$(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite
$(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite
$(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h
$(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR)
$(CLAR_TEST_PROG): $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS) $(GITLIBS) GIT-LDFLAGS
Expand Down
4 changes: 2 additions & 2 deletions builtin/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static const char *const builtin_config_usage[] = {
N_("git config list [<file-option>] [<display-option>] [--includes]"),
N_("git config get [<file-option>] [<display-option>] [--includes] [--all] [--regexp] [--value=<value>] [--fixed-value] [--default=<default>] <name>"),
N_("git config set [<file-option>] [--type=<type>] [--all] [--value=<value>] [--fixed-value] <name> <value>"),
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name> <value>"),
N_("git config unset [<file-option>] [--all] [--value=<value>] [--fixed-value] <name>"),
N_("git config rename-section [<file-option>] <old-name> <new-name>"),
N_("git config remove-section [<file-option>] <name>"),
N_("git config edit [<file-option>]"),
Expand All @@ -43,7 +43,7 @@ static const char *const builtin_config_set_usage[] = {
};

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

Expand Down
6 changes: 3 additions & 3 deletions builtin/fsmonitor--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,9 +1208,9 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
* system event listener thread so that we have the IPC handle
* before we need it.
*/
if (ipc_server_run_async(&state->ipc_server_data,
state->path_ipc.buf, &ipc_opts,
handle_client, state))
if (ipc_server_init_async(&state->ipc_server_data,
state->path_ipc.buf, &ipc_opts,
handle_client, state))
return error_errno(
_("could not start IPC thread pool on '%s'"),
state->path_ipc.buf);
Expand Down
9 changes: 8 additions & 1 deletion builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,14 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet,
strvec_pushf(&cp.args, "--depth=%d", depth);
if (oid) {
char *hex = oid_to_hex(oid);
char *remote = get_default_remote();
char *remote;
int code;

code = get_default_remote_submodule(module_path, &remote);
if (code) {
child_process_clear(&cp);
return code;
}

strvec_pushl(&cp.args, remote, hex, NULL);
free(remote);
Expand Down
102 changes: 73 additions & 29 deletions cache-tree.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "gettext.h"
#include "hex.h"
#include "lockfile.h"
#include "tree.h"
Expand Down Expand Up @@ -865,15 +866,15 @@ int cache_tree_matches_traversal(struct cache_tree *root,
return 0;
}

static void verify_one_sparse(struct index_state *istate,
struct strbuf *path,
int pos)
static int verify_one_sparse(struct index_state *istate,
struct strbuf *path,
int pos)
{
struct cache_entry *ce = istate->cache[pos];

if (!S_ISSPARSEDIR(ce->ce_mode))
BUG("directory '%s' is present in index, but not sparse",
path->buf);
return error(_("directory '%s' is present in index, but not sparse"),
path->buf);
return 0;
}

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

for (i = 0; i < it->subtree_nr; i++) {
strbuf_addf(path, "%s/", it->down[i]->name);
if (verify_one(r, istate, it->down[i]->cache_tree, path))
return 1;
ret = verify_one(r, istate, it->down[i]->cache_tree, path);
if (ret)
goto out;

strbuf_setlen(path, len);
}

if (it->entry_count < 0 ||
/* no verification on tests (t7003) that replace trees */
lookup_replace_object(r, &it->oid) != &it->oid)
return 0;
lookup_replace_object(r, &it->oid) != &it->oid) {
ret = 0;
goto out;
}

if (path->len) {
/*
Expand All @@ -912,19 +919,26 @@ static int verify_one(struct repository *r,
*/
int is_sparse = istate->sparse_index;
pos = index_name_pos(istate, path->buf, path->len);
if (is_sparse && !istate->sparse_index)
return 1;
if (is_sparse && !istate->sparse_index) {
ret = 1;
goto out;
}

if (pos >= 0) {
verify_one_sparse(istate, path, pos);
return 0;
ret = verify_one_sparse(istate, path, pos);
goto out;
}

pos = -pos - 1;
} else {
pos = 0;
}

if (it->entry_count + pos > istate->cache_nr) {
ret = error(_("corrupted cache-tree has entries not present in index"));
goto out;
}

i = 0;
while (i < it->entry_count) {
struct cache_entry *ce = istate->cache[pos + i];
Expand All @@ -935,16 +949,23 @@ static int verify_one(struct repository *r,
unsigned mode;
int entlen;

if (ce->ce_flags & (CE_STAGEMASK | CE_INTENT_TO_ADD | CE_REMOVE))
BUG("%s with flags 0x%x should not be in cache-tree",
ce->name, ce->ce_flags);
if (ce->ce_flags & (CE_STAGEMASK | CE_INTENT_TO_ADD | CE_REMOVE)) {
ret = error(_("%s with flags 0x%x should not be in cache-tree"),
ce->name, ce->ce_flags);
goto out;
}

name = ce->name + path->len;
slash = strchr(name, '/');
if (slash) {
entlen = slash - name;

sub = find_subtree(it, ce->name + path->len, entlen, 0);
if (!sub || sub->cache_tree->entry_count < 0)
BUG("bad subtree '%.*s'", entlen, name);
if (!sub || sub->cache_tree->entry_count < 0) {
ret = error(_("bad subtree '%.*s'"), entlen, name);
goto out;
}

oid = &sub->cache_tree->oid;
mode = S_IFDIR;
i += sub->cache_tree->entry_count;
Expand All @@ -957,27 +978,50 @@ static int verify_one(struct repository *r,
strbuf_addf(&tree_buf, "%o %.*s%c", mode, entlen, name, '\0');
strbuf_add(&tree_buf, oid->hash, r->hash_algo->rawsz);
}

hash_object_file(r->hash_algo, tree_buf.buf, tree_buf.len, OBJ_TREE,
&new_oid);
if (!oideq(&new_oid, &it->oid))
BUG("cache-tree for path %.*s does not match. "
"Expected %s got %s", len, path->buf,
oid_to_hex(&new_oid), oid_to_hex(&it->oid));

if (!oideq(&new_oid, &it->oid)) {
ret = error(_("cache-tree for path %.*s does not match. "
"Expected %s got %s"), len, path->buf,
oid_to_hex(&new_oid), oid_to_hex(&it->oid));
goto out;
}

ret = 0;
out:
strbuf_setlen(path, len);
strbuf_release(&tree_buf);
return 0;
return ret;
}

void cache_tree_verify(struct repository *r, struct index_state *istate)
int cache_tree_verify(struct repository *r, struct index_state *istate)
{
struct strbuf path = STRBUF_INIT;
int ret;

if (!istate->cache_tree)
return;
if (verify_one(r, istate, istate->cache_tree, &path)) {
if (!istate->cache_tree) {
ret = 0;
goto out;
}

ret = verify_one(r, istate, istate->cache_tree, &path);
if (ret < 0)
goto out;
if (ret > 0) {
strbuf_reset(&path);
if (verify_one(r, istate, istate->cache_tree, &path))

ret = verify_one(r, istate, istate->cache_tree, &path);
if (ret < 0)
goto out;
if (ret > 0)
BUG("ensure_full_index() called twice while verifying cache tree");
}

ret = 0;

out:
strbuf_release(&path);
return ret;
}
2 changes: 1 addition & 1 deletion cache-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);

int cache_tree_fully_valid(struct cache_tree *);
int cache_tree_update(struct index_state *, int);
void cache_tree_verify(struct repository *, struct index_state *);
int cache_tree_verify(struct repository *, struct index_state *);

/* bitmasks to write_index_as_tree flags */
#define WRITE_TREE_MISSING_OK 1
Expand Down
4 changes: 2 additions & 2 deletions compat/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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

static inline void get_libc_info(struct strbuf *info)
{
int len = info->len;
size_t len = info->len;

#ifdef __GLIBC__
strbuf_addf(info, "glibc: %s\n", gnu_get_libc_version());
Expand Down
6 changes: 6 additions & 0 deletions compat/fsmonitor/fsm-listen-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,12 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
}
data->stream_started = 1;

/*
* Our fs event listener is now running, so it's safe to start
* serving client requests.
*/
ipc_server_start_async(state->ipc_server_data);

pthread_mutex_lock(&data->dq_lock);
pthread_cond_wait(&data->dq_finished, &data->dq_lock);
pthread_mutex_unlock(&data->dq_lock);
Expand Down
6 changes: 6 additions & 0 deletions compat/fsmonitor/fsm-listen-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,12 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
start_rdcw_watch(data->watch_gitdir) == -1)
goto force_error_stop;

/*
* Now that we've established the rdcw watches, we can start
* serving clients.
*/
ipc_server_start_async(state->ipc_server_data);

for (;;) {
dwWait = WaitForMultipleObjects(data->nr_listener_handles,
data->hListener,
Expand Down
Loading

0 comments on commit 4b0faca

Please sign in to comment.