<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/submodule-config.h, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-09-30T18:23:03Z</updated>
<entry>
<title>submodule: fix leaking submodule entry list</title>
<updated>2024-09-30T18:23:03Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-30T09:13:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5cca114973c602c9f8516e9ed34c76fd75fb999e'/>
<id>urn:sha1:5cca114973c602c9f8516e9ed34c76fd75fb999e</id>
<content type='text'>
The submodule entry list returned by `submodules_of_tree()` is never
completely free'd by its only caller. Introduce a new function that
free's the list for us and call it.

While at it, also fix the leaking `branch_point` string.

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>Merge branch 'vd/fsck-submodule-url-test'</title>
<updated>2024-01-26T16:54:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-01-26T16:54:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=76bd1294d8ed21d2d7e8d35220a0e820969c5ee8'/>
<id>urn:sha1:76bd1294d8ed21d2d7e8d35220a0e820969c5ee8</id>
<content type='text'>
Tighten URL checks fsck makes in a URL recorded for submodules.

* vd/fsck-submodule-url-test:
  submodule-config.c: strengthen URL fsck check
  t7450: test submodule urls
  test-submodule: remove command line handling for check-name
  submodule-config.h: move check_submodule_url
</content>
</entry>
<entry>
<title>submodule-config.h: move check_submodule_url</title>
<updated>2024-01-18T18:12:48Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2024-01-18T01:55:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13320ff610b4083341175c4f8e636a1bc52145f5'/>
<id>urn:sha1:13320ff610b4083341175c4f8e636a1bc52145f5</id>
<content type='text'>
Move 'check_submodule_url' out of 'fsck.c' and into 'submodule-config.h' as
a public method, similar to 'check_submodule_name'. With the function now
accessible outside of 'fsck', it can be used in a later commit to extend
'test-tool submodule' to check the validity of submodule URLs as it does
with names in the 'check-name' subcommand.

Other than its location, no changes are made to 'check_submodule_url' in
this patch.

Signed-off-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule-config.h: remove unnecessary include</title>
<updated>2023-12-26T20:04:32Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-12-23T17:14:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e9bb1664917a1c6c6379d196172fcd36618e3230'/>
<id>urn:sha1:e9bb1664917a1c6c6379d196172fcd36618e3230</id>
<content type='text'>
The unnecessary include in the header transitively pulled in some
other headers actually needed by source files, though.  Have those
source files explicitly include the headers they need.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>treewide: remove unnecessary includes from header files</title>
<updated>2023-12-26T20:04:31Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-12-23T17:14:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=147438e8a0eb31a06cb9aefbf0de8c45e544a4c7'/>
<id>urn:sha1:147438e8a0eb31a06cb9aefbf0de8c45e544a4c7</id>
<content type='text'>
There are three kinds of unnecessary includes:
  * includes which aren't directly needed, but which include some other
    forgotten include
  * includes which could be replaced by a simple forward declaration of
    some structs
  * includes which aren't needed at all

Remove the third kind of include.  Subsequent commits (and a subsequent
series) will work on removing some of the other kinds of includes.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: pass kvi to die_bad_number()</title>
<updated>2023-06-28T21:06:40Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2023-06-28T19:26:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb'/>
<id>urn:sha1:8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb</id>
<content type='text'>
Plumb "struct key_value_info" through all code paths that end in
die_bad_number(), which lets us remove the helper functions that read
analogous values from "struct config_reader". As a result, nothing reads
config_reader.config_kvi any more, so remove that too.

In config.c, this requires changing the signature of
git_configset_get_value() to 'return' "kvi" in an out parameter so that
git_configset_get_&lt;type&gt;() can pass it to git_config_&lt;type&gt;(). Only
numeric types will use "kvi", so for non-numeric types (e.g.
git_configset_get_string()), pass NULL to indicate that the out
parameter isn't needed.

Outside of config.c, config callbacks now need to pass "ctx-&gt;kvi" to any
of the git_config_&lt;type&gt;() functions that parse a config string into a
number type. Included is a .cocci patch to make that refactor.

The only exceptional case is builtin/config.c, where git_config_&lt;type&gt;()
is called outside of a config callback (namely, on user-provided input),
so config source information has never been available. In this case,
die_bad_number() defaults to a generic, but perfectly descriptive
message. Let's provide a safe, non-NULL for "kvi" anyway, but make sure
not to change the message.

Signed-off-by: Glen Choo &lt;chooglen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hash.h: move some oid-related declarations from cache.h</title>
<updated>2023-02-24T01:25:28Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41227cb138c91fbd369ac6ee4877f253b39260cc'/>
<id>urn:sha1:41227cb138c91fbd369ac6ee4877f253b39260cc</id>
<content type='text'>
These defines and enum are all oid-related and as such seem to make
more sense being included in hash.h.  Further, moving them there
allows us to remove some includes of cache.h in other files.

