From: David Lang <david@lang.hm>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Is there a way to have a local version of a header file?
Date: Sat, 18 Mar 2017 07:58:14 -0700 (PDT) [thread overview]
Message-ID: <nycvar.QRO.7.75.62.1703180750460.3797@qynat-yncgbc> (raw)
In-Reply-To: <CACBZZX5FMdjuxxNru+XfTQdSXEQ_b0OP2rngGZLf1sSHR_D8Ng@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]
On Sat, 18 Mar 2017, Ævar Arnfjörð Bjarmason wrote:
> On Sat, Mar 18, 2017 at 3:29 PM, David Lang <david@lang.hm> wrote:
>> for an embedded project built inside the Arduino IDE, (alternate firmware
>> for a home automation project) there is a need to set a number of parameters
>> that we really don't want in the main repo (wifi network IDs/passwords)
>>
>> right now, we have these things set as #defines in a header file.
>>
>> We need to distribute a base version of this file for new people to get
>> started.
>>
>> Is there any way to have git define a file in such a way that if it doesn't
>> exist in the worktree it gets populated, but if it does exist it doesn't get
>> overwritten? (as I type this, I'm thinking a trigger may work, but we need
>> it to work on Linux, Windows and OSX)
>>
>> Any thoughts on a sane way to handle this situation?
>
> There's no sane way to do what you're describing without renaming the file.
>
> But the sanest way to do this is to have a config.h.example
>
> Then you have "/config.h" in the .gitignore file.
>
> And you tell the users to copy the *.example file to *.h, and your
> program then includes the *.h file.
>
> If you wanted to provide defaults you could just #include the
> config.h.example first, so #defines in the *.h file would clobber
> those in the *.example.
That's what we currently have (user_config.h and user_config_override.h)
I was hoping to not have the situation where downloading and trying to compile
will complain about a missing include file (if the users don't copy
user_config_override_example.h to user_config_override.h) while letting us do a
.gitignore on user_config_override.h
for many people using this project, this is the first time they have ever
compiled anything, and we have the typical set of people not reading
instructions :-/
Darn, I was hoping that the scenario of needing to have a config file provided
in the repo, while not overwriting local changes to it was common enough that
there were some tricks available. This is a little harder as the running code
doesn't have a filesystem so we are limited to what we can do in the compiler
and git (no makefile even, the Arduino folks consider that too complicated, it
just slurps up all .ino files in a directory and compiles them)
next prev parent reply other threads:[~2017-03-18 15:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-18 14:29 Is there a way to have a local version of a header file? David Lang
2017-03-18 14:48 ` Ævar Arnfjörð Bjarmason
2017-03-18 14:58 ` David Lang [this message]
2017-03-18 17:08 ` Ævar Arnfjörð Bjarmason
2017-03-18 18:05 ` Junio C Hamano
2017-03-18 22:40 ` David Lang
2017-03-18 23:11 ` Junio C Hamano
2017-03-18 23:22 ` Samuel Lijin
2017-03-19 21:33 ` Johannes Sixt
2017-03-19 0:19 ` David Lang
2017-03-18 18:21 ` Jakub Narębski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.75.62.1703180750460.3797@qynat-yncgbc \
--to=david@lang.hm \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).