mbox series

[RFC,0/6,RFC] Introduce cgit-rs, a Rust wrapper around libgit.a

Message ID cover.1723054623.git.steadmon@google.com (mailing list archive)
Headers show
Series Introduce cgit-rs, a Rust wrapper around libgit.a | expand

Message

Josh Steadmon Aug. 7, 2024, 6:21 p.m. UTC
When we, the Git team at Google, first embarked on the libification
journey, we didn’t have a specific consumer to build a library for but
instead were interested in the various potential benefits of
libification for many use cases such as VFSes and submodules. Without a
specific consumer, it has been difficult to evaluate the scope of what
is necessary or not even for the first library, git-std-lib. Attempting
to solve problems such as error handling, symbol collisions, and
internal/external interfaces, in addition to separating out a library
turns out to be both too complex of a task to both develop and review
all at once. While we strive to eventually build an ideal library, we
have also realized in order to make meaningful and consistent progress,
we have to solve these problems iteratively in smaller pieces. That is
why over the last month, we have been working with the jj project [1] to
understand their current usage of libgit2-rs [2] and gitoxide [3] and
future library functionality they would be interested in. In doing so,
we have built cgit-rs, a Rust wrapper around libgit.a that allows Rust
code to call various basic Git functions.

[1] https://github.com/martinvonz/jj
[2] https://github.com/rust-lang/git2-rs
[3] https://github.com/Byron/gitoxide

This series provides a small Rust wrapper library around parts of
libgit.a, and a proof-of-concept Rust executable that uses the library
to interface with Git. Additionally, we have tested building JJ with our
library and used it to replace some of the libgit2-rs uses.

This exercise has clarified a lot of things for us, and we believe that
developing this wrapper further provides benefits both for downstream
consumers and the Git project itself:
* cgit-rs provides wrappers for Rust consumers of libraries (eg. jj)
* cgit-rs suggests focus areas for libification
  * shows us what potential challenges we face with library consumers
* Git libification improves git interfaces
* Libification improves cgit-rs FFI.

We are putting error handling on hold for now since it is too complex
and we intend other CLIs to be our first customers, in which case
printing out errors is not the worst.

While the wrapper itself lives in contrib/, there are a couple of
patches that touch git.git code. These patches are necessary for the
wrapper, but not for git.git itself, which may seem unnecessary to
merge. However, I would argue that other languages (not just limited to
Rust) have issues calling functions that require a pointer to
non-generic objects and essentially require a redefinition in their own
language.

We're sending this series as RFC because there is remaining work
we'd like to do, but we'd like to get early feedback on this approach,
and particularly to ask for advice on a few topics:

* alternative methods of exposing only a subset of symbols in our
  library

* bikeshedding on the name (yes, really). There is an active, unrelated
  CGit project [4] that we only recently became aware of. We originally
  took the name "cgit" because at $DAYJOB we sometimes refer to git.git
  as "cgit" to distinguish it from jgit [5].

* gauging the level of interest in calling Git code from Rust

[4] https://git.zx2c4.com/cgit
[5] https://www.eclipse.org/jgit

Remaining work includes:

* finding a better solution to the common-main split. We should probably
  have a separate initialization function including all of main() up to
  the call to cmd_main(), which can then be exposed in cgit-rs.

* adding unit and integration tests

* Makefile cleanup, particularly adding config.mak options that
  developers can set to run Rust builds and tests by default

* automating the process of exporting additional functions via cgit-rs
  (possibly with a wrapper script around bindgen [6])

[6] https://github.com/rust-lang/rust-bindgen

Finally, a quick discussion about symbol collisions: if functions are
not prepended with “libgit_” or something similar, it leaves us open to
collision issues in the future – so this probably would’ve happened with
libification in general to begin with. Therefore it seems necessary to
have to wrap all the symbols we are looking to expose. While this seem
non-ideal, we couldn’t come up with a better method. Our next best
alternative is to simply expose all symbols by default, but this leads
to symbol collisions when library users link both cgit-rs and
libgit2-rs.


