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

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.

  reply	other threads:[~2013-03-21 19:06 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 [this message]
2013-03-23  6:00     ` Thomas Rast
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=7vr4j8a7zy.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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).