Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c858c64
bundle-uri: copy all bundle references ino the refs/bundle space
schacon Apr 25, 2025
435b076
bundle-uri: add test for bundle-uri clones with tags
schacon Apr 25, 2025
8adee0c
send-mail: improve checks for valid_fqdn
AdityaGarg8 May 8, 2025
d6c63a7
docs: improve send-email documentation
AdityaGarg8 May 8, 2025
ba998f6
docs: add credential helper for outlook and gmail in OAuth list of he…
AdityaGarg8 May 8, 2025
7472721
sequencer: move reflog message functions
phillipwood May 9, 2025
5dbaec6
sequencer: rework reflog message handling
phillipwood May 9, 2025
880146a
Makefile: avoid constant rebuilds with compilation database
bk2204 May 9, 2025
c8e752e
reftable/writer: fix memory leak when `padded_write()` fails
brandb97 May 12, 2025
91db6c7
reftable/writer: fix memory leak when `writer_index_hash()` fails
brandb97 May 12, 2025
bac220e
t1001: replace 'test -f' with 'test_path_is_file'
rodrigorsdc May 10, 2025
e5dd0a0
builtin/am: fix memory leak in `split_mail_stgit_series`
brandb97 May 12, 2025
1970333
reftable: fix perf regression when reading blocks of unwanted type
pks-t May 12, 2025
2744646
oidmap: rename oidmap_free() to oidmap_clear()
peff May 12, 2025
5961847
oidmap: add size function
peff May 12, 2025
4b63963
raw_object_store: drop extra pointer to replace_map
peff May 12, 2025
0b8d22f
Merge branch 'pw/sequencer-reflog-use-after-free'
gitster May 19, 2025
4bb7254
Merge branch 'sc/bundle-uri-use-all-refs-in-bundle'
gitster May 19, 2025
ae0b60e
Merge branch 'ag/doc-send-email'
gitster May 19, 2025
effbd42
Merge branch 'bc/make-avoid-unneeded-rebuild-with-compdb-dir'
gitster May 19, 2025
6660b42
Merge branch 'ly/am-split-stgit-leakfix'
gitster May 19, 2025
9af978f
Merge branch 'rc/t1001-test-path-is-file'
gitster May 19, 2025
a9dcacb
Merge branch 'jk/oidmap-cleanup'
gitster May 19, 2025
2b33031
Merge branch 'ly/reftable-writer-leakfix'
gitster May 19, 2025
90eedab
Merge branch 'ps/reftable-read-block-perffix'
gitster May 19, 2025
8613c2b
The sixteenth batch
gitster May 19, 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
15 changes: 15 additions & 0 deletions Documentation/RelNotes/2.50.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ UI, Workflows & Features
* Make repository clean-up tasks "gc" can do available to "git
maintenance" front-end.

* Bundle-URI feature did not use refs recorded in the bundle other
than normal branches as anchoring points to optimize the follow-up
fetch during "git clone"; now it is told to utilize all.

* The `send-email` documentation has been updated with OAuth2.0
related examples.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -148,6 +155,8 @@ Performance, Internal Implementation, Development Support etc.

* Further code clean-up in the object-store layer.

* Build performance fix.


Fixes since v2.49
-----------------
Expand Down Expand Up @@ -294,6 +303,9 @@ Fixes since v2.49
derived systems use different errno, which has been worked around.
(merge f47bcc3413 cf/wrapper-bsd-eloop later to maint).

* Use-after-free fix in the sequencer.
(merge 5dbaec628d pw/sequencer-reflog-use-after-free later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 227c4f33a0 ja/doc-block-delimiter-markup-fix later to maint).
(merge 2bfd3b3685 ab/decorate-code-cleanup later to maint).
Expand Down Expand Up @@ -321,3 +333,6 @@ Fixes since v2.49
(merge 42cf4ac552 ps/ci-resurrect-p4-on-github later to maint).
(merge 104add8368 js/diff-codeql-false-positive-workaround later to maint).
(merge f62977b93c en/get-tree-entry-doc later to maint).
(merge e5dd0a05ed ly/am-split-stgit-leakfix later to maint).
(merge bac220e154 rc/t1001-test-path-is-file later to maint).
(merge 91db6c735d ly/reftable-writer-leakfix later to maint).
67 changes: 59 additions & 8 deletions Documentation/git-send-email.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,12 @@ include::includes/cmd-config-section-all.adoc[]