Calvin Wan (2):
  contrib/cgit-rs: add repo initialization and config access
  contrib/cgit-rs: add a subset of configset wrappers

Josh Steadmon (4):
  common-main: split common_exit() into a new file
  repository: add initialize_repo wrapper without pointer
  contrib/cgit-rs: introduce Rust wrapper for libgit.a
  config: add git_configset_alloc

 .gitignore                             |  1 +
 Makefile                               | 14 ++++
 common-exit.c                          | 26 +++++++
 common-main.c                          | 24 -------
 config.c                               |  5 ++
 config.h                               |  5 ++
 contrib/cgit-rs/Cargo.lock             | 99 ++++++++++++++++++++++++++
 contrib/cgit-rs/Cargo.toml             | 17 +++++
 contrib/cgit-rs/README.md              | 15 ++++
 contrib/cgit-rs/build.rs               | 33 +++++++++
 contrib/cgit-rs/public_symbol_export.c | 72 +++++++++++++++++++
 contrib/cgit-rs/public_symbol_export.h | 26 +++++++
 contrib/cgit-rs/src/lib.rs             | 81 +++++++++++++++++++++
 contrib/cgit-rs/src/main.rs            | 44 ++++++++++++
 repository.c                           |  9 +++
 repository.h                           |  1 +
 16 files changed, 448 insertions(+), 24 deletions(-)
 create mode 100644 common-exit.c
 create mode 100644 contrib/cgit-rs/Cargo.lock
 create mode 100644 contrib/cgit-rs/Cargo.toml
 create mode 100644 contrib/cgit-rs/README.md
 create mode 100644 contrib/cgit-rs/build.rs
 create mode 100644 contrib/cgit-rs/public_symbol_export.c
 create mode 100644 contrib/cgit-rs/public_symbol_export.h
 create mode 100644 contrib/cgit-rs/src/lib.rs
 create mode 100644 contrib/cgit-rs/src/main.rs


base-commit: 557ae147e6cdc9db121269b058c757ac5092f9c9

Comments

brian m. carlson Aug. 7, 2024, 10:03 p.m. UTC | #1
On 2024-08-07 at 18:21:25, Josh Steadmon wrote:
> We are putting error handling on hold for now since it is too complex
> and we intend other CLIs to be our first customers, in which case
> printing out errors is not the worst.

While I think that's okay for now, that really needs to be one of the
first priorities of things we fix.  I have some ideas about an approach
which we can take, which I'll send out in the next few days in a
separate thread.

> While the wrapper itself lives in contrib/, there are a couple of
> patches that touch git.git code. These patches are necessary for the
> wrapper, but not for git.git itself, which may seem unnecessary to
> merge. However, I would argue that other languages (not just limited to
> Rust) have issues calling functions that require a pointer to
> non-generic objects and essentially require a redefinition in their own
> language.

I don't see a problem with this.  It seems very self contained.

> We're sending this series as RFC because there is remaining work
> we'd like to do, but we'd like to get early feedback on this approach,
> and particularly to ask for advice on a few topics:
> 
> * alternative methods of exposing only a subset of symbols in our
>   library

We should probably support symbol versioning in the libgit_ code on
supported platforms if we're going to expose it.  Otherwise, we're
setting ourselves and distributors up for a world of pain when we change
the ABI, such as when we add error handling.

> * bikeshedding on the name (yes, really). There is an active, unrelated
>   CGit project [4] that we only recently became aware of. We originally
>   took the name "cgit" because at $DAYJOB we sometimes refer to git.git
>   as "cgit" to distinguish it from jgit [5].
> 
> * gauging the level of interest in calling Git code from Rust

I left some comments in the series.  I think this is a nice first step
as a proof of concept, and I'm very pleased to see it.

