git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tilo Schwarz" <tilo@tilo-schwarz.de>
To: git@vger.kernel.org
Subject: Re: How to manage parameter files and code separately using git?
Date: Sun, 02 May 2010 11:18:30 +0200	[thread overview]
Message-ID: <op.vb2ms4r8a8ed4e@dellschleppa> (raw)
In-Reply-To: <7vmxwj5ym8.fsf@alter.siamese.dyndns.org>

On Sat, 01 May 2010 19:18:55 +0200, Junio C Hamano <gitster@pobox.com>  
wrote:

Thank you for the detailed explanation!

> This design constraint makes the issue not a version control problem but
> more of a software engineering problem.  The changes to your parameter
> file have its own history (e.g. you upgraded your machine last week with
> different hardware---the software didn't change but the parameter has to)
> and the history is largely independent of the software that reads the
> file.  In that sense, you should _never_ tie its history with the history
> of your software.

Ok.

> At the same time, the history of the parameter file is not completely
> independent of that of the software.  You may have added a new feature  
> and code to read a new setting in the parameter file today and older  
> parameter file would not have a setting for that variable.

Exactly.

> The method I used in my day-job project is something like this:
>
>  - Include a "config.sample" file and track it in the history of the
>    source code; the values it gives to the variables are the same as the
>    default ones.  This file mostly serves as a documentation.

I actually did exactly that already (but forgot to mention it in my first  
mail, sorry!). The problem with this "one" config.sample is, that I need  
about three really different config files because of really different  
sensor setups on about five different computers. So when I push on a USB  
stick, walk to another computer, then pull and try to run the software -  
bummer, forgot to copy the current config file - walk back, copy ...
But maybe the solution below solves this too. Or I write a little script  
doing the push and parameter file copy.

>  - Design your parameter mechanism in a way that:
>
>    - a parameter file can include another;

Can't do that yet.

>    - an unrecognized parameter setting is ignored;

Can do.

>    - a variable definition that happens later overrides an earlier
>      definition.

Can do.

>  - Have a real parameter file that is _not_ tracked in the history of the
>    source code.  Have it include parameter.sample and then define machine
>    specific settings after that to override.

Good idea.

> It is only required for the "real" parameter file not to be tracked in  
> the history of the source code---it is perfectly fine to track it in a
> separate history.  The easiest way to do this would be to keep a  
> parameter working tree next door, and "ln -s ../params/config config" in  
> the working tree for the source code.  You could keep this symlink  
> tracked in the
> source history, but you do not have to.

I see. So if I want parameter file history the only proper solution is to  
have a separate parameter file git repo, right?

> You will try to read from ./config, which will include ./config.sample in
> order to read the default, and then read the customized setting that
> appear later in ./config.  Because of the symlink, you will actually be
> reading from ../params/config next door.

Ok, will give it a try.

-- 
Regards,

	Tilo

  reply	other threads:[~2010-05-02  9:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-01 12:57 How to manage parameter files and code separately using git? Tilo Schwarz
2010-05-01 17:18 ` Junio C Hamano
2010-05-02  9:18   ` Tilo Schwarz [this message]
2010-05-02 15:52     ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.vb2ms4r8a8ed4e@dellschleppa \
    --to=tilo@tilo-schwarz.de \
    --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.
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 NNTP newsgroup(s).