Git development
 help / color / mirror / Atom feed
From: Mircea Bardac <dev@mircea.bardac.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: Re: possible 'git cp'/how does git detect copies
Date: Fri, 27 Jun 2008 14:16:41 +0100	[thread overview]
Message-ID: <4864E839.7000204@mircea.bardac.net> (raw)
In-Reply-To: <8aa486160806270557w20ce622co1099bceec7bc90f9@mail.gmail.com>

Hi,

Santi Béjar wrote:
> On Fri, Jun 27, 2008 at 14:40, Mircea Bardac <dev@mircea.bardac.net> wrote:
>> I was looking today at duplicating a file but, I soon realized that there is
>> no 'git cp' command (this was the "deductive approach to git commands",
>> starting from git mv/rm/...). How does "git diff -C" detect copies (-C is
>> used for this, according to the documentation)?
> 
> Did you followed the "See also −−find−copies−harder."?

I knew this from before but for some reason I forgot about it when I 
tried it now. The documentation for "git diff -C" is a bit misleading. I 
have originally tested on git 1.5.2.something and the documentation for 
-C didn't point to --find-copies-harder. I've quickly installed 1.5.6.1 
to test the behavior but not the man pages.

Looking over the online docs for 1.5.6.1, it appears that there is now a 
reference to --find-copies-harder.

Even so, saying just that "Detect copies as well as renames." is not 
enough, as it assumes that there is no restriction on the detection process.

 From --find-copies-harder
"For performance reasons, by default, -C option finds copies only if the 
original file of the copy was modified in the same changeset." should be 
moved to -C.

>> On a very simple test, I couldn't see this working. I just copied one file,
>> added it, committed the change, ran "git diff -C HEAD^!". There is no place
>> saying that it's contents is copied from some other file (both files are in
>> the repository now).
>>
>> "git blame -C new_copied_file" also doesn't show the commits for the
>> original file.
> 
> git blame -C -C new_copied_file

Ah, duplicating the parameter. Looking better over these options I have 
noticed that --find-copies-harder for "git diff" can also be replaced 
with an extra -C. A little bit of consistency would help: either
"-C -C", either "--find-copies-harder" in both git blame/diff. Removing 
from the documentation the deprecated version but keeping the 
implementation for backwards compatibility might be a solution.


Many thanks,
Mircea

P.S. I know that patches are encouraged and technically it's pretty 
simple to create a documentation patch, but I have not yet formed myself 
a workflow for sending patches via Git to a maillist (this is a pending 
task for me)

--
http://mircea.bardac.net

  reply	other threads:[~2008-06-27 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-27 12:40 possible 'git cp'/how does git detect copies Mircea Bardac
2008-06-27 12:57 ` Santi Béjar
2008-06-27 13:16   ` Mircea Bardac [this message]
2008-06-27 13:00 ` Pierre Habouzit
2008-06-27 13:09   ` Miklos Vajna
2008-06-27 13:05 ` Johannes Sixt

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=4864E839.7000204@mircea.bardac.net \
    --to=dev@mircea.bardac.net \
    --cc=git@vger.kernel.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