If your goal is to simply expose C APIs, I suggest calling it something
like cgit-sys, since the -sys suffix is customary for wrappers of C
libraries.  If your goal is to provide actual wrappers that people will
use in real Rust code, then I think that we should _not_ expose the C
API, since most Rust users will not want to use that.
Josh Steadmon Aug. 7, 2024, 11:19 p.m. UTC | #2
On 2024.08.07 22:03, brian m. carlson wrote:
> On 2024-08-07 at 18:21:25, Josh Steadmon wrote:
> > We are putting error handling on hold for now since it is too complex
> > and we intend other CLIs to be our first customers, in which case
> > printing out errors is not the worst.
> 
> While I think that's okay for now, that really needs to be one of the
> first priorities of things we fix.  I have some ideas about an approach
> which we can take, which I'll send out in the next few days in a
> separate thread.

I'll be very interested in seeing this, please CC me.


> > While the wrapper itself lives in contrib/, there are a couple of
> > patches that touch git.git code. These patches are necessary for the
> > wrapper, but not for git.git itself, which may seem unnecessary to
> > merge. However, I would argue that other languages (not just limited to
> > Rust) have issues calling functions that require a pointer to
> > non-generic objects and essentially require a redefinition in their own
> > language.
> 
> I don't see a problem with this.  It seems very self contained.
> 
> > We're sending this series as RFC because there is remaining work
> > we'd like to do, but we'd like to get early feedback on this approach,
> > and particularly to ask for advice on a few topics:
> > 
> > * alternative methods of exposing only a subset of symbols in our
> >   library
> 
> We should probably support symbol versioning in the libgit_ code on
> supported platforms if we're going to expose it.  Otherwise, we're
> setting ourselves and distributors up for a world of pain when we change
> the ABI, such as when we add error handling.

Symbol visibility and versioning are both areas I'm not very familiar
with. I'll do some homework but might need additional help later on, so
please keep an eye out for beginner mistakes I might make in later
versions.


> > * bikeshedding on the name (yes, really). There is an active, unrelated
> >   CGit project [4] that we only recently became aware of. We originally
> >   took the name "cgit" because at $DAYJOB we sometimes refer to git.git
> >   as "cgit" to distinguish it from jgit [5].
> > 
> > * gauging the level of interest in calling Git code from Rust
> 
> I left some comments in the series.  I think this is a nice first step
> as a proof of concept, and I'm very pleased to see it.
> 
> If your goal is to simply expose C APIs, I suggest calling it something
> like cgit-sys, since the -sys suffix is customary for wrappers of C
> libraries.  If your goal is to provide actual wrappers that people will
> use in real Rust code, then I think that we should _not_ expose the C
> API, since most Rust users will not want to use that.
> -- 
> brian m. carlson (they/them or he/him)
> Toronto, Ontario, CA
brian m. carlson Aug. 8, 2024, 1:33 a.m. UTC | #3
On 2024-08-07 at 22:03:53, brian m. carlson wrote:
> I left some comments in the series.  I think this is a nice first step
> as a proof of concept, and I'm very pleased to see it.

I noticed a couple of other things.  First, the code has not been run
through rustfmt.  I think it would be helpful for us to do that since it
makes it easier to not argue about style and it can be easily enforced
in CI.  It will also reduce diff noise, which I expect Junio will
appreciate.

Second, cargo clippy complains about some of the code.  It's again
helpful if we can fix those warnings or, if they're not appropriate, to
disable them with an appropriate `allow` pragma.  (In this case, I think
they're both spot on, but I have seen some cases where I've disabled a
warning.)  This is something we may also want to test in CI in the
future, and downstream users of our crate will appreciate not getting
warnings when using clippy themselves, so we should be kind to them.

I noticed these because my editor complains about the latter and I have
now intuited enough of rustfmt's output that I can tell sometimes when
things aren't formatted with it.

For those members of the list who are less familiar with Rust, rustfmt
is the standard code formatter (and formatting verifier) and clippy is a
lint tool recommending best practices.  Both are shipped with Rust and
using both is customary for Rust projects.
Jason A. Donenfeld Aug. 8, 2024, 11:51 a.m. UTC | #4
Hi,

Cgit maintainer here...

On Wed, Aug 07, 2024 at 11:21:25AM -0700, Josh Steadmon wrote:
> * bikeshedding on the name (yes, really). There is an active, unrelated
>   CGit project [4] that we only recently became aware of. We originally
>   took the name "cgit" because at $DAYJOB we sometimes refer to git.git
>   as "cgit" to distinguish it from jgit [5].

