git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Git List <git@vger.kernel.org>,
	Christian Couder <chriscool@tuxfamily.org>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Miles Bader <miles@gnu.org>
Subject: Re: [GSoC update] Sequencer for inclusion
Date: Wed, 13 Jul 2011 15:07:24 -0400	[thread overview]
Message-ID: <20110713190724.GA31965@sigill.intra.peff.net> (raw)
In-Reply-To: <CALkWK0=EDZ9E1qYg=bEt2h3jmUUvERoiR1TpkUupRO2XrYyt9A@mail.gmail.com>

On Wed, Jul 13, 2011 at 03:11:54PM +0530, Ramkumar Ramachandra wrote:

> Ha, true.  After all .git/objects/ is "polluted" with lots of files :p
> A couple of questions arise:
> 1. Would opening, writing, closing many files not put too much strain
> on I/O, and hence affect performance significantly?

In a tight loop, perhaps. At the begining of invoking a program,
probably not. We're talking about what, a dozen or so files?

If you have doubts, then measure.

> 2. Will two options from different instructions (when we extend the
> instruction sheet to accommodate them) have the same name, but
> different effects?  Having a gitconfig-like configuration file doesn't
> solve this problem either, so it's not a "configfile versus key-value
> store" question.

If you have per-instruction options, then I think you would want your
storage of options to be per-instruction. Whether it's a config file or
files in a directory, you'd want to be accessing ".../opts/$hash" as a
config file (or ".../opts/$hash/*" for a directory).

But I have only been paying a little attention to the deeper parts of
this topic, so I may be misunderstanding what you're asking.

> > Using git-config is maybe a little more self-documenting than something
> > like "sq_quote_argv". And probably not much more code (maybe even less,
> > since it can handle the file update for you).
> 
> Yeah :)

One other advantage of "git config" over sq_quote_argv is that it is
fairly transparent to outside programs. You can just say "git config
--file=.git/sequencer/opts --get-all strategy" or whatever.

That transparency is one of the things I liked about the "files in a
directory" approach taken by rebase currently. But given that the "git
config" command exists, they are probably equivalent in that respect.

