Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f62dcc7
remote: remove branch->merge_name and fix branch_release()
jacob-keller Jun 23, 2025
2084f11
remote: fix tear down of struct remote
jacob-keller Jun 23, 2025
059268f
dir: move starts_with_dot(_dot)_slash to dir.h
jacob-keller Jun 23, 2025
f854296
remote: remove the_repository from some functions
jacob-keller Jun 23, 2025
e759275
submodule--helper: improve logic for fallback remote name
jacob-keller Jun 23, 2025
fedfb07
submodule: move get_default_remote_submodule()
jacob-keller Jun 23, 2025
ca62f52
submodule: look up remotes by URL first
jacob-keller Jun 23, 2025
0c85622
daemon: remove unnecesary restriction for listener fd
carenas Jun 26, 2025
d1c4486
send-pack: clean up extra_have oid array
jacob-keller Jun 27, 2025
78b6601
daemon: correctly handle soft accept() errors in service_loop
carenas Jun 27, 2025
996f14c
doc: improve formatting in branch section
Jun 29, 2025
1e77de1
ci: update FreeBSD image to 14.3
carenas Jul 1, 2025
b0e9d25
send-pack: clean-up even when taking an early exit
gitster Jul 1, 2025
7310e53
Merge branch 'jk/submodule-remote-lookup-cleanup'
gitster Jul 7, 2025
0629460
Merge branch 'cb/daemon-fd-check-fix'
gitster Jul 7, 2025
d4a59c5
Merge branch 'jk/fix-leak-send-pack'
gitster Jul 7, 2025
8449119
Merge branch 'cb/daemon-retry-interrupted-accept'
gitster Jul 7, 2025
0dc5b76
Merge branch 'jj/doc-branch-markup-fix'
gitster Jul 7, 2025
649162c
Merge branch 'cb/ci-freebsd-update-to-14.3'
gitster Jul 7, 2025
41905d6
The seventh batch
gitster Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ freebsd_task:
env:
GIT_PROVE_OPTS: "--timer --jobs 10"
GIT_TEST_OPTS: "--no-chain-lint --no-bin-wrappers"
MAKEFLAGS: "-j4"
GIT_SKIP_TESTS: t7815.12
MAKEFLAGS: -j4
DEFAULT_TEST_TARGET: prove
DEFAULT_UNIT_TEST_TARGET: unit-tests-prove
DEVELOPER: 1
freebsd_instance:
image_family: freebsd-13-4
image_family: freebsd-14-3
memory: 2G
install_script:
pkg install -y gettext gmake perl5
Expand All @@ -19,4 +21,4 @@ freebsd_task:
build_script:
- su git -c gmake
test_script:
- su git -c 'gmake DEFAULT_UNIT_TEST_TARGET=unit-tests-prove test unit-tests'
- su git -c 'gmake test unit-tests'
16 changes: 16 additions & 0 deletions Documentation/RelNotes/2.51.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ UI, Workflows & Features

* Some error messages from "git imap-send" has been updated.

* When "git daemon" sees a signal while attempting to accept() a new
client, instead of retrying, it skipped it by mistake, which has
been corrected.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -100,6 +104,16 @@ Fixes since v2.50
as spatch can be built with different regexp engine X-<.
(merge f2ad545813 jc/cocci-avoid-regexp-constraint later to maint).

* Updating submodules from the upstream did not work well when
submodule's HEAD is detached, which has been improved.
(merge ca62f524c1 jk/submodule-remote-lookup-cleanup later to maint).

* Remove unnecessary check from "git daemon" code.
(merge 0c856224d2 cb/daemon-fd-check-fix later to maint).