Indeed, please find something else. Cgit is a real project, used by
many, such as git.kernel.org, and it'll turn into a real hassle for both
of us if there's ambiguity and confusion.

What about libgit-rs? Or even libgit3, where the rustness of it is
simply an implementation detail, so the name won't feel dated 15 years
from now when everything is written in Rust anyway and -rs is so 2020s?

Jason
Dragan Simic Aug. 8, 2024, 1:59 p.m. UTC | #5
On 2024-08-08 13:51, Jason A. Donenfeld wrote:
> Cgit maintainer here...
> 
> On Wed, Aug 07, 2024 at 11:21:25AM -0700, Josh Steadmon wrote:
>> * bikeshedding on the name (yes, really). There is an active, 
>> unrelated
>>   CGit project [4] that we only recently became aware of. We 
>> originally
>>   took the name "cgit" because at $DAYJOB we sometimes refer to 
>> git.git
>>   as "cgit" to distinguish it from jgit [5].
> 
> Indeed, please find something else. Cgit is a real project, used by
> many, such as git.kernel.org, and it'll turn into a real hassle for 
> both
> of us if there's ambiguity and confusion.

Totally agreed, naming it cgit-rs makes pretty much no sense.

> What about libgit-rs? Or even libgit3, where the rustness of it is
> simply an implementation detail, so the name won't feel dated 15 years
> from now when everything is written in Rust anyway and -rs is so 2020s?

Well, there are still very active commercial projects written in COBOL
or Clipper, for example, so I wouldn't go as far as _everything_ being
written in Rust at some point.
Randall S. Becker Aug. 8, 2024, 3:38 p.m. UTC | #6
On Thursday, August 8, 2024 9:59 AM, Dragan Simic wrote:
>On 2024-08-08 13:51, Jason A. Donenfeld wrote:
>> Cgit maintainer here...
>>
>> On Wed, Aug 07, 2024 at 11:21:25AM -0700, Josh Steadmon wrote:
>>> * bikeshedding on the name (yes, really). There is an active,
>>> unrelated
>>>   CGit project [4] that we only recently became aware of. We
>>> originally
>>>   took the name "cgit" because at $DAYJOB we sometimes refer to
>>> git.git
>>>   as "cgit" to distinguish it from jgit [5].
>>
>> Indeed, please find something else. Cgit is a real project, used by
>> many, such as git.kernel.org, and it'll turn into a real hassle for
>> both of us if there's ambiguity and confusion.
>
>Totally agreed, naming it cgit-rs makes pretty much no sense.
>
>> What about libgit-rs? Or even libgit3, where the rustness of it is
>> simply an implementation detail, so the name won't feel dated 15 years
>> from now when everything is written in Rust anyway and -rs is so 2020s?
>
>Well, there are still very active commercial projects written in COBOL or Clipper, for
>example, so I wouldn't go as far as _everything_ being written in Rust at some point.

