git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Bo Yang" <struggleyb.nku@gmail.com>,
	"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
	"Will Palmer" <wmpalmer@gmail.com>
Subject: Re: [PATCH v8 1/5] Refactor parse_loc
Date: Thu, 28 Feb 2013 20:24:44 +0100	[thread overview]
Message-ID: <87lia86y2r.fsf@pctrast.inf.ethz.ch> (raw)
In-Reply-To: <7vobf4icjh.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 28 Feb 2013 09:16:50 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Thomas Rast <trast@student.ethz.ch> writes:
>
>> From: Bo Yang <struggleyb.nku@gmail.com>
>>
>> We want to use the same style of -L n,m argument for 'git log -L' as
>> for git-blame.  Refactor the argument parsing of the range arguments
>> from builtin/blame.c to the (new) file that will hold the 'git log -L'
>> logic.
>>
>> To accommodate different data structures in blame and log -L, the file
>> contents are abstracted away; parse_range_arg takes a callback that it
>> uses to get the contents of a line of the (notional) file.
>>
>> The new test is for a case that made me pause during debugging: the
>> 'blame -L with invalid end' test was the only one that noticed an
>> outright failure to parse the end *at all*.  So make a more explicit
>> test for that.
>>
>> Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
>> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
>> ---
>>  Documentation/blame-options.txt     |  19 +------
>>  Documentation/line-range-format.txt |  18 +++++++
>>  Makefile                            |   2 +
>>  builtin/blame.c                     |  99 +++-------------------------------
>>  line-log.c                          | 105 ++++++++++++++++++++++++++++++++++++
>>  line-log.h                          |  23 ++++++++
>
> Was this churn necessary?  
>
> It is strange to move existing functions that will be tweaked to be
> shared by two different codepaths (blame and line-log) to the new
> user.
>
> The only effect this has, as opposed to tweaking the functions in
> place and making them extern, is to make it harder to see the tweaks
> made while moving the lines, and also make it more cumbersome to
> determine the lineage of the code later.
>  
> It would have been understandable if they were moved to a new
> library-ish file (perhaps "line-range.[ch]"); even though that
> approach shares the same downsides, at least it would have a better
> excuse "We will share this, so let's move it to a neutral third
> place to allow us to hide the implementation details from both
> users".  The arrangement this patch series makes does not even have
> that excuse.  The final implementation still stay with one of the
> users; the only difference is that it is away from the original user
> and close to the new user.

Even though I am moving from builtin/blame.c to line-log.c?  I would
otherwise have to call from a rather lib-ish file into a "frontend"
file.  I always figured I wasn't supposed to do that.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2013-02-28 19:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28 16:38 [PATCH v8 0/5] git log -L Thomas Rast
2013-02-28 16:38 ` [PATCH v8 1/5] Refactor parse_loc Thomas Rast
2013-02-28 17:16   ` Junio C Hamano
2013-02-28 19:24     ` Thomas Rast [this message]
2013-02-28 16:38 ` [PATCH v8 2/5] blame: introduce $ as "end of file" in -L syntax Thomas Rast
2013-02-28 17:18   ` Junio C Hamano
2013-03-12 22:34     ` Junio C Hamano
2013-03-13  7:52       ` Thomas Rast
2013-03-13 16:05         ` Junio C Hamano
2013-02-28 16:38 ` [PATCH v8 3/5] Export rewrite_parents() for 'log -L' Thomas Rast
2013-02-28 17:19   ` Junio C Hamano
2013-02-28 16:38 ` [PATCH v8 4/5] Implement line-history search (git log -L) Thomas Rast
2013-02-28 17:51   ` Junio C Hamano
2013-02-28 19:32     ` Thomas Rast
2013-02-28 20:37       ` Junio C Hamano
2013-02-28 21:41         ` Thomas Rast
2013-02-28 22:23     ` Junio C Hamano
2013-03-01  8:49       ` Thomas Rast
2013-03-01 14:59         ` Thomas Rast
2013-02-28 16:38 ` [PATCH v8 5/5] log -L: :pattern:file syntax to find by funcname Thomas Rast
2013-02-28 19:56 ` [PATCH v8 0/5] git log -L 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=87lia86y2r.fsf@pctrast.inf.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=struggleyb.nku@gmail.com \
    --cc=wmpalmer@gmail.com \
    --cc=zbyszek@in.waw.pl \
    /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).