From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Lawrence Siebert <lawrencesiebert@gmail.com>
Cc: git@vger.kernel.org, remi.galan-alfonso@ensimag.grenoble-inp.fr,
gitster@pobox.com
Subject: Re: [PATCH v2 2/4] log: add --count option to git log
Date: Fri, 03 Jul 2015 09:29:47 +0200 [thread overview]
Message-ID: <vpqa8vd66ms.fsf@anie.imag.fr> (raw)
In-Reply-To: <1435881011-13879-3-git-send-email-lawrencesiebert@gmail.com> (Lawrence Siebert's message of "Thu, 2 Jul 2015 16:50:09 -0700")
Lawrence Siebert <lawrencesiebert@gmail.com> writes:
> +static void show_object(struct object *obj,
> + const struct name_path *path, const char *component,
> + void *cb_data)
> +{
> + return;
> +}
It seems streange to me to have a function named show_object when it
does not show anything. Maybe name it null_travers_cb to make it clear
it's a callback and it does nothing?
Not a strong objection though, it's only a static function.
> +static void show_commit(struct commit *commit, void *data)
> +{
> + struct rev_info *revs = (struct rev_info *)data;
> + if (commit->object.flags & PATCHSAME)
> + revs->count_same++;
> + else if (commit->object.flags & SYMMETRIC_LEFT)
> + revs->count_left++;
> + else
> + revs->count_right++;
> + if (commit->parents) {
> + free_commit_list(commit->parents);
> + commit->parents = NULL;
> + }
> + free_commit_buffer(commit);
> +}
> +
> static int cmd_log_walk(struct rev_info *rev)
> {
> struct commit *commit;
> int saved_nrl = 0;
> int saved_dcctc = 0;
>
> + if (rev->count) {
> + prepare_revision_walk(rev);
> + traverse_commit_list(rev, show_commit, show_object, rev);
> + get_commit_count(rev);
> + }
I didn't test, but it seems this does a full graph traversal before
starting the output. A very important property of "git log" is that it
starts showing revisions immediately, even when ran on a very long
history (it shows the first screen immediately and continues working in
the background while the first page is displayed in the pager).
Is it the case? If so, it should be changed. If not, perhaps explain why
in the commit message.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2015-07-03 7:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 23:50 [PATCH v2 0/4] git log --count Lawrence Siebert
2015-07-02 23:50 ` [PATCH v2 1/4] list-object: add get_commit_count function Lawrence Siebert
2015-07-03 7:24 ` Matthieu Moy
2015-07-03 8:09 ` Lawrence Siebert
2015-07-03 8:59 ` Matthieu Moy
2015-07-02 23:50 ` [PATCH v2 2/4] log: add --count option to git log Lawrence Siebert
2015-07-03 7:29 ` Matthieu Moy [this message]
2015-07-03 8:05 ` Lawrence Siebert
2015-07-03 9:16 ` Matthieu Moy
2015-07-02 23:50 ` [PATCH v2 3/4] log --count: added test Lawrence Siebert
2015-07-03 7:34 ` Matthieu Moy
2015-07-03 8:30 ` Lawrence Siebert
2015-07-03 9:16 ` Matthieu Moy
2015-07-03 9:54 ` Matthieu Moy
2015-07-04 0:57 ` Junio C Hamano
2015-07-04 0:54 ` Junio C Hamano
2015-07-02 23:50 ` [PATCH v2 4/4] git-log: update man documentation for --count Lawrence Siebert
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=vpqa8vd66ms.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=lawrencesiebert@gmail.com \
--cc=remi.galan-alfonso@ensimag.grenoble-inp.fr \
/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).