<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refspec.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>2025-03-21T08:45:16Z</updated>
<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>
<entry>
<title>refspec: remove refspec_item_init_or_die()</title>
<updated>2025-03-21T08:45:16Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2025-03-18T22:50:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec6829e4849feb7b0343940e00896055027b06eb'/>
<id>urn:sha1:ec6829e4849feb7b0343940e00896055027b06eb</id>
<content type='text'>
There are two callers of this function, which ensures that a dispatched
call to refspec_item_init() does not fail.

In the following commit, we're going to add fetch/push-specific variants
of refspec_item_init(), which will turn one function into two. To avoid
introducing yet another pair of new functions (such as
refspec_item_init_push_or_die() and refspec_item_init_fetch_or_die()),
let's remove the thin wrapper entirely.

This duplicates a single line of code among two callers, but thins the
refspec.h API by one function, and prevents introducing two more in the
following commit.

Note that we still have a trailing Boolean argument in the function
`refspec_item_init()`. The following commit will address this.

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>
<entry>
<title>refspec: replace `refspec_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:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0baad1f3aee508d84bf74b9670f283f8c91e55dd'/>
<id>urn:sha1:0baad1f3aee508d84bf74b9670f283f8c91e55dd</id>
<content type='text'>
To avoid having a Boolean argument in the refspec_init() function,
replace it with two variants:

  - `refspec_init_fetch()`
  - `refspec_init_push()`

to codify the meaning of that Boolean into the function's name itself.

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>
<entry>
<title>refspec: treat 'fetch' as a Boolean value</title>
<updated>2025-03-21T08:45:15Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2025-03-18T22:50:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3809633d0adb77b02ba8cfe87578134e6a30f54d'/>
<id>urn:sha1:3809633d0adb77b02ba8cfe87578134e6a30f54d</id>
<content type='text'>
Since 6d4c057859 (refspec: introduce struct refspec, 2018-05-16), we
have macros called REFSPEC_FETCH and REFSPEC_PUSH. This confusingly
suggests that we might introduce other modes in the future, which, while
possible, is highly unlikely.

But these values are treated as a Boolean, and stored in a struct field
called 'fetch'. So the following:

    if (refspec-&gt;fetch == REFSPEC_FETCH) { ... }

, and

    if (refspec-&gt;fetch) { ... }

are equivalent. Let's avoid renaming the Boolean values "true" and
"false" here and remove the two REFSPEC_ macros mentioned above.

Since this value is truly a Boolean and will only ever take on a value
of 0 or 1, we can declare it as a single bit unsigned field. In
practice this won't shrink the size of 'struct refspec', but it more
clearly indicates the intent.

Note that this introduces some awkwardness like:

    refspec_item_init_or_die(&amp;spec, refspec, 1);

, where it's unclear what the final "1" does. This will be addressed in
the following commits.

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>
<entry>
<title>refspec: clarify function naming and documentation</title>
<updated>2025-02-18T17:44:27Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-02-15T08:45:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=044b6f04f23d6c7e3c3750c9829db96b71470874'/>
<id>urn:sha1:044b6f04f23d6c7e3c3750c9829db96b71470874</id>
<content type='text'>
Rename `match_name_with_pattern()` to `match_refname_with_pattern()` to
better reflect its purpose and improve documentation comment clarity.
The previous function name and parameter names were inconsistent, making
it harder to understand their roles in refspec matching.

- Rename parameters:
  - `key` -&gt; `pattern` (globbing pattern to match)
  - `name` -&gt; `refname` (refname to check)
  - `value` -&gt; `replacement` (replacement mapping pattern)

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ms/remote-valid-remote-name'</title>
<updated>2025-02-12T18:08:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-02-12T18:08:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0a99ffb4d6645142e68517c59db61b7e58a4f7cc'/>
<id>urn:sha1:0a99ffb4d6645142e68517c59db61b7e58a4f7cc</id>
<content type='text'>
Code shuffling.

* ms/remote-valid-remote-name:
  remote: relocate valid_remote_name
</content>
</entry>
<entry>
<title>remote: relocate valid_remote_name</title>
<updated>2025-02-04T17:55:59Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-02-04T14:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f21ea69d945f958704f2fe143c2638ecae6e0d12'/>
<id>urn:sha1:f21ea69d945f958704f2fe143c2638ecae6e0d12</id>
<content type='text'>
Move the `valid_remote_name()` function from the refspec subsystem to
the remote subsystem to better align with the separation of concerns.

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refspec: relocate apply_refspecs and related funtions</title>
<updated>2025-02-04T17:51:42Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-02-04T04:05:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d549b6c9ff44d3ccb32b9bfe1816d3cfb1d7052a'/>
<id>urn:sha1:d549b6c9ff44d3ccb32b9bfe1816d3cfb1d7052a</id>
<content type='text'>
Move the functions `apply_refspecs()` and `apply_negative_refspecs()`
from `remote.c` to `refspec.c`. These functions focus on applying
refspecs, so centralizing them in `refspec.c` improves code organization
by keeping refspec-related logic in one place.

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refspec: relocate matching related functions</title>
<updated>2025-02-04T17:51:41Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-02-04T04:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b24a170d2c36c83c3669d194af46a09ccdeec43'/>
<id>urn:sha1:7b24a170d2c36c83c3669d194af46a09ccdeec43</id>
<content type='text'>
Move the functions `refspec_find_match()`, `refspec_find_all_matches()`
and `refspec_find_negative_match()` from `remote.c` to `refspec.c`.
These functions focus on matching refspecs, so centralizing them in
`refspec.c` improves code organization by keeping refspec-related logic
in one place.

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refspec: relocate refname_matches_negative_refspec_item</title>
<updated>2025-02-04T17:51:41Z</updated>
<author>
<name>Meet Soni</name>
<email>meetsoni3017@gmail.com</email>
</author>
<published>2025-02-04T04:05:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=230d022fe3ba67465e867ac1fa4da3bcf0d31630'/>
<id>urn:sha1:230d022fe3ba67465e867ac1fa4da3bcf0d31630</id>
<content type='text'>
Move the functions `refname_matches_negative_refspec_item()`,
`refspec_match()`, and `match_name_with_pattern()` from `remote.c` to
`refspec.c`. These functions focus on refspec matching, so placing them
in `refspec.c` aligns with the separation of concerns. Keep
refspec-related logic in `refspec.c` and remote-specific logic in
`remote.c` for better code organization.

Signed-off-by: Meet Soni &lt;meetsoni3017@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