There are hundreds of millions of lines of code in the NonStop (TAL, COBOL, C, Java,
in that order) community that is actively maintained to this day, with no Rust
involvement (not for lack of trying to get Rust ported). Without these projects, most
of your credit and debit cards would probably not work. 
Dragan Simic Aug. 8, 2024, 3:47 p.m. UTC | #7
On 2024-08-08 17:38, rsbecker@nexbridge.com wrote:
> On Thursday, August 8, 2024 9:59 AM, Dragan Simic wrote:
>> On 2024-08-08 13:51, Jason A. Donenfeld wrote:
>>> Cgit maintainer here...
>>> 
>>> On Wed, Aug 07, 2024 at 11:21:25AM -0700, Josh Steadmon wrote:
>>>> * bikeshedding on the name (yes, really). There is an active,
>>>> unrelated
>>>>   CGit project [4] that we only recently became aware of. We
>>>> originally
>>>>   took the name "cgit" because at $DAYJOB we sometimes refer to
>>>> git.git
>>>>   as "cgit" to distinguish it from jgit [5].
>>> 
>>> Indeed, please find something else. Cgit is a real project, used by
>>> many, such as git.kernel.org, and it'll turn into a real hassle for
>>> both of us if there's ambiguity and confusion.
>> 
>> Totally agreed, naming it cgit-rs makes pretty much no sense.
>> 
>>> What about libgit-rs? Or even libgit3, where the rustness of it is
>>> simply an implementation detail, so the name won't feel dated 15 
>>> years
>>> from now when everything is written in Rust anyway and -rs is so 
>>> 2020s?
>> 
>> Well, there are still very active commercial projects written in COBOL 
>> or Clipper, for
>> example, so I wouldn't go as far as _everything_ being written in Rust 
>> at some point.
> 
> There are hundreds of millions of lines of code in the NonStop (TAL,
> COBOL, C, Java,
> in that order) community that is actively maintained to this day, with 
> no Rust
> involvement (not for lack of trying to get Rust ported). Without these
> projects, most
> of your credit and debit cards would probably not work. 
Junio C Hamano Aug. 8, 2024, 5:20 p.m. UTC | #8
"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> Cgit maintainer here...
>
> On Wed, Aug 07, 2024 at 11:21:25AM -0700, Josh Steadmon wrote:
>> * bikeshedding on the name (yes, really). There is an active, unrelated
>>   CGit project [4] that we only recently became aware of. We originally
>>   took the name "cgit" because at $DAYJOB we sometimes refer to git.git
>>   as "cgit" to distinguish it from jgit [5].
>
> Indeed, please find something else. Cgit is a real project, used by
> many, such as git.kernel.org, and it'll turn into a real hassle for both
> of us if there's ambiguity and confusion.
>
> What about libgit-rs? Or even libgit3, where the rustness of it is
> simply an implementation detail, so the name won't feel dated 15 years
> from now when everything is written in Rust anyway and -rs is so 2020s?

libgit-rs sounds like a descriptive and good name.

I am not sure about the wisdom of _not_ saying anything about Rust.
In 2035 maybe nobody is writing in Rust but in not-yet-invented
alternative that is even better.
Junio C Hamano Aug. 9, 2024, 7:22 p.m. UTC | #9
Josh Steadmon <steadmon@google.com> writes:

> We're sending this series as RFC because there is remaining work
> we'd like to do, but we'd like to get early feedback on this approach,
> and particularly to ask for advice on a few topics:

I am not sure how much this is reusable, after seeing comments that
"cgit-rs" may not be the best name for this thing and pathnames may
have to change, but I needed the following merge-fix to get this
into "seen" and have the result pass "make", due to interactions
with the ps/config-wo-the-repository topic.

 contrib/cgit-rs/public_symbol_export.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/cgit-rs/public_symbol_export.c b/contrib/cgit-rs/public_symbol_export.c
index 9641afca89..2732f5898e 100644
--- a/contrib/cgit-rs/public_symbol_export.c
+++ b/contrib/cgit-rs/public_symbol_export.c
@@ -9,6 +9,8 @@
 #include "setup.h"
 #include "version.h"
 
+extern struct repository *the_repository;
+
 #pragma GCC visibility push(default)
 
 const char *libgit_setup_git_directory(void)
@@ -18,7 +20,7 @@ const char *libgit_setup_git_directory(void)
 
 int libgit_config_get_int(const char *key, int *dest)
 {
-	return git_config_get_int(key, dest);
+	return repo_config_get_int(the_repository, key, dest);
 }
 
 void libgit_initialize_the_repository(void)
Junio C Hamano Aug. 9, 2024, 7:29 p.m. UTC | #10
Junio C Hamano <gitster@pobox.com> writes:

> Josh Steadmon <steadmon@google.com> writes:
>
>> We're sending this series as RFC because there is remaining work
>> we'd like to do, but we'd like to get early feedback on this approach,
>> and particularly to ask for advice on a few topics:
>
> I am not sure how much this is reusable, after seeing comments that
> "cgit-rs" may not be the best name for this thing and pathnames may
> have to change, but I needed the following merge-fix to get this
> into "seen" and have the result pass "make", due to interactions
> with the ps/config-wo-the-repository topic.