> > I recently used the config code to write out a non-standard config file.
> > My two complaints were:
> >
> >  1. You can't queue up a bunch of changes and then write the file once.
> >     Every time you call git_config_set, it rewrites the whole file.
> >
> >  2. There's no way to write to a nonstandard file short of the horribly
> >     hack-ish:
> >
> >       const char *saved = config_exclusive_filename;
> >       config_exclusive_filename = "foo.conf";
> >       git_config_set(...);
> >       config_exclusive_filename = saved;
> >
> > Point (2) is pretty easy to fix. But point (1) might be a bit more
> > involved. I haven't really looked yet.
> 
> Thanks for pointing these out.  Yes, I'm aware of these issues, and
> it's part of the reason I implemented my own parser.  It'll take some
> time to refactor config.c so that it's usable by others in a sane
> manner, no?  What do you suggest I do until then?  Can I try to get my
> custom parser merged (and replaced by a more generic configparser when
> it's ready), or should I throw away my parser and go with the
> key-value store?

I think a reasonable strategy is:

  1. Refactor git_config_set into git_config_set_in_file with a file
     argument (and make git_config_set a wrapper that uses the current
     file-selection). This should be easy to do.

  2. Ignore the fact that you are writing the file multiple times. It's
     not a correctness issue, but rather an optimization. If and when
     the config code shows itself to be too slow, then we can do that
     optimization (which will benefit not just your code, but all config
     writers).

And then throw away your parser and just use git_config_from_file and
git_config_set_in_file.

Between config and a key/value store of files, I think it is largely a
matter of taste.

> Just to clarify, here's an example to illustrate what I understand
> when you say key-value store (please correct me if I got the idea
> wrong):
> .git/sequencer/opts/ will have files like:
> $ cat ff
> true
> $ cat record-origin
> true
> $ cat mainline
> 1
> $ cat strategy
> ours
> $ cat strategy-option
> patience + renormalize

Yeah, exactly. Though I would probably use "\n" to split list items in
strategy-options, which is a little more traditional. I.e.,:

  $ cat strategy-option
  patience
  renormalize

-Peff

  reply	other threads:[~2011-07-13 19:07 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 14:53 [GSoC update] Sequencer for inclusion Ramkumar Ramachandra
2011-07-11 14:53 ` [PATCH 01/17] advice: Introduce error_resolve_conflict Ramkumar Ramachandra
2011-07-11 14:53 ` [PATCH 02/17] revert: Inline add_message_to_msg function Ramkumar Ramachandra
2011-07-12 16:53   ` Jonathan Nieder
2011-07-13  6:00     ` Ramkumar Ramachandra
2011-07-13  6:42       ` Jonathan Nieder
2011-07-19 16:36         ` Ramkumar Ramachandra
2011-07-19 16:52           ` Junio C Hamano
2011-07-19 17:08             ` Ramkumar Ramachandra
2011-07-19 19:36           ` Jonathan Nieder
2011-07-20  5:32             ` Ramkumar Ramachandra
2011-07-11 14:53 ` [PATCH 03/17] revert: Don't check lone argument in get_encoding Ramkumar Ramachandra
2011-07-12 16:59   ` Jonathan Nieder
2011-07-13  6:14     ` Ramkumar Ramachandra
2011-07-13  6:30       ` Jonathan Nieder
2011-07-11 14:53 ` [PATCH 04/17] revert: Rename no_replay to record_origin Ramkumar Ramachandra
2011-07-12 17:02   ` Jonathan Nieder
2011-07-13  7:35     ` Ramkumar Ramachandra
2011-07-17 19:36       ` Jonathan Nieder
2011-07-11 14:53 ` [PATCH 05/17] revert: Propogate errors upwards from do_pick_commit Ramkumar Ramachandra
2011-07-12 17:32   ` Jonathan Nieder
2011-07-17 10:46     ` Ramkumar Ramachandra
2011-07-17 16:59       ` Jonathan Nieder
2011-07-19 10:09         ` Ramkumar Ramachandra
2011-07-11 14:53 ` [PATCH 06/17] revert: Eliminate global "commit" variable Ramkumar Ramachandra
2011-07-12 17:45   ` Jonathan Nieder
2011-07-13  6:57     ` Ramkumar Ramachandra
2011-07-13  7:10       ` Jonathan Nieder
2011-07-13  8:33         ` Ramkumar Ramachandra
2011-07-13 16:40           ` Jonathan Nieder
2011-07-11 14:53 ` [PATCH 07/17] revert: Introduce struct to keep command-line options Ramkumar Ramachandra
2011-07-12 18:05   ` Jonathan Nieder
2011-07-13  7:56     ` Ramkumar Ramachandra
2011-07-11 14:53 ` [PATCH 08/17] revert: Separate cmdline parsing from functional code Ramkumar Ramachandra
2011-07-12 18:20   ` Jonathan Nieder
2011-07-18 20:53     ` Ramkumar Ramachandra
2011-07-18 21:03       ` Jonathan Nieder
2011-07-11 14:54 ` [PATCH 09/17] revert: Don't create invalid replay_opts in parse_args Ramkumar Ramachandra
2011-07-11 20:44   ` Junio C Hamano
2011-07-12  5:57     ` Ramkumar Ramachandra
2011-07-12 18:29   ` Jonathan Nieder
2011-07-17 11:56     ` Ramkumar Ramachandra
2011-07-17 18:43       ` Jonathan Nieder
2011-07-11 14:54 ` [PATCH 10/17] sequencer: Announce sequencer state location Ramkumar Ramachandra
2011-07-12 18:56   ` Jonathan Nieder
2011-07-13 12:10     ` Sverre Rabbelier
2011-07-17 16:23       ` Ramkumar Ramachandra
2011-07-17 19:19         ` Jonathan Nieder
2011-07-18 19:44           ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 11/17] revert: Save data for continuing after conflict resolution Ramkumar Ramachandra
2011-07-11 21:01   ` Junio C Hamano
2011-07-11 21:31     ` Junio C Hamano
2011-07-12  5:43     ` Ramkumar Ramachandra
2011-07-12 19:37   ` Jonathan Nieder
2011-07-17 11:48     ` Ramkumar Ramachandra
2011-07-17 18:40       ` Jonathan Nieder
2011-07-18 19:31         ` Ramkumar Ramachandra
2011-07-19 12:21           ` Jonathan Nieder
2011-07-19 12:34             ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 12/17] revert: Save command-line options for continuing operation Ramkumar Ramachandra
2011-07-11 21:15   ` Junio C Hamano
2011-07-12  5:56     ` Ramkumar Ramachandra
2011-07-12 19:52   ` Jonathan Nieder
2011-07-18 20:18     ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 13/17] revert: Introduce a layer of indirection over pick_commits Ramkumar Ramachandra
2011-07-12 20:03   ` Jonathan Nieder
2011-07-18 21:24     ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 14/17] reset: Make hard reset remove the sequencer state Ramkumar Ramachandra
2011-07-12 20:15   ` Jonathan Nieder
2011-07-17 16:40     ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 15/17] revert: Remove sequencer state when no commits are pending Ramkumar Ramachandra
2011-07-11 19:58   ` Junio C Hamano
2011-07-12  6:26     ` Ramkumar Ramachandra
2011-07-11 14:54 ` [PATCH 16/17] revert: Introduce --reset to remove sequencer state Ramkumar Ramachandra
2011-07-12 20:30   ` Jonathan Nieder
2011-07-17 17:10     ` Ramkumar Ramachandra
2011-07-17 19:25       ` Jonathan Nieder
2011-07-11 14:54 ` [PATCH 17/17] revert: Introduce --continue to continue the operation Ramkumar Ramachandra
2011-07-12 20:46   ` Jonathan Nieder
2011-07-17 16:11     ` Ramkumar Ramachandra
2011-07-17 18:32       ` Jonathan Nieder
2011-07-18 20:00         ` Ramkumar Ramachandra
2011-07-18 20:09           ` Jonathan Nieder
2011-07-11 17:17 ` [GSoC update] Sequencer for inclusion Jonathan Nieder
2011-07-11 17:57   ` Ramkumar Ramachandra
2011-07-11 20:05     ` Ramkumar Ramachandra
2011-07-11 20:11     ` Jonathan Nieder
2011-07-12  7:05     ` Ramkumar Ramachandra
2011-07-11 20:07   ` Junio C Hamano
2011-07-11 22:14     ` Jeff King
2011-07-12  6:41       ` Ramkumar Ramachandra
2011-07-12  6:47         ` Jeff King
2011-07-13  9:41           ` Ramkumar Ramachandra
2011-07-13 19:07             ` Jeff King [this message]
2011-07-18 21:37               ` [RFC PATCH] config: Introduce functions to write non-standard file Ramkumar Ramachandra
2011-07-18 23:54                 ` Junio C Hamano
2011-07-19  8:52                   ` Ramkumar Ramachandra
2011-07-12  5:58     ` [GSoC update] Sequencer for inclusion Jonathan Nieder
2011-07-12  6:28   ` Miles Bader

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=20110713190724.GA31965@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=miles@gnu.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).