* Leakfix.
(merge b0e9d25865 jk/fix-leak-send-pack later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge b257adb571 lo/my-first-ow-doc-update later to maint).
(merge 8b34b6a220 ly/sequencer-update-squash-is-fixup-only later to maint).
Expand All @@ -114,3 +128,5 @@ Fixes since v2.50
(merge 855cfc65ae rm/t2400-modernize later to maint).
(merge 2939494284 ly/run-builtin-use-passed-in-repo later to maint).
(merge ff73f375bb jg/mailinfo-leakfix later to maint).
(merge 996f14c02b jj/doc-branch-markup-fix later to maint).
(merge 1e77de1864 cb/ci-freebsd-update-to-14.3 later to maint).
4 changes: 2 additions & 2 deletions Documentation/config/branch.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ This option defaults to `never`.
`git fetch`) to lookup the default branch for merging. Without
this option, `git pull` defaults to merge the first refspec fetched.
Specify multiple values to get an octopus merge.
If you wish to setup `git pull` so that it merges into <name> from
If you wish to setup `git pull` so that it merges into _<name>_ from
another branch in the local repository, you can point
branch.<name>.merge to the desired branch, and use the relative path
`branch.<name>.merge` to the desired branch, and use the relative path
setting `.` (a period) for `branch.<name>.remote`.

`branch.<name>.mergeOptions`::
Expand Down
4 changes: 2 additions & 2 deletions branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ static int inherit_tracking(struct tracking *tracking, const char *orig_ref)
return -1;
}

if (branch->merge_nr < 1 || !branch->merge_name || !branch->merge_name[0]) {
if (branch->merge_nr < 1 || !branch->merge || !branch->merge[0] || !branch->merge[0]->src) {
warning(_("asked to inherit tracking from '%s', but no merge configuration is set"),
bare_ref);
return -1;
}

tracking->remote = branch->remote_name;
for (i = 0; i < branch->merge_nr; i++)
string_list_append(tracking->srcs, branch->merge_name[i]);
string_list_append(tracking->srcs, branch->merge[i]->src);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion builtin/pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
} else
fprintf_ln(stderr, _("Your configuration specifies to merge with the ref '%s'\n"
"from the remote, but no such ref was fetched."),
*curr_branch->merge_name);
curr_branch->merge[0]->src);
exit(1);
}

Expand Down
9 changes: 6 additions & 3 deletions builtin/send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ int cmd_send_pack(int argc,
flags |= MATCH_REFS_MIRROR;

/* match them up */
if (match_push_refs(local_refs, &remote_refs, &rs, flags))
return -1;

if (match_push_refs(local_refs, &remote_refs, &rs, flags)) {
ret = -1;
goto cleanup;
}
if (!is_empty_cas(&cas))
apply_push_cas(&cas, remote, remote_refs);

Expand Down Expand Up @@ -339,10 +340,12 @@ int cmd_send_pack(int argc,
/* stable plumbing output; do not modify or localize */
fprintf(stderr, "Everything up-to-date\n");

cleanup:
string_list_clear(&push_options, 0);
free_refs(remote_refs);
free_refs(local_refs);
refspec_clear(&rs);
oid_array_clear(&extra_have);
oid_array_clear(&shallow);
clear_cas_option(&cas);
return ret;
Expand Down
106 changes: 41 additions & 65 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,61 +41,9 @@
typedef void (*each_submodule_fn)(const struct cache_entry *list_item,
void *cb_data);

static int repo_get_default_remote(struct repository *repo, char **default_remote)
{
char *dest = NULL;
struct strbuf sb = STRBUF_INIT;
struct ref_store *store = get_main_ref_store(repo);
const char *refname = refs_resolve_ref_unsafe(store, "HEAD", 0, NULL,
NULL);

if (!refname)
return die_message(_("No such ref: %s"), "HEAD");

/* detached HEAD */
if (!strcmp(refname, "HEAD")) {
*default_remote = xstrdup("origin");
return 0;
}

if (!skip_prefix(refname, "refs/heads/", &refname))
return die_message(_("Expecting a full ref name, got %s"),
refname);

strbuf_addf(&sb, "branch.%s.remote", refname);
if (repo_config_get_string(repo, sb.buf, &dest))
*default_remote = xstrdup("origin");
else
*default_remote = dest;

strbuf_release(&sb);
return 0;
}

static int get_default_remote_submodule(const char *module_path, char **default_remote)
{
struct repository subrepo;
int ret;

if (repo_submodule_init(&subrepo, the_repository, module_path,
null_oid(the_hash_algo)) < 0)
return die_message(_("could not get a repository handle for submodule '%s'"),
module_path);
ret = repo_get_default_remote(&subrepo, default_remote);
repo_clear(&subrepo);

return ret;
}

static char *get_default_remote(void)
{
char *default_remote;
int code = repo_get_default_remote(the_repository, &default_remote);

if (code)
exit(code);

return default_remote;
return xstrdup(repo_default_remote(the_repository));
}

static char *resolve_relative_url(const char *rel_url, const char *up_path, int quiet)
Expand All @@ -122,6 +70,46 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
return resolved_url;
}

static int get_default_remote_submodule(const char *module_path, char **default_remote)
{
const struct submodule *sub;
struct repository subrepo;
const char *remote_name = NULL;
char *url = NULL;

sub = submodule_from_path(the_repository, null_oid(the_hash_algo), module_path);
if (sub && sub->url) {
url = xstrdup(sub->url);

/* Possibly a url relative to parent */
if (starts_with_dot_dot_slash(url) ||
starts_with_dot_slash(url)) {
char *oldurl = url;

url = resolve_relative_url(oldurl, NULL, 1);
free(oldurl);
}
}

if (repo_submodule_init(&subrepo, the_repository, module_path,
null_oid(the_hash_algo)) < 0)
return die_message(_("could not get a repository handle for submodule '%s'"),
module_path);

/* Look up by URL first */
if (url)
remote_name = repo_remote_from_url(&subrepo, url);
if (!remote_name)
remote_name = repo_default_remote(&subrepo);

*default_remote = xstrdup(remote_name);

repo_clear(&subrepo);
free(url);

return 0;
}

/* the result should be freed by the caller. */
static char *get_submodule_displaypath(const char *path, const char *prefix,
const char *super_prefix)
Expand Down Expand Up @@ -438,18 +426,6 @@ static int module_foreach(int argc, const char **argv, const char *prefix,
return ret;
}

static int starts_with_dot_slash(const char *const path)
{
return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_SLASH |
PATH_MATCH_XPLATFORM);
}

