<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/remote.c, branch v2.35.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.35.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.35.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-12-10T22:35:02Z</updated>
<entry>
<title>Merge branch 'gc/remote-with-fewer-static-global-variables'</title>
<updated>2021-12-10T22:35:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-10T22:35:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6d1e149ac04717efff7e0748509036a87cbb95e1'/>
<id>urn:sha1:6d1e149ac04717efff7e0748509036a87cbb95e1</id>
<content type='text'>
Code clean-up to eventually allow information on remotes defined
for an arbitrary repository to be read.

* gc/remote-with-fewer-static-global-variables:
  remote: die if branch is not found in repository
  remote: remove the_repository-&gt;remote_state from static methods
  remote: use remote_state parameter internally
  remote: move static variables into per-repository struct
  t5516: add test case for pushing remote refspecs
</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: remove the_repository-&gt;remote_state from static methods</title>
<updated>2021-11-19T06:31:19Z</updated>
<author>
<name>Glen Choo</name>
<email>chooglen@google.com</email>
</author>
<published>2021-11-18T00:53:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=56eed3422cb4605a616daab589b94a843a75651f'/>
<id>urn:sha1:56eed3422cb4605a616daab589b94a843a75651f</id>
<content type='text'>
Replace all remaining references of the_repository-&gt;remote_state in
static functions with a struct remote_state parameter.

To do so, move read_config() calls to non-static functions and create a
family of static functions, "remotes_*", that behave like "repo_*", but
accept struct remote_state instead of struct repository. In the case
where a static function calls a non-static function, replace the
non-static function with its "remotes_*" equivalent.

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>*.[ch] *_INIT macros: use { 0 } for a "zero out" idiom</title>
<updated>2021-09-27T21:47:59Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-09-27T12:54:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9865b6e6a4ca1e895fd473c827cf1822f3bd8249'/>
<id>urn:sha1:9865b6e6a4ca1e895fd473c827cf1822f3bd8249</id>
<content type='text'>
In C it isn't required to specify that all members of a struct are
zero'd out to 0, NULL or '\0', just providing a "{ 0 }" will
accomplish that.

Let's also change code that provided N zero'd fields to just
provide one, and change e.g. "{ NULL }" to "{ 0 }" for
consistency. I.e. even if the first member is a pointer let's use "0"
instead of "NULL". The point of using "0" consistently is to pick one,
and to not have the reader wonder why we're not using the same pattern
everywhere.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cb/remote-ndebug-fix'</title>
<updated>2021-09-10T18:46:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-09-10T18:46:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a4b1a0ade42a03e81376144653400c061fa6ed52'/>
<id>urn:sha1:a4b1a0ade42a03e81376144653400c061fa6ed52</id>
<content type='text'>
Build fix.

* cb/remote-ndebug-fix:
  remote: avoid -Wunused-but-set-variable in gcc with -DNDEBUG
</content>
</entry>
<entry>
<title>remote: avoid -Wunused-but-set-variable in gcc with -DNDEBUG</title>
<updated>2021-09-02T20:13:19Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2021-09-02T08:52:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6540b716140784f329de7bac954d2651e9d3e321'/>
<id>urn:sha1:6540b716140784f329de7bac954d2651e9d3e321</id>
<content type='text'>
In make_remote(), we store the return value of hashmap_put() and check
it using assert(), but don't otherwise use it. If Git is compiled with
NDEBUG, then the assert() becomes a noop, and nobody looks at the
variable at all. This causes some compilers to produce warnings.

Let's switch it instead to a BUG(). This accomplishes the same thing,
but is always compiled in (and we don't have to worry about the cost;
the check is cheap, and this is not a hot code path).

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
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>advice: remove read uses of most global `advice_` variables</title>
<updated>2021-08-25T19:07:52Z</updated>
<author>
<name>Ben Boeckel</name>
<email>mathstuf@gmail.com</email>
</author>
<published>2021-08-23T10:44:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ed9bff0817d5a7500b50a39c1c35b44aa3e72578'/>
<id>urn:sha1:ed9bff0817d5a7500b50a39c1c35b44aa3e72578</id>
<content type='text'>
In c4a09cc9ccb (Merge branch 'hw/advise-ng', 2020-03-25), a new API for
accessing advice variables was introduced and deprecated `advice_config`
in favor of a new array, `advice_setting`.

This patch ports all but two uses which read the status of the global
`advice_` variables over to the new `advice_enabled` API. We'll deal
with advice_add_embedded_repo and advice_graft_file_deprecated
separately.

Signed-off-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>*: fix typos which duplicate a word</title>
<updated>2021-06-14T01:16:06Z</updated>
<author>
<name>Andrei Rybak</name>
<email>rybak.a.v@gmail.com</email>
</author>
<published>2021-06-11T11:18:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=abcb66c614c574cfa1afccb230bf22cbde4d5557'/>
<id>urn:sha1:abcb66c614c574cfa1afccb230bf22cbde4d5557</id>
<content type='text'>
Fix typos in documentation, code comments, and RelNotes which repeat
various words.  In trivial cases, just delete the duplicated word and
rewrap text, if needed.  Reword the affected sentence in
Documentation/RelNotes/1.8.4.txt for it to make sense.

Signed-off-by: Andrei Rybak &lt;rybak.a.v@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
