Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH updated] Add "--dirstat" for some directory statistics
Date: Tue, 12 Feb 2008 17:27:49 -0800	[thread overview]
Message-ID: <7vbq6lzluy.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0802121701310.2920@woody.linux-foundation.org> (Linus Torvalds's message of "Tue, 12 Feb 2008 17:10:04 -0800 (PST)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Tue, 12 Feb 2008, Junio C Hamano wrote:
>> 
>> You can drop the "line count" idea and instead count the "amount
>> of damage" done to the preimage, just like we do in the rename
>> similarity computation.
>> 
>> The attached patch is just an outline.  There may need special
>> cases for unmerged paths.
>
> Ouch. I like the concept and the result, but an not a huge fan of the the 
> implementation. The problem with this is that it makes the whole damage 
> computation something separate from the earlier phases.
>
> So it actually seems to add a lot of cost. Right now there is basically 
> zero added cost to just adding a "--dirstat" to one of my common 
> operations, which is
>
> 	git diff -M --stat --summary
>
> (that's what I do on merges). 
>
> Wouldn't it be nicer to merge it with one of the stages we did earlier by 
> simply saving the data. If not the --stat phase, then the -M phase? 

We could add one ulong to diff_filepair struct to record
"damage", and populate it inside diffcore_rename().

Obviously:

 - You would need to diffcore_count_changes() in separate phase
   if you do not use -M;

 - Even if you use -M, we do not run diffcore_count_changes()
   for unrenamed paths during diffcore_rename(), so you would
   need to do that separately.

By the way, if you run "git diff --summary --dirstat -M" (that
is, without --stat), we will not have to run diffstat at all.
Instead, we only run diffcore_count_changes(), which can be
reused for renamed paths if we keep it in diff_filepair struct.

  reply	other threads:[~2008-02-13  1:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 21:26 [PATCH updated] Add "--dirstat" for some directory statistics Linus Torvalds
2008-02-12 21:56 ` Linus Torvalds
2008-02-13  0:54   ` Junio C Hamano
2008-02-13  1:10     ` Linus Torvalds
2008-02-13  1:27       ` Junio C Hamano [this message]
2008-02-13  7:55 ` Abdelrazak Younes
2008-02-13 13:48   ` Johannes Schindelin
2008-02-13 14:07   ` Wincent Colaiuta

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=7vbq6lzluy.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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