In case you are wondering "so... is there anything actionable for
*US*???", there isn't, exactly.  But you'd need to holler if the
"merge-fix" you saw in the message not correctly addressing the
semantic clash between these two topics.

Thanks.

>
>  contrib/cgit-rs/public_symbol_export.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/cgit-rs/public_symbol_export.c b/contrib/cgit-rs/public_symbol_export.c
> index 9641afca89..2732f5898e 100644
> --- a/contrib/cgit-rs/public_symbol_export.c
> +++ b/contrib/cgit-rs/public_symbol_export.c
> @@ -9,6 +9,8 @@
>  #include "setup.h"
>  #include "version.h"
>  
> +extern struct repository *the_repository;
> +
>  #pragma GCC visibility push(default)
>  
>  const char *libgit_setup_git_directory(void)
> @@ -18,7 +20,7 @@ const char *libgit_setup_git_directory(void)
>  
>  int libgit_config_get_int(const char *key, int *dest)
>  {
> -	return git_config_get_int(key, dest);
> +	return repo_config_get_int(the_repository, key, dest);
>  }
>  
>  void libgit_initialize_the_repository(void)
Junio C Hamano Aug. 9, 2024, 8:54 p.m. UTC | #11
Junio C Hamano <gitster@pobox.com> writes:

> Josh Steadmon <steadmon@google.com> writes:
>
>> We're sending this series as RFC because there is remaining work
>> we'd like to do, but we'd like to get early feedback on this approach,
>> and particularly to ask for advice on a few topics:
>
> I am not sure how much this is reusable, after seeing comments that
> "cgit-rs" may not be the best name for this thing and pathnames may
> have to change, but I needed the following merge-fix to get this
> into "seen" and have the result pass "make", due to interactions
> with the ps/config-wo-the-repository topic.
>
>  contrib/cgit-rs/public_symbol_export.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

There is another thing.

Listing this file in $(OBJECTS) means that you should be able to
pass "make sparse" to build contrib/cgit-rs/public_symbol_export.sp
but it seems to fail rather miserably.  I am tempted to suggest in
the meantime to futz with $(SP_OBJ) to filter it out in the top
level Makefile.
Josh Steadmon Aug. 9, 2024, 10:16 p.m. UTC | #12
On 2024.08.08 01:33, brian m. carlson wrote:
> On 2024-08-07 at 22:03:53, brian m. carlson wrote:
> > I left some comments in the series.  I think this is a nice first step
> > as a proof of concept, and I'm very pleased to see it.
> 
> I noticed a couple of other things.  First, the code has not been run
> through rustfmt.  I think it would be helpful for us to do that since it
> makes it easier to not argue about style and it can be easily enforced
> in CI.  It will also reduce diff noise, which I expect Junio will
> appreciate.
> 
> Second, cargo clippy complains about some of the code.  It's again
> helpful if we can fix those warnings or, if they're not appropriate, to
> disable them with an appropriate `allow` pragma.  (In this case, I think
> they're both spot on, but I have seen some cases where I've disabled a
> warning.)  This is something we may also want to test in CI in the
> future, and downstream users of our crate will appreciate not getting
> warnings when using clippy themselves, so we should be kind to them.
> 
> I noticed these because my editor complains about the latter and I have
> now intuited enough of rustfmt's output that I can tell sometimes when
> things aren't formatted with it.
> 
> For those members of the list who are less familiar with Rust, rustfmt
> is the standard code formatter (and formatting verifier) and clippy is a
> lint tool recommending best practices.  Both are shipped with Rust and
> using both is customary for Rust projects.
> -- 
> brian m. carlson (they/them or he/him)
> Toronto, Ontario, CA

Applied Clippy and rustfmt fixes throughout V2, thanks for the catch.
Junio C Hamano Aug. 9, 2024, 10:26 p.m. UTC | #13
Junio C Hamano <gitster@pobox.com> writes:

>>  contrib/cgit-rs/public_symbol_export.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> There is another thing.
>
> Listing this file in $(OBJECTS) means that you should be able to
> pass "make sparse" to build contrib/cgit-rs/public_symbol_export.sp
> but it seems to fail rather miserably.  I am tempted to suggest in
> the meantime to futz with $(SP_OBJ) to filter it out in the top
> level Makefile.

FWIW, this one _is_ actionable on your end ;-)  Make sure "make sparse"
does not barf due to the addition of libgit-rust.
Josh Steadmon Aug. 9, 2024, 10:27 p.m. UTC | #14
On 2024.08.09 12:29, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Josh Steadmon <steadmon@google.com> writes:
> >
> >> We're sending this series as RFC because there is remaining work
> >> we'd like to do, but we'd like to get early feedback on this approach,
> >> and particularly to ask for advice on a few topics:
> >
> > I am not sure how much this is reusable, after seeing comments that
> > "cgit-rs" may not be the best name for this thing and pathnames may
> > have to change, but I needed the following merge-fix to get this
> > into "seen" and have the result pass "make", due to interactions
> > with the ps/config-wo-the-repository topic.
> 
> In case you are wondering "so... is there anything actionable for
> *US*???", there isn't, exactly.  But you'd need to holler if the
> "merge-fix" you saw in the message not correctly addressing the
> semantic clash between these two topics.
> 
> Thanks.

Looks fine to me, applied in V2.
Josh Steadmon Aug. 9, 2024, 10:28 p.m. UTC | #15
On 2024.08.09 13:54, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Josh Steadmon <steadmon@google.com> writes:
> >
> >> We're sending this series as RFC because there is remaining work
> >> we'd like to do, but we'd like to get early feedback on this approach,
> >> and particularly to ask for advice on a few topics:
> >
> > I am not sure how much this is reusable, after seeing comments that
> > "cgit-rs" may not be the best name for this thing and pathnames may
> > have to change, but I needed the following merge-fix to get this
> > into "seen" and have the result pass "make", due to interactions
> > with the ps/config-wo-the-repository topic.
> >
> >  contrib/cgit-rs/public_symbol_export.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> There is another thing.
> 
> Listing this file in $(OBJECTS) means that you should be able to
> pass "make sparse" to build contrib/cgit-rs/public_symbol_export.sp
> but it seems to fail rather miserably.  I am tempted to suggest in
> the meantime to futz with $(SP_OBJ) to filter it out in the top
> level Makefile.

I believe that I fixed `make sparse` (at least in GitHub CI, it fails
for seemingly unrelated reasons on my desktop) by removing some
unnecessarily exposed symbols in public_symbol_export.c. If it still
fails for you in V2, please let me know.
Junio C Hamano Aug. 9, 2024, 10:32 p.m. UTC | #16
Josh Steadmon <steadmon@google.com> writes:

> On 2024.08.09 13:54, Junio C Hamano wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>> 
>> > Josh Steadmon <steadmon@google.com> writes:
>> >
>> >> We're sending this series as RFC because there is remaining work
>> >> we'd like to do, but we'd like to get early feedback on this approach,
>> >> and particularly to ask for advice on a few topics:
>> >
>> > I am not sure how much this is reusable, after seeing comments that
>> > "cgit-rs" may not be the best name for this thing and pathnames may
>> > have to change, but I needed the following merge-fix to get this
>> > into "seen" and have the result pass "make", due to interactions
>> > with the ps/config-wo-the-repository topic.
>> >
>> >  contrib/cgit-rs/public_symbol_export.c | 4 +++-
>> >  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> There is another thing.
>> 
>> Listing this file in $(OBJECTS) means that you should be able to
>> pass "make sparse" to build contrib/cgit-rs/public_symbol_export.sp
>> but it seems to fail rather miserably.  I am tempted to suggest in
>> the meantime to futz with $(SP_OBJ) to filter it out in the top
>> level Makefile.
>
> I believe that I fixed `make sparse` (at least in GitHub CI, it fails
> for seemingly unrelated reasons on my desktop) by removing some
> unnecessarily exposed symbols in public_symbol_export.c. If it still
> fails for you in V2, please let me know.

Thanks.  Please let me know when you send v2 out ;-)