The change to line-log.h might look unrelated, but line-log.h includes
diffcore.h, which previously included cache.h, which included the
kitchen sink.  Since this patch makes diffcore.h no longer include
cache.h, the compiler complains about the 'struct string_list *'
function parameter.  Add a forward declaration for struct string_list to
address this.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pb/submodule-recurse-mode-enum'</title>
<updated>2022-05-20T22:26:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-05-20T22:26:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ee0241bd224d3c106701876d1cceecf17b6039e3'/>
<id>urn:sha1:ee0241bd224d3c106701876d1cceecf17b6039e3</id>
<content type='text'>
Small code clean-up.

* pb/submodule-recurse-mode-enum:
  submodule.h: use a named enum for RECURSE_SUBMODULES_*
</content>
</entry>
<entry>
<title>submodule.h: use a named enum for RECURSE_SUBMODULES_*</title>
<updated>2022-04-06T15:55:19Z</updated>
<author>
<name>Philippe Blain</name>
<email>levraiphilippeblain@gmail.com</email>
</author>
<published>2022-04-04T17:10:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=465b30a92d4c2c76e434790bdf487d57547a6cc4'/>
<id>urn:sha1:465b30a92d4c2c76e434790bdf487d57547a6cc4</id>
<content type='text'>
Using a named enum allows casting an integer to the enum type in both
GDB and LLDB:

    $ gdb -q -ex 'b wt-status.c:44' -ex r --args ./git status
    (gdb) p (enum color_wt_status) slot
    $1 = WT_STATUS_ONBRANCH

    $ lldb -o 'b wt-status.c:44' -o r -- ./git status
    (lldb) p (color_wt_status) slot
    (color_wt_status) $0 = WT_STATUS_ONBRANCH

In LLDB, it's also required to cast in the reversed direction, i.e.
cast an enum constant into its corresponding integer:

    (lldb) p (int) color_wt_status::WT_STATUS_ONBRANCH
    (int) $1 = 8

Name the enum listing the different RECURSE_SUBMODULES_* modes, to make
debugging easier. For example, when stepping through a part of the code
where an int is compared with a constant in this enum, it allows casting
the int to the enum type or vice-versa, after quickly checking where the
enum constant is declared and learning the enum name.

As to not make this patch a debug-only change, convert the
'fetch_recurse' member of 'struct submodule' to use the newly named
enum.

Signed-off-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Reviewed-by: Glen Choo &lt;chooglen@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>branch: add --recurse-submodules option for branch creation</title>
<updated>2022-02-04T16:16:39Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2022-01-29T00:04:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=961b130d20c9aea322b94a639a63ec8cca9f14fc'/>
<id>urn:sha1:961b130d20c9aea322b94a639a63ec8cca9f14fc</id>
<content type='text'>
To improve the submodules UX, we would like to teach Git to handle
branches in submodules. Start this process by teaching "git branch" the
--recurse-submodules option so that "git branch --recurse-submodules
topic" will create the `topic` branch in the superproject and its
submodules.

Although this commit does not introduce breaking changes, it does not
work well with existing --recurse-submodules commands because "git
branch --recurse-submodules" writes to the submodule ref store, but most
commands only consider the superproject gitlink and ignore the submodule
ref store. For example, "git checkout --recurse-submodules" will check
out the commits in the superproject gitlinks (and put the submodules in
detached HEAD) instead of checking out the submodule branches.

Because of this, this commit introduces a new configuration value,
`submodule.propagateBranches`. The plan is for Git commands to
prioritize submodule ref store information over superproject gitlinks if
this value is true. Because "git branch --recurse-submodules" writes to
submodule ref stores, for the sake of clarity, it will not function
unless this configuration value is set.

This commit also includes changes that support working with submodules
from a superproject commit because "branch --recurse-submodules" (and
future commands) need to read .gitmodules and gitlinks from the
superproject commit, but submodules are typically read from the
filesystem's .gitmodules and the index's gitlinks. These changes are:

* add a submodules_of_tree() helper that gives the relevant
  information of an in-tree submodule (e.g. path and oid) and
  initializes the repository
* add is_tree_submodule_active() by adding a treeish_name parameter to
  is_submodule_active()
* add the "submoduleNotUpdated" advice to advise users to update the
  submodules in their trees

Incidentally, fix an incorrect usage string that combined the 'list'
usage of git branch (-l) with the 'create' usage; this string has been
incorrect since its inception, a8dfd5eac4 (Make builtin-branch.c use
parse_options., 2007-10-07).

Helped-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Glen Choo &lt;chooglen@google.com&gt;
Reviewed-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
