<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/pull.c, branch v2.51.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.51.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.51.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-08-04T15:10:33Z</updated>
<entry>
<title>Merge branch 'ps/config-wo-the-repository'</title>
<updated>2025-08-04T15:10:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-08-04T15:10:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=540aaa607c5efcd94bb852a76a8ec3e07ea9a7bc'/>
<id>urn:sha1:540aaa607c5efcd94bb852a76a8ec3e07ea9a7bc</id>
<content type='text'>
The config API had a set of convenience wrapper functions that
implicitly use the_repository instance; they have been removed and
inlined at the calling sites.

* ps/config-wo-the-repository: (21 commits)
  config: fix sign comparison warnings
  config: move Git config parsing into "environment.c"
  config: remove unused `the_repository` wrappers
  config: drop `git_config_set_multivar()` wrapper
  config: drop `git_config_get_multivar_gently()` wrapper
  config: drop `git_config_set_multivar_in_file_gently()` wrapper
  config: drop `git_config_set_in_file_gently()` wrapper
  config: drop `git_config_set()` wrapper
  config: drop `git_config_set_gently()` wrapper
  config: drop `git_config_set_in_file()` wrapper
  config: drop `git_config_get_bool()` wrapper
  config: drop `git_config_get_ulong()` wrapper
  config: drop `git_config_get_int()` wrapper
  config: drop `git_config_get_string()` wrapper
  config: drop `git_config_get_string()` wrapper
  config: drop `git_config_get_string_multi()` wrapper
  config: drop `git_config_get_value()` wrapper
  config: drop `git_config_get_value()` wrapper
  config: drop `git_config_get()` wrapper
  config: drop `git_config_clear()` wrapper
  ...
</content>
</entry>
<entry>
<title>Merge branch 'ly/pull-autostash'</title>
<updated>2025-08-01T18:27:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-08-01T18:27:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6fe666b2cef09571aa01d9ffae179472aeaf9378'/>
<id>urn:sha1:6fe666b2cef09571aa01d9ffae179472aeaf9378</id>
<content type='text'>
"git pull" learned to pay attention to pull.autostash configuration
variable, which overrides rebase/merge.autostash.

* ly/pull-autostash:
  pull: add pull.autoStash config option
</content>
</entry>
<entry>
<title>config: move Git config parsing into "environment.c"</title>
<updated>2025-07-23T15:15:22Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-23T14:08:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=08b775864edf96b97500fd70446c55528f5cf4a6'/>
<id>urn:sha1:08b775864edf96b97500fd70446c55528f5cf4a6</id>
<content type='text'>
In "config.c" we host both the business logic to read and write config
files as well as the logic to parse specific Git-related variables. On
the one hand this is mixing concerns, but even more importantly it means
that we cannot easily remove the dependency on `the_repository` in our
config parsing logic.

Move the logic into "environment.c". This file is a grab bag of all
kinds of global state already, so it is quite a good fit. Furthermore,
it also hosts most of the global variables that we're parsing the config
values into, making this an even better fit.

Note that there is one hidden change: in `parse_fsync_components()` we
use an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But
as -Wsign-compare warnings are enabled in this file this causes a
compiler warning. The issue is fixed by using a `size_t` instead.

This change allows us to drop the `USE_THE_REPOSITORY_VARIABLE`
declaration.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: drop `git_config_get_value()` wrapper</title>
<updated>2025-07-23T15:15:18Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-23T14:08:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f1242567ebe48f7f61df138f37b226256b7c4c6'/>
<id>urn:sha1:2f1242567ebe48f7f61df138f37b226256b7c4c6</id>
<content type='text'>
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.

Follow through with that intent and remove `git_config_get_value()`. All
callsites are adjusted so that they use
`repo_config_get_value(the_repository, ...)` instead. While some
callsites might already have a repository available, this mechanical
conversion is the exact same as the current situation and thus cannot
cause any regression. Those sites should eventually be cleaned up in a
later patch series.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: drop `git_config()` wrapper</title>
<updated>2025-07-23T15:15:18Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-07-23T14:08:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ce196e86b455fa2552812802c58f30c090c94af'/>
<id>urn:sha1:9ce196e86b455fa2552812802c58f30c090c94af</id>
<content type='text'>
In 036876a1067 (config: hide functions using `the_repository` by
default, 2024-08-13) we have moved around a bunch of functions in the
config subsystem that depend on `the_repository`. Those function have
been converted into mere wrappers around their equivalent function that
takes in a repository as parameter, and the intent was that we'll
eventually remove those wrappers to make the dependency on the global
repository variable explicit at the callsite.

Follow through with that intent and remove `git_config()`. All callsites
are adjusted so that they use `repo_config(the_repository, ...)`
instead. While some callsites might already have a repository available,
this mechanical conversion is the exact same as the current situation
and thus cannot cause any regression. Those sites should eventually be
cleaned up in a later patch series.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pull: add pull.autoStash config option</title>
<updated>2025-07-21T22:01:21Z</updated>
<author>
<name>Lidong Yan</name>
<email>yldhome2d2@gmail.com</email>
</author>
<published>2025-07-20T12:43:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e3378607c8675a2db6d997bd9781ae5500a2ec57'/>
<id>urn:sha1:e3378607c8675a2db6d997bd9781ae5500a2ec57</id>
<content type='text'>
Git uses `rebase.autostash` or `merge.autostash` to determine whether a
dirty worktree is allowed during pull. However, this behavior is not
clearly documented, making it difficult for users to discover how to
enable autostash, or causing them to unknowingly enable it. Add new
config option `pull.autostash` along with its documentation and test
cases.