static int starts_with_dot_dot_slash(const char *const path)
{
return path_match_flags(path, PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH |
PATH_MATCH_XPLATFORM);
}

struct init_cb {
const char *prefix;
const char *super_prefix;
Expand Down
17 changes: 10 additions & 7 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,11 +990,6 @@ static int setup_named_sock(char *listen_addr, int listen_port, struct socketlis
sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sockfd < 0)
continue;
if (sockfd >= FD_SETSIZE) {
logerror("Socket descriptor too large");
close(sockfd);
continue;
}

#ifdef IPV6_V6ONLY
if (ai->ai_family == AF_INET6) {
Expand Down Expand Up @@ -1153,11 +1148,19 @@ static int service_loop(struct socketlist *socklist)
#endif
} ss;
socklen_t sslen = sizeof(ss);
int incoming = accept(pfd[i].fd, &ss.sa, &sslen);
int incoming;
int retry = 3;

redo:
incoming = accept(pfd[i].fd, &ss.sa, &sslen);
if (incoming < 0) {
switch (errno) {
case EAGAIN:
case EINTR:
if (--retry)
goto redo;

/* fallthrough */
case EAGAIN:
case ECONNABORTED:
continue;
default:
Expand Down
23 changes: 23 additions & 0 deletions dir.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,4 +676,27 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)
return path_match_flags(path, what | PATH_MATCH_NATIVE);
}

/**
* starts_with_dot_slash: convenience wrapper for
* patch_match_flags() with PATH_MATCH_STARTS_WITH_DOT_SLASH and
* PATH_MATCH_XPLATFORM.
*/
static inline int starts_with_dot_slash(const char *const path)
{
const enum path_match_flags what = PATH_MATCH_STARTS_WITH_DOT_SLASH;

return path_match_flags(path, what | PATH_MATCH_XPLATFORM);
}

/**
* starts_with_dot_dot_slash: convenience wrapper for
* patch_match_flags() with PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH and
* PATH_MATCH_XPLATFORM.
*/
static inline int starts_with_dot_dot_slash(const char *const path)
{
const enum path_match_flags what = PATH_MATCH_STARTS_WITH_DOT_DOT_SLASH;

return path_match_flags(path, what | PATH_MATCH_XPLATFORM);
}
#endif
Loading