git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@inf.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Thomas Rast" <trast@student.ethz.ch>,
	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 v9 3/5] Implement line-history search (git log -L)
Date: Sat, 23 Mar 2013 07:00:45 +0100	[thread overview]
Message-ID: <87fvzmzmcy.fsf@pctrast.inf.ethz.ch> (raw)
In-Reply-To: <7vr4j8a7zy.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 21 Mar 2013 12:05:37 -0700")

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

> Thomas Rast <trast@student.ethz.ch> writes:
>
>> +void line_log_init(struct rev_info *rev, const char *prefix, struct
>> string_list *args)
>> +{
>> +	struct commit *commit = NULL;
>> +	struct line_log_data *range;
>> +
>> +	commit = check_single_commit(rev);
>> +	range = parse_lines(commit, prefix, args);
>> +	add_line_range(rev, commit, range);
>> +
>> +	if (!rev->diffopt.detect_rename) {
>> +		int i, count = 0;
>> +		struct line_log_data *r = range;
>> +		const char **paths;
>> +		while (r) {
>> +			count++;
>> +			r = r->next;
>> +		}
>> +		paths = xmalloc((count+1)*sizeof(char *));
>> +		r = range;
>> +		for (i = 0; i < count; i++) {
>> +			paths[i] = xstrdup(r->spec->path);
>> +			r = r->next;
>> +		}
>> +		paths[count] = NULL;
>> +		init_pathspec(&rev->diffopt.pathspec, paths);
>> +		free(paths);
>> +	}
>> +}
>
> Why not do the pathspec limitation under "-M"?
>
> It is not like you are picking up origins of blocks of lines copied
> or moved from other files like "blame -C" does, so I suspect it
> would be simpler to mimic what --follow does, which is to (1) use
> the pathspec to follow the paths you care about, and then (2) when
> you find one or more of the paths you were following disappear in a
> commit, only at that point you re-check to see if there are other
> paths that existed in the parent that the disappeared paths were
> renamed from, and match with that one.

It's acting too soon though.  The way log -L is currently wired, we do
one revision walk with the pathspec filter already enabled to do the
topo sorting.  Wiring it in *at that point* would be equivalent to
fixing --follow.

Which I plan to do Real Soon Now(tm).  But let's not open too many cans
of worms at the same time.

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

  reply	other threads:[~2013-03-23  6:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 12:52 [PATCH v9 0/5] git log -L Thomas Rast
2013-03-21 12:52 ` [PATCH v9 1/5] Refactor parse_loc Thomas Rast
2013-03-21 12:52 ` [PATCH v9 2/5] Export rewrite_parents() for 'log -L' Thomas Rast
2013-03-21 12:52 ` [PATCH v9 3/5] Implement line-history search (git log -L) Thomas Rast
2013-03-21 19:05   ` Junio C Hamano
2013-03-23  6:00     ` Thomas Rast [this message]
2013-03-21 12:52 ` [PATCH v9 4/5] log -L: :pattern:file syntax to find by funcname Thomas Rast
2013-03-21 12:52 ` [PATCH v9 5/5] Speed up log -L... -M Thomas Rast
2013-03-21 21:11   ` Eric Sunshine
2013-03-23  5:58     ` Thomas Rast
2013-03-23  9:04       ` Jeff King
2013-03-24  7:38         ` Eric Sunshine
2013-03-23  6:44 ` [PATCH v9a 0/5] git log -L Thomas Rast
2013-03-23  6:44   ` [PATCH v9a 1/5] Refactor parse_loc Thomas Rast
2013-03-23  6:44   ` [PATCH v9a 2/5] Export rewrite_parents() for 'log -L' Thomas Rast
2013-03-23  6:44   ` [PATCH v9a 3/5] Implement line-history search (git log -L) Thomas Rast
2013-03-23 10:31     ` Antoine Pelisse
2013-03-23 10:32       ` Antoine Pelisse
2013-03-28 16:47       ` [PATCH v10 0/5] git log -L Thomas Rast
2013-03-28 16:47         ` [PATCH v10 1/5] Refactor parse_loc Thomas Rast
2013-03-28 16:47         ` [PATCH v10 2/5] Export rewrite_parents() for 'log -L' Thomas Rast
2013-03-28 16:47         ` [PATCH v10 3/5] Implement line-history search (git log -L) Thomas Rast
2013-03-28 16:47         ` [PATCH v10 4/5] log -L: :pattern:file syntax to find by funcname Thomas Rast
2013-03-28 16:47         ` [PATCH v10 5/5] Speed up log -L... -M Thomas Rast
2013-03-23  6:44   ` [PATCH v9a 4/5] log -L: :pattern:file syntax to find by funcname Thomas Rast
2013-03-23  6:44   ` [PATCH v9a 5/5] Speed up log -L... -M Thomas Rast

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=87fvzmzmcy.fsf@pctrast.inf.ethz.ch \
    --to=trast@inf.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=struggleyb.nku@gmail.com \
    --cc=trast@student.ethz.ch \
    --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).