All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: git@vger.kernel.org, Brad King <brad.king@kitware.com>,
	Heiko Voigt <hvoigt@hvoigt.net>
Subject: Re: [PATCH 1/2] revision: keep track of the end-user input from the command line
Date: Thu, 25 Aug 2011 19:21:08 -0700	[thread overview]
Message-ID: <7vy5yggbfv.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CAGdFq_he-skXpEy903RSY2ravDXo1eVCN19RzJeHXQCT__HTmA@mail.gmail.com> (Sverre Rabbelier's message of "Thu, 25 Aug 2011 18:08:31 -0700")

Sverre Rabbelier <srabbelier@gmail.com> writes:

>> Prepare a separate array to keep track of what syntactic element was used
>> to cause each object to appear in the pending array from the command line,
>> and populate it as setup_revisions() parses the command line.
>
> Thank you! I was really dreading looking into this myself, so I'm very
> glad that you could find the time to look into it yourself.

I debated long and hard if I should instead fatten object array entry and
shove this information there without adding a new structure, which would
have resulted in something very similar to what you had, so you should
take some credit for the code, and also credit for a large part of the
motivation (the second paragraph in the log is entirely your use case).

We might end up unifying this command line information array and the
pending object array after reviewing what other future callers would want
from this new information, but at least by doing it this way I can rest
assured that no existing code that is unaware of the mechanism would get
any unintended side effects in the earlier rounds.

>> @@ -835,6 +853,7 @@ static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
>>                struct object *o = parse_object(sha1);
>>                if (o) {
>>                        o->flags |= cb->all_flags;
>> +                       /* ??? CMDLINEFLAGS ??? */
>>                        add_pending_object(cb->all_revs, o, "");
>>                }
>>                else if (!cb->warned_bad_reflog) {
>
> What is happening here?

We could have add_rev_cmdline() call there if we really wanted to, but I
decided not to do so for two reasons:

(1) with "rev-list -g HEAD", the user is not explicitly mentioning all
    objects in the reflog of the HEAD---it might still make sense to mark
    HEAD as explicitly mentioned as positive, but the code to do so will
    not sit here anyway; and more importantly,

(2) I was appalled by how broken the design and the implementation of
    walking the reflog was (it shoves _all_ the objects in the entire
    history recorded in the reflog to the pending queue before letting the
    caller do an iota of work). It is against the general design of Git,
    and the design of the revision walk machinery in particular that tries
    very hard to be incremental. It goes against a good software design
    taste.

For the latter reason, I think in the longer term we should correct the
implementation to walk the reflog to keep an iterator (a structure that
holds an open file descriptor to a reflog file, and perhaps a little bit
of buffer) in struct rev_info, and teach get_revisions() to lazily read
from there, reading the file backward. Once that happens, this callback
from for_each_reflog_ent() will go away, so I didn't bother.

  reply	other threads:[~2011-08-26  2:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 13:59 [PATCH] submodule: Demonstrate known breakage during recursive merge Brad King
2011-08-24 19:14 ` Heiko Voigt
2011-08-24 19:24   ` Junio C Hamano
2011-08-24 19:46     ` Heiko Voigt
2011-08-24 20:02       ` Brad King
2011-08-24 20:27         ` Heiko Voigt
2011-08-24 20:40           ` Brad King
2011-08-24 21:32             ` Heiko Voigt
2011-08-25 16:49               ` [PATCH] rev-list: Demonstrate breakage with --ancestry-path --all Brad King
2011-08-25 23:08                 ` Junio C Hamano
2011-08-25 23:49                   ` Junio C Hamano
2011-08-26  1:00                 ` [PATCH 1/2] revision: keep track of the end-user input from the command line Junio C Hamano
2011-08-26  1:08                   ` Sverre Rabbelier
2011-08-26  2:21                     ` Junio C Hamano [this message]
2011-08-26  1:00                 ` [PATCH 2/2] revision: do not include sibling history in --ancestry-path output Junio C Hamano
2011-08-26 12:51                   ` Brad King
2011-08-24 22:43       ` [PATCH] submodule: Demonstrate known breakage during recursive merge Junio C Hamano
2011-08-25 21:11         ` [PATCH] allow multiple calls to submodule merge search for the same path Heiko Voigt
2011-08-25 23:22           ` Junio C Hamano
2011-08-25 23:28             ` Junio C Hamano
2011-08-25 23:39               ` Junio C Hamano
2011-08-25 12:28 ` [PATCH v2] submodule: Demonstrate known breakage during recursive merge Brad King
2011-08-26 14:18   ` [PATCH/RFC] submodule: Search for merges only at end of " Brad King
2011-08-26 19:04     ` Junio C Hamano
2011-08-26 19:30       ` [PATCH v2/RFC] " Brad King

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=7vy5yggbfv.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=brad.king@kitware.com \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=srabbelier@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.