Git development
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: Mircea Bardac <dev@mircea.bardac.net>
Cc: git@vger.kernel.org
Subject: Re: possible 'git cp'/how does git detect copies
Date: Fri, 27 Jun 2008 15:00:06 +0200	[thread overview]
Message-ID: <20080627130006.GC17898@artemis.madism.org> (raw)
In-Reply-To: <4864DFB6.3050204@mircea.bardac.net>

[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]

On Fri, Jun 27, 2008 at 12:40:22PM +0000, Mircea Bardac 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)?

  By comparing if files (blobs) are alike. It has some heuristics to
guess which files have good changes to be copies or renames of each
others. But it recomputes the information each time.

> 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.

  You probably want to use -C -C -M actually.

> I found this older thread [1] on "git cp" but the discussion appears to 
> have stalled at some point. If there is indeed no use of a "git cp" 
> command, I would like at least some info on how content copies are being 
> detected, since I haven't seen this working.

  If you really need it, you can and an alias alias.cp=!cp and be done
with it ;P

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2008-06-27 13:01 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
2008-06-27 13:00 ` Pierre Habouzit [this message]
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=20080627130006.GC17898@artemis.madism.org \
    --to=madcoder@debian.org \
    --cc=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