<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refspec.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-03-24T04:27:17Z</updated>
<entry>
<title>refspec: fix typo in comment</title>
<updated>2026-03-24T04:27:17Z</updated>
<author>
<name>K Jayatheerth</name>
<email>jayatheerthkulkarni2005@gmail.com</email>
</author>
<published>2026-03-24T01:57:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4e5dc601ddc5f0d8ab035210554d9e15aa376032'/>
<id>urn:sha1:4e5dc601ddc5f0d8ab035210554d9e15aa376032</id>
<content type='text'>
Fix a long-standing typo in a comment: "refpsecs" -&gt; "refspecs".

Signed-off-by: K Jayatheerth &lt;jayatheerthkulkarni2005@gmail.com&gt;
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='http://git.kilabit.info/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='http://git.kilabit.info/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='http://git.kilabit.info/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='http://git.kilabit.info/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_ref_prefixes(): clean up refspec_item logic</title>
<updated>2025-03-10T20:13:45Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-03-09T03:07:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=36b12c3248042280b1d41bdba1457f7ac46f2250'/>
<id>urn:sha1:36b12c3248042280b1d41bdba1457f7ac46f2250</id>
<content type='text'>
The point of refspec_ref_prefixes() is to look over the set of refspecs
and set up an appropriate list of "ref-prefix" strings to send to the
server.

The logic for handling individual refspec_items has some confusing bits.
The final part of our if/else cascade checks this:

  else if (item-&gt;src &amp;&amp; !item-&gt;exact_sha1)
	prefix = item-&gt;src;

But we know that "item-&gt;exact_sha1" can never be true, because earlier
we did:

  if (item-&gt;exact_sha1 || item-&gt;negative)
	continue;

This is due to 6c301adb0a (fetch: do not pass ref-prefixes for fetch by
exact SHA1, 2018-05-31), which added the continue. So it is tempting to
remove the extra exact_sha1 at the end of the cascade, leaving the one
at the top of the loop.

But I don't think that's quite right. The full cascade is:

  if (rs-&gt;fetch == REFSPEC_FETCH)
	prefix = item-&gt;src;
  else if (item-&gt;dst)
	prefix = item-&gt;dst;
  else if (item-&gt;src &amp;&amp; !item-&gt;exact_sha1)
	prefix = item-&gt;src;

which all comes from 6373cb598e (refspec: consolidate ref-prefix
generation logic, 2018-05-16). That first "if" is supposed to handle
fetches, where we care about the source name, since that is coming from
the server. And the rest should be for pushes, where we care about the
destination, since that's the name the server will use. And we get that
either explicitly from "dst" (for something like "foo:bar") or
implicitly from the source (a refspec like "foo" is treated as
"foo:foo").

But how should exact_sha1 interact with those? For a fetch, exact_sha1
always means we do not care about sending a name to the server (there is
no server refname at all). But pushing an exact sha1 should still care
about the destination on the server! It is only if we have to fall back
to the implicit source that we need to care if it is a real ref (though
arguably such a push does not even make sense; where would the server
store it?).

So I think that 6c301adb0a "broke" the push case by always skipping
exact_sha1 items, even though a push should only care about the
destination.

Of course this is all completely academic. We have still not implemented
a v2 push protocol, so even though we do call this function for pushes,
we'd never actually send these ref-prefix lines.

However, given the effort I spent to figure out what was going on here,
and the overlapping exact_sha1 checks, I'd like to rewrite this to
preemptively fix the bug, and hopefully make it less confusing.

This splits the "if" at the top-level into fetch vs push, and then each
handles exact_sha1 appropriately itself. The check for negative refspecs
remains outside of either (there is no protocol support for them, so we
never send them to the server, but rather use them only to reduce the
advertisement we receive).

The resulting behavior should be identical for fetches, but hopefully
sets us up better for a potential future v2 push.

Signed-off-by: Jeff King &lt;peff@peff.net&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='http://git.kilabit.info/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='http://git.kilabit.info/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='http://git.kilabit.info/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='http://git.kilabit.info/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>
</feed>
