<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/remote.h, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-05-16T22:02:10Z</updated>
<entry>
<title>remote: allow relative_url() to return an absolute url</title>
<updated>2022-05-16T22:02:10Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-05-16T20:11:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=834e3520ab6435073ef58922b24d732f96cdf461'/>
<id>urn:sha1:834e3520ab6435073ef58922b24d732f96cdf461</id>
<content type='text'>
When the 'url' parameter was absolute, the previous implementation would
concatenate 'remote_url' with 'url'. Instead, we want to return 'url' in
this case.

The documentation now discusses what happens when supplying two
absolute URLs.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: move relative_url()</title>
<updated>2022-05-16T22:02:10Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-05-16T20:11:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1d04e719e7bda885991cd4566a5bb6f6565fa106'/>
<id>urn:sha1:1d04e719e7bda885991cd4566a5bb6f6565fa106</id>
<content type='text'>
This method was initially written in 63e95beb0 (submodule: port
resolve_relative_url from shell to C, 2016-05-15). As we will need
similar functionality in the bundle URI feature, extract this to be
available in remote.h.

The code is almost exactly the same, except for the following trivial
differences:

 * Fix whitespace and wrapping issues with the prototype and argument
   lists.

 * Let's call starts_with_dot_{,dot_}slash_native() instead of the
   functionally identical "starts_with_dot_{,dot_}slash()" wrappers
   "builtin/submodule--helper.c".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: die if branch is not found in repository</title>
<updated>2021-11-19T06:31:19Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2021-11-18T00:53:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a2dcb1a08008bfc48c32f408e8622bd0c4ca297'/>
<id>urn:sha1:4a2dcb1a08008bfc48c32f408e8622bd0c4ca297</id>
<content type='text'>
In a subsequent commit, we would like external-facing functions to be
able to accept "struct repository" and "struct branch" as a pair. This
is useful for functions like pushremote_for_branch(), which need to take
values from the remote_state and branch, even if branch == NULL.
However, a caller may supply an unrelated repository and branch, which
is not supported behavior.

To prevent misuse, add a die_on_missing_branch() helper function that
dies if a given branch is not from a given repository. Speed up the
existence check by replacing the branches list with a branches_hash
hashmap.

Like read_config(), die_on_missing_branch() is only called from
non-static functions; static functions are less prone to misuse because
they have strong conventions for keeping remote_state and branch in
sync.

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>
<entry>
<title>remote: use remote_state parameter internally</title>
<updated>2021-11-19T06:31:19Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2021-11-18T00:53:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=085b98f6cdbe9ed794e19ded00ccd0431c30faa0'/>
<id>urn:sha1:085b98f6cdbe9ed794e19ded00ccd0431c30faa0</id>
<content type='text'>
Without changing external-facing functions, replace
the_repository-&gt;remote_state internally by adding a struct remote_state
parameter.

As a result, external-facing functions are still tied to the_repository,
but most static functions no longer reference
the_repository-&gt;remote_state. The exceptions are those that are used in
a way that depends on external-facing functions e.g. the callbacks to
remote_get_1().

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>
<entry>
<title>remote: move static variables into per-repository struct</title>
<updated>2021-11-19T06:31:19Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2021-11-18T00:53:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd3cb0501e175bcac042587cb7bb75e16034a5b7'/>
<id>urn:sha1:fd3cb0501e175bcac042587cb7bb75e16034a5b7</id>
<content type='text'>
remote.c does not works with non-the_repository because it stores its
state as static variables. To support non-the_repository, we can use a
per-repository struct for the remotes subsystem.

Prepare for this change by defining a struct remote_state that holds
the remotes subsystem state and move the static variables of remote.c
into the_repository-&gt;remote_state.