include::config/sendemail.adoc[]

EXAMPLES
--------
Use gmail as the smtp server
EXAMPLES OF SMTP SERVERS
------------------------
Use Gmail as the SMTP Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To use 'git send-email' to send your patches through the GMail SMTP server,
edit ~/.gitconfig to specify your account settings:
To use `git send-email` to send your patches through the Gmail SMTP server,
edit `~/.gitconfig` to specify your account settings:

----
[sendemail]
Expand All @@ -528,6 +528,41 @@ If you have multi-factor authentication set up on your Gmail account, you can
generate an app-specific password for use with 'git send-email'. Visit
https://security.google.com/settings/security/apppasswords to create it.

You can also use OAuth2.0 authentication with Gmail. `OAUTHBEARER` and
`XOAUTH2` are common methods used for this type of authentication. Gmail
supports both of them. As an example, if you want to use `OAUTHBEARER`, edit
your `~/.gitconfig` file and add `smtpAuth = OAUTHBEARER` to your account
settings:

----
[sendemail]
smtpEncryption = tls
smtpServer = smtp.gmail.com
smtpUser = yourname@gmail.com
smtpServerPort = 587
smtpAuth = OAUTHBEARER
----

Use Microsoft Outlook as the SMTP Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unlike Gmail, Microsoft Outlook no longer supports app-specific passwords.
Therefore, OAuth2.0 authentication must be used for Outlook. Also, it only
supports `XOAUTH2` authentication method.

Edit `~/.gitconfig` to specify your account settings for Outlook and use its
SMTP server with `git send-email`:

----
[sendemail]
smtpEncryption = tls
smtpServer = smtp.office365.com
smtpUser = yourname@outlook.com
smtpServerPort = 587
smtpAuth = XOAUTH2
----

SENDING PATCHES
---------------
Once your commits are ready to be sent to the mailing list, run the
following commands:

Expand All @@ -536,9 +571,25 @@ following commands:
$ git send-email outgoing/*

The first time you run it, you will be prompted for your credentials. Enter the
app-specific or your regular password as appropriate. If you have credential
helper configured (see linkgit:git-credential[1]), the password will be saved in
the credential store so you won't have to type it the next time.
app-specific or your regular password as appropriate.

If you have a credential helper configured (see linkgit:git-credential[1]), the
password will be saved in the credential store so you won't have to type it the
next time.

If you are using OAuth2.0 authentication, you need to use an access token in
place of a password when prompted. Various OAuth2.0 token generators are
available online. Community maintained credential helpers for Gmail and Outlook
are also available:

- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail]
(cross platform, dedicated helper for authenticating Gmail accounts)

- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook]
(cross platform, dedicated helper for authenticating Microsoft Outlook accounts)

You can also see linkgit:gitcredentials[7] for more OAuth based authentication
helpers.

Note: the following core Perl modules that may be installed with your
distribution of Perl are required:
Expand Down
4 changes: 4 additions & 0 deletions Documentation/gitcredentials.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ Popular helpers with OAuth support include:

- https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions)

- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] (cross platform, dedicated helper to authenticate Gmail accounts for linkgit:git-send-email[1])

- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook] (cross platform, dedicated helper to authenticate Microsoft Outlook accounts for linkgit:git-send-email[1])

CREDENTIAL CONTEXTS
-------------------

Expand Down
14 changes: 7 additions & 7 deletions Documentation/technical/bundle-uri.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ will interact with bundle URIs according to the following flow:
are present in the client repository. If some are missing, then the
client delays unbundling until other bundles have been unbundled,
making those OIDs present. When all required OIDs are present, the
client unbundles that data using a refspec. The default refspec is
`+refs/heads/*:refs/bundles/*`, but this can be configured. These refs
are stored so that later `git fetch` negotiations can communicate each
bundled ref as a `have`, reducing the size of the fetch over the Git
protocol. To allow pruning refs from this ref namespace, Git may
introduce a numbered namespace (such as `refs/bundles/<i>/*`) such that
stale bundle refs can be deleted.
client unbundles that data using a refspec. The refspec used is
`+refs/*:refs/bundles/*`. These refs are stored so that later
`git fetch` negotiations can communicate each bundled ref as a `have`,
reducing the size of the fetch over the Git protocol. To allow pruning
refs from this ref namespace, Git may introduce a numbered namespace
(such as `refs/bundles/<i>/*`) such that stale bundle refs can be
deleted.

3. If the file is instead a bundle list, then the client inspects the
`bundle.mode` to see if the list is of the `all` or `any` form.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,7 @@ endif
compdb_dir = compile_commands

ifeq ($(GENERATE_COMPILATION_DATABASE),yes)
missing_compdb_dir = $(compdb_dir)
missing_compdb_dir = $(filter-out $(wildcard $(compdb_dir)), $(compdb_dir))
$(missing_compdb_dir):
@mkdir -p $@

Expand Down
4 changes: 3 additions & 1 deletion builtin/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,10 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
series_dir = dirname(series_dir_buf);

fp = fopen(*paths, "r");
if (!fp)
if (!fp) {
free(series_dir_buf);
return error_errno(_("could not open '%s' for reading"), *paths);
}

while (!strbuf_getline_lf(&sb, fp)) {
if (*sb.buf == '#')
Expand Down
2 changes: 1 addition & 1 deletion builtin/rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ int cmd_rev_list(int argc,
free((void *)entry->path);
}

oidmap_free(&missing_objects, true);
oidmap_clear(&missing_objects, true);
}

stop_progress(&progress);
Expand Down
2 changes: 1 addition & 1 deletion bundle-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static int unbundle_from_file(struct repository *r, const char *file)
const char *branch_name;
int has_old;

if (!skip_prefix(refname->string, "refs/heads/", &branch_name))
if (!skip_prefix(refname->string, "refs/", &branch_name))
continue;

strbuf_setlen(&bundle_ref, bundle_prefix_len);
Expand Down
2 changes: 1 addition & 1 deletion commit-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static int commit_graph_compatible(struct repository *r)

if (replace_refs_enabled(r)) {
prepare_replace_object(r);
if (hashmap_get_size(&r->objects->replace_map->map))
if (oidmap_get_size(&r->objects->replace_map))
return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,9 @@ sub process_address_list {

sub valid_fqdn {
my $domain = shift;
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
my $subdomain = '(?!-)[A-Za-z0-9-]{1,63}(?<!-)';
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/)
&& $domain =~ /^$subdomain(?:\.$subdomain)*$/;
}

sub maildomain_net {
Expand Down
2 changes: 1 addition & 1 deletion list-objects-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static void filter_trees_free(void *filter_data) {
struct filter_trees_depth_data *d = filter_data;
if (!d)
return;
oidmap_free(&d->seen_at_depth, 1);
oidmap_clear(&d->seen_at_depth, 1);
free(d);
}

Expand Down
3 changes: 1 addition & 2 deletions object-store.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,7 @@ void raw_object_store_clear(struct raw_object_store *o)
{
FREE_AND_NULL(o->alternate_db);

oidmap_free(o->replace_map, 1);
FREE_AND_NULL(o->replace_map);
oidmap_clear(&o->replace_map, 1);
pthread_mutex_destroy(&o->replace_mutex);

free_commit_graph(o->commit_graph);
Expand Down
3 changes: 2 additions & 1 deletion object-store.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "object.h"
#include "list.h"
#include "oidset.h"
#include "oidmap.h"
#include "thread-utils.h"

struct oidmap;
Expand Down Expand Up @@ -109,7 +110,7 @@ struct raw_object_store {
* Objects that should be substituted by other objects
* (see git-replace(1)).
*/
struct oidmap *replace_map;
struct oidmap replace_map;
unsigned replace_map_initialized : 1;
pthread_mutex_t replace_mutex; /* protect object replace functions */

Expand Down
2 changes: 1 addition & 1 deletion oidmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void oidmap_init(struct oidmap *map, size_t initial_size)
hashmap_init(&map->map, oidmap_neq, NULL, initial_size);
}

void oidmap_free(struct oidmap *map, int free_entries)
void oidmap_clear(struct oidmap *map, int free_entries)
{
if (!map)
return;
Expand Down
9 changes: 7 additions & 2 deletions oidmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ struct oidmap {
void oidmap_init(struct oidmap *map, size_t initial_size);

/*
* Frees an oidmap structure and allocated memory.
* Clear an oidmap, freeing any allocated memory. The map is empty and
* can be reused without another explicit init.
*
* If `free_entries` is true, each oidmap_entry in the map is freed as well
* using stdlibs free().
*/
void oidmap_free(struct oidmap *map, int free_entries);
void oidmap_clear(struct oidmap *map, int free_entries);

/*
* Returns the oidmap entry for the specified oid, or NULL if not found.
Expand All @@ -66,6 +67,10 @@ void *oidmap_put(struct oidmap *map, void *entry);
*/
void *oidmap_remove(struct oidmap *map, const struct object_id *key);

static inline unsigned int oidmap_get_size(struct oidmap *map)
{
return hashmap_get_size(&map->map);
}

struct oidmap_iter {
struct hashmap_iter h_iter;
Expand Down
7 changes: 6 additions & 1 deletion reftable/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ static int read_block(struct reftable_block_source *source,
int reftable_block_init(struct reftable_block *block,
struct reftable_block_source *source,
uint32_t offset, uint32_t header_size,
uint32_t table_block_size, uint32_t hash_size)
uint32_t table_block_size, uint32_t hash_size,
uint8_t want_type)
{
uint32_t guess_block_size = table_block_size ?
table_block_size : DEFAULT_BLOCK_SIZE;
Expand All @@ -247,6 +248,10 @@ int reftable_block_init(struct reftable_block *block,
err = REFTABLE_FORMAT_ERROR;
goto done;
}
if (want_type != REFTABLE_BLOCK_TYPE_ANY && block_type != want_type) {
err = 1;
goto done;
}

block_size = reftable_get_be24(block->block_data.data + header_size + 1);
if (block_size > guess_block_size) {
Expand Down
3 changes: 2 additions & 1 deletion reftable/reftable-block.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ struct reftable_block {
int reftable_block_init(struct reftable_block *b,
struct reftable_block_source *source,
uint32_t offset, uint32_t header_size,
uint32_t table_block_size, uint32_t hash_size);
uint32_t table_block_size, uint32_t hash_size,
uint8_t want_type);

/* Release resources allocated by the block. */
void reftable_block_release(struct reftable_block *b);
Expand Down
11 changes: 1 addition & 10 deletions reftable/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,7 @@ int table_init_block(struct reftable_table *t, struct reftable_block *block,
return 1;

err = reftable_block_init(block, &t->source, next_off, header_off,
t->block_size, hash_size(t->hash_id));
if (err < 0)
goto done;

if (want_typ != REFTABLE_BLOCK_TYPE_ANY && block->block_type != want_typ) {
err = 1;
goto done;
}

done:
t->block_size, hash_size(t->hash_id), want_typ);
if (err)
reftable_block_release(block);
return err;
Expand Down
8 changes: 6 additions & 2 deletions reftable/writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ static int padded_write(struct reftable_writer *w, uint8_t *data, size_t len,
return -1;

n = w->write(w->write_arg, zeroed, w->pending_padding);
if (n < 0)
if (n < 0) {
reftable_free(zeroed);
return n;
}

w->pending_padding = 0;
reftable_free(zeroed);
Expand Down Expand Up @@ -256,8 +258,10 @@ static int writer_index_hash(struct reftable_writer *w, struct reftable_buf *has

reftable_buf_reset(&key->hash);
err = reftable_buf_add(&key->hash, hash->buf, hash->len);
if (err < 0)
if (err < 0) {
reftable_free(key);
return err;
}
tree_insert(&w->obj_index_tree, key,
&obj_index_tree_node_compare);
} else {
Expand Down
8 changes: 3 additions & 5 deletions replace-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int register_replace_ref(const char *refname,
oidcpy(&repl_obj->replacement, oid);

/* Register new object */
if (oidmap_put(r->objects->replace_map, repl_obj))
if (oidmap_put(&r->objects->replace_map, repl_obj))
die(_("duplicate replace ref: %s"), refname);

return 0;
Expand All @@ -48,9 +48,7 @@ void prepare_replace_object(struct repository *r)
return;
}

r->objects->replace_map =
xmalloc(sizeof(*r->objects->replace_map));
oidmap_init(r->objects->replace_map, 0);
oidmap_init(&r->objects->replace_map, 0);

refs_for_each_replace_ref(get_main_ref_store(r),
register_replace_ref, r);
Expand Down Expand Up @@ -80,7 +78,7 @@ const struct object_id *do_lookup_replace_object(struct repository *r,
/* Try to recursively replace the object */
while (depth-- > 0) {
struct replace_object *repl_obj =
oidmap_get(r->objects->replace_map, cur);
oidmap_get(&r->objects->replace_map, cur);
if (!repl_obj)
return cur;
cur = &repl_obj->replacement;
Expand Down
Loading