git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Cc: "Mikhail T." <mi+thun@aldan.algebra.com>,
	Junio C Hamano <gitster@pobox.com>, Johannes Sixt <j6t@kdbg.org>,
	git@vger.kernel.org
Subject: Re: How to fork a file (git cp ?)
Date: Thu, 5 May 2011 16:07:15 -0400	[thread overview]
Message-ID: <20110505200715.GC1770@sigill.intra.peff.net> (raw)
In-Reply-To: <BANLkTikE8aMh6RUDzrh=SuOxvKxuPShQhQ@mail.gmail.com>

On Thu, May 05, 2011 at 10:01:32PM +0200, Piotr Krukowiecki wrote:

> >> I think that is what exactly "blame -C -C" gives you.
> >
> > For that to be useful, one has to suspect, the file was derived by copying
> > something else... Simple "git log" will not suggest that -- unless the
> > commit message, that adds the new copy of a file points to it...
> 
> Maybe it should be the default (performance issues?)

Performance is part of it, but also the fact that "--follow" has some
limitations. For example, you can't use it with arbitrary pathspecs. I
hope to fix that at some point. There was a GSoC proposal, but it didn't
get selected; I'm hoping to work on it myself sometime this summer.

> BTW, I don't understand why 'status' shows renames but not copies:
> 
> $ cp f fcp && git add fcp && git status
> # Changes to be committed:
> #	new file:   fcp
> 
> $ mv f fmv && git add fmv && git rm f && git status
> # Changes to be committed:
> #	renamed:    f -> fmv
> 
> I would expect sth like "copied: f -> fcp".

Yeah, we probably should do copy detection. Even weirder, we seem to do
rename detection for what's to be committed, but not for what's in the
worktree.

If you want to do a patch, the changes would go in wt-status.c, in the
functions:

  wt_status_collect_changes_worktree
  wt_status_collect_changes_index

> It should not be a problem performance-wise...

For people running "git status" manually, no. But something like
FIND_COPIES_HARDER may be expensive on a big tree for people who use
"git status" output as part of their shell prompt. So probably it should
be configurable.

-Peff

  parent reply	other threads:[~2011-05-05 20:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 17:56 How to fork a file (git cp ?) Mikhail T.
2011-05-04 18:16 ` Johannes Sixt
2011-05-04 18:22 ` Johannes Sixt
2011-05-04 19:05   ` Stephen Bash
2011-05-04 19:17   ` Mikhail T.
2011-05-04 20:36     ` Øyvind A. Holm
2011-05-04 21:02   ` Junio C Hamano
2011-05-05  1:58     ` Mikhail T.
2011-05-05  2:14       ` Junio C Hamano
2011-05-05 18:02         ` Piotr Krukowiecki
2011-05-05 18:50           ` Junio C Hamano
2011-05-05 19:27             ` Piotr Krukowiecki
2011-05-05 19:31         ` Mikhail T.
2011-05-05 20:01           ` Jeff King
2011-05-05 20:01           ` Piotr Krukowiecki
2011-05-05 20:06             ` Piotr Krukowiecki
2011-05-05 20:07             ` Jeff King [this message]
2011-05-08 19:40             ` Pete Harlan
2011-05-08 20:03               ` Junio C Hamano

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=20110505200715.GC1770@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=mi+thun@aldan.algebra.com \
    --cc=piotr.krukowiecki@gmail.com \
    /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).