Subject: Re: [PATCH v2 07/18] build: introduce rust

From: Junio C Hamano <[email-masked]>
Date: Wed, 17 Sep 2025 07:54:16 -0700

Eric Sunshine <[email-masked]> writes:

>> diff --git a/.gitignore b/.gitignore
>> @@ -254,3 +254,6 @@ Release/
>>  /contrib/buildsystems/out
>>  /contrib/libgit-rs/target
>>  /contrib/libgit-sys/target
>> +.idea/
>> +/rust/target/
>> +/rust/Cargo.lock
>
> Is ".idea" directory detritus from your chosen editor? If so, it
> probably ought not be added to this list since we don't otherwise
> ignore detritus from foreign tools such as that.

I knew that the above was our official stance but somehow thought
that we loosened at some point to add common ones like *~ and
*.sw[op] to make life simpler for majority of developers.  But I was
wrong.  We do not even have *~, which means we haven't officially
loosened.

But there are oddballs that violate this policy like ".cache"
introduced by a5c01603 (gitignore: ignore clangd .cache directory,
2023-08-04).  Three are many other that are *not* our droppings,
between /.vscode/ to /contrib/buildsystems/out in .gitignore file.

    /.vscode/
    /tags
    /TAGS
    /cscope*
    /compile_commands.json
    /.cache/
    *.hcc
    *.obj
    *.lib
    *.sln
    *.sp
    *.suo
    *.ncb
    *.vcproj
    *.user
    *.idb
    *.pdb
    *.ilk
    *.iobj
    *.ipdb
    *.dll
    .vs/
    Debug/
    Release/
    /UpgradeLog*.htm
    /git.VC.VC.opendb
    /git.VC.db
    *.dSYM

Some (like TAGS and *.hcc) are our droppings (in other words, what
"make" with some build targets may produce), but most of these are
tool specific and according to our original official stance, they
should never have been added, but there they are.

I actually do not mind having common ones to the project .gitignore
as long as it does not get bloated too much with droppings from
esoteric tools that majority of us have never heard of.  It seems
that we have been punishing needlessly Emacs and vim users while
being sloppy about others' droppings.  A #leftoverbit may be to
have a brief discussion to gain consensus and add a few common ones
and/or remove too esoteric ones?  I dunno. 

>> +$(GIT_BUILD_DIR)/lib%.a:
>> +       ./build_rust.sh $(GIT_BUILD_DIR) $(RUST_BUILD_MODE) $*
>
> I wonder if this should follow the convention of most (but not quite
> all) other local shell script invocations in the Makefile of
> referencing SHELL_PATH; for instance:
>
>     $(QUIET_GEN)$(SHELL_PATH) ./build_rust.sh ...etc...
>
> with or without the $(QUIET_GEN) bit.

Good suggestion.  This reminds me of my favorite gripe, which is
that "make clean" makes no effort to be quiet by default; perhaps
leaving a #leftover bit marker here would help?

Thanks.