This introduces no behavioral or API changes.

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>
<entry>
<title>Merge branch 'jt/clone-unborn-head'</title>
<updated>2021-02-18T01:21:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-18T01:21:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69571dfe219f48614e0e0ae7e28efae0be297764'/>
<id>urn:sha1:69571dfe219f48614e0e0ae7e28efae0be297764</id>
<content type='text'>
"git clone" tries to locally check out the branch pointed at by
HEAD of the remote repository after it is done, but the protocol
did not convey the information necessary to do so when copying an
empty repository.  The protocol v2 learned how to do so.

* jt/clone-unborn-head:
  clone: respect remote unborn HEAD
  connect, transport: encapsulate arg in struct
  ls-refs: report unborn targets of symrefs
</content>
</entry>
<entry>
<title>connect, transport: encapsulate arg in struct</title>
<updated>2021-02-05T21:49:54Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2021-02-05T20:48:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39835409d10de2402c4b3e10dba20286989627d4'/>
<id>urn:sha1:39835409d10de2402c4b3e10dba20286989627d4</id>
<content type='text'>
In a future patch we plan to return the name of an unborn current branch
from deep in the callchain to a caller via a new pointer parameter that
points at a variable in the caller when the caller calls
get_remote_refs() and transport_get_remote_refs().

In preparation for that, encapsulate the existing ref_prefixes
parameter into a struct. The aforementioned unborn current branch will
go into this new struct in the future patch.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch: extract writing to FETCH_HEAD</title>
<updated>2021-01-12T20:06:14Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2021-01-12T12:27:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=58a646a3688ea3c15adaf481e440e9ca2d3bce06'/>
<id>urn:sha1:58a646a3688ea3c15adaf481e440e9ca2d3bce06</id>
<content type='text'>
When performing a fetch with the default `--write-fetch-head` option, we
write all updated references to FETCH_HEAD while the updates are
performed. Given that updates are not performed atomically, it means
that we we write to FETCH_HEAD even if some or all of the reference
updates fail.

Given that we simply update FETCH_HEAD ad-hoc with each reference, the
logic is completely contained in `store_update_refs` and thus quite hard
to extend. This can already be seen by the way we skip writing to the
FETCH_HEAD: instead of having a conditional which simply skips writing,
we instead open "/dev/null" and needlessly write all updates there.

We are about to extend git-fetch(1) to accept an `--atomic` flag which
will make the fetch an all-or-nothing operation with regards to the
reference updates. This will also require us to make the updates to
FETCH_HEAD an all-or-nothing operation, but as explained doing so is not
easy with the current layout. This commit thus refactors the wa we write
to FETCH_HEAD and pulls out the logic to open, append to, commit and
close the file. While this may seem rather over-the top at first,
pulling out this logic will make it a lot easier to update the code in a
subsequent commit. It also allows us to easily skip writing completely
in case `--no-write-fetch-head` was passed.

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 'sk/force-if-includes'</title>
<updated>2020-10-27T22:09:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-10-27T22:09:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=de0a7effc86aadf6177fdcea52b5ae24c7a85911'/>
<id>urn:sha1:de0a7effc86aadf6177fdcea52b5ae24c7a85911</id>
<content type='text'>
"git push --force-with-lease[=&lt;ref&gt;]" can easily be misused to lose
commits unless the user takes good care of their own "git fetch".
A new option "--force-if-includes" attempts to ensure that what is
being force-pushed was created after examining the commit at the
tip of the remote ref that is about to be force-replaced.

* sk/force-if-includes:
  t, doc: update tests, reference for "--force-if-includes"
  push: parse and set flag for "--force-if-includes"
  push: add reflog check for "--force-if-includes"
</content>
</entry>
<entry>
<title>Merge branch 'jk/refspecs-negative'</title>
<updated>2020-10-05T21:01:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-10-05T21:01:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8e3ec76a20d6abf5dd8ceb3f5f2c157000e4c13e'/>
<id>urn:sha1:8e3ec76a20d6abf5dd8ceb3f5f2c157000e4c13e</id>
<content type='text'>
"git fetch" and "git push" support negative refspecs.

* jk/refspecs-negative:
  refspec: add support for negative refspecs
</content>
</entry>
</feed>
