Catalin Marinas [off-list ref] writes:
quoted
- Configuration files (Linus).
Since the configuration files use the .ini like syntax, is it OK for
StGIT to use the same file, with an "[stgit]" section?
I think that is a reasonable thing to do.
On Tue, 25 Oct 2005, Junio C Hamano wrote:
Catalin Marinas [off-list ref] writes:
quoted
quoted
- Configuration files (Linus).
Since the configuration files use the .ini like syntax, is it OK for
StGIT to use the same file, with an "[stgit]" section?
I think that is a reasonable thing to do.
Absolutely. The whole thing was _designed_ to be used that way. Any C user
should be able to just link against config.o without even bothering with
the rest of git (the only git-specific thing there should be some naming),
and any script user can either
- parse the simple config language by hand (not really a good idea, but
it _is_ pretty simple)
- just run "git-var -l" and parse the output.
ie if you want to track "[stgit]" config options, just do
git-var -l | sed '/^stgit\./ s/^stgit.//p'
and it will pick up everything starting with "stgit." and remove that
part.
What remains should be a simple list or "variable=value" pairs.
Oh - and the convention is that
(a) we've already done any quote expansion (although I may have to make
git-var quote "\n" - I didn't care enough to do so)
(b) a boolean variable without a "=" means that it was set to "true"
(which is different from an _empty_ one, which has a "=" but just
doesn't have any value)
The (b) thing is just a special case, so that you can write
[stgit]
debug
and it will be the same as
[stgit]
debug = true
which just seems to be the sane thing to do.
Linus
On 25/10/05, Linus Torvalds [off-list ref] wrote:
On Tue, 25 Oct 2005, Junio C Hamano wrote:
quoted
Catalin Marinas [off-list ref] writes:
quoted
Since the configuration files use the .ini like syntax, is it OK for
StGIT to use the same file, with an "[stgit]" section?
I think that is a reasonable thing to do.
Absolutely. The whole thing was _designed_ to be used that way. Any C user
should be able to just link against config.o without even bothering with
the rest of git (the only git-specific thing there should be some naming),
and any script user can either
I use Python for StGIT and it has support for parsing .ini syntax, no
need to use GIT for this (unless the syntax you chose would diverge
too much).
--
Catalin
On Wed, 26 Oct 2005, Catalin Marinas wrote:
I use Python for StGIT and it has support for parsing .ini syntax, no
need to use GIT for this (unless the syntax you chose would diverge
too much).
The syntax differences I'm aware of:
- the git ".ini" parser is case-insensitive in the variable names. I
don't know if this is true in general. I do know a lot of people use
MixedCase things, but I don't know if it's because they care, or
because they think it's so pretty.
- the git parser accepts either ";" or "#" as comments, and anywhere on a
line (not just at the beginning). Again, others may or may not do the
same.
- the git parser wants a "=" for the assignment. I think the Python one
also accepts ":". If people care, we could make the git parser allow
either.
- duplicate entries. The git parser allows them, and will just pass them
on multiple times. In fact, I had a patch (that I threw out) that
depended on this, and allowed you to rewrite hostnames for git_connect
with something like
[host]
rewrite = "host.com:" "git://git.host.com/"
rewrite = "other.org:" "rsync://rsync.other.org/"
and the git config file parser happily just parses this as two
different entries for "host.rewrite"
- quoting. This is likely the big one. The git parser thinks only the
regular '"' character ("rabbit ears") is a quote, and passes single-
ticks through unmolested. I don't have a clue what others do, if
anything.
In the absense of quotes, most should be trivial to handle by just being
careful.
Linus