`pull.autostash` provides the same functionality as `rebase.autostash`
and `merge.autostash`, but overrides them when set. If `pull.autostash`
is not set, it falls back to `rebase.autostash` or `merge.autostash`,
depending on the value of `pull.rebase`.

Signed-off-by: Lidong Yan &lt;yldhome2d2@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/submodule-remote-lookup-cleanup'</title>
<updated>2025-07-07T21:12:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-07-07T21:12:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7310e539ada2b368e1c7243734ee7316639814f2'/>
<id>urn:sha1:7310e539ada2b368e1c7243734ee7316639814f2</id>
<content type='text'>
Updating submodules from the upstream did not work well when
submodule's HEAD is detached, which has been improved.

* jk/submodule-remote-lookup-cleanup:
  submodule: look up remotes by URL first
  submodule: move get_default_remote_submodule()
  submodule--helper: improve logic for fallback remote name
  remote: remove the_repository from some functions
  dir: move starts_with_dot(_dot)_slash to dir.h
  remote: fix tear down of struct remote
  remote: remove branch-&gt;merge_name and fix branch_release()
</content>
</entry>
<entry>
<title>remote: remove branch-&gt;merge_name and fix branch_release()</title>
<updated>2025-06-23T23:38:55Z</updated>
<author>
<name>Jacob Keller</name>
<email>jacob.keller@gmail.com</email>
</author>
<published>2025-06-23T23:11:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f62dcc7f30d16af29c0f707005aceb5eb6119279'/>
<id>urn:sha1:f62dcc7f30d16af29c0f707005aceb5eb6119279</id>
<content type='text'>
The branch structure has both branch-&gt;merge_name and branch-&gt;merge for
tracking the merge information. The former is allocated by add_merge()
and stores the names read from the configuration file. The latter is
allocated by set_merge() which is called by branch_get() when an
external caller requests a branch.

This leads to the confusing situation where branch-&gt;merge_nr tracks both
the size of branch-&gt;merge (once its allocated) and branch-&gt;merge_name.
The branch_release() function incorrectly assumes that branch-&gt;merge is
always set when branch-&gt;merge_nr is non-zero, and can potentially crash
if read_config() is called without branch_get() being called on every
branch.

In addition, branch_release() fails to free some of the memory
associated with the structure including:

 * Failure to free the refspec_item containers in branch-&gt;merge[i]
 * Failure to free the strings in branch-&gt;merge_name[i]
 * Failure to free the branch-&gt;merge_name parent array.

The set_merge() function sets branch-&gt;merge_nr to 0 when there is no
valid remote_name, to avoid external callers seeing a non-zero merge_nr
but a NULL merge array. This results in failure to release most of the
merge data as well.

These issues could be fixed directly, and indeed I initially proposed
such a change at [1] in the past. While this works, there was some
confusion during review because of the inconsistencies.

Instead, its time to clean up the situation properly. Remove
branch-&gt;merge_name entirely. Instead, allocate branch-&gt;merge earlier
within add_merge() instead of within set_merge(). Instead of having
set_merge() copy from merge_name[i] to merge[i]-&gt;src, just have
add_merge() directly initialize merge[i]-&gt;src.

Modify the add_merge() to call xstrdup() itself, instead of having
the caller of add_merge() do so. This makes it more obvious which code
owns the memory.

Update all callers which use branch-&gt;merge_name[i] to use
branch-&gt;merge[i]-&gt;src instead.

Add a merge_clear() function which properly releases all of the
merge-related memory, and which sets branch-&gt;merge_nr to zero. Use this
both in branch_release() and in set_merge(), fixing the leak when
set_merge() finds no valid remote_name.

Add a set_merge variable to the branch structure, which indicates
whether set_merge() has been called. This replaces the previous use of a
NULL check against the branch-&gt;merge array.

With these changes, the merge array is always allocated when merge_nr is
non-zero.

This use of refspec_item to store the names should be safe. External
callers should be using branch_get() to obtain a pointer to the branch,
which will call set_merge(), and the callers internal to remote.c
already handle the partially initialized refpsec_item structure safely.

This end result is cleaner, and avoids duplicating the merge names
twice.

Signed-off-by: Jacob Keller &lt;jacob.keller@gmail.com&gt;
Link: [1] https://lore.kernel.org/git/20250617-jk-submodule-helper-use-url-v2-1-04cbb003177d@gmail.com/
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>merge/pull: add the "--compact-summary" option</title>
<updated>2025-06-13T18:50:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-06-12T22:25:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3a54f5bd5db0478c39a52b4da149e3c2413f46eb'/>
<id>urn:sha1:3a54f5bd5db0478c39a52b4da149e3c2413f46eb</id>
<content type='text'>
"git merge" and "git pull" shows "git diff --stat --summary @{1}"
when they finish to indicate the extent of the changes brought into
the history by default.  While it gives a good overview, it becomes
annoying when there are very many created or deleted paths.

Introduce "--compact-summary" option to these two commands that
tells it to instead show "git diff --compact-summary @{1}", which
gives the same information in a lot more compact form in such a
situation.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refspec: replace `refspec_item_init()` with fetch/push variants</title>
<updated>2025-03-21T08:45:16Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2025-03-18T22:50:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=459e54b5497b53f298fe9164112f9bcb33bedb8d'/>
<id>urn:sha1:459e54b5497b53f298fe9164112f9bcb33bedb8d</id>
<content type='text'>
For similar reasons as in the previous refactoring of `refspec_init()`
into `refspec_init_fetch()` and `refspec_init_push()`, apply the same
refactoring to `refspec_item_init()`.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Acked-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
