From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [RFC] use typechange as rename source
Date: Wed, 21 Nov 2007 12:12:36 -0500 [thread overview]
Message-ID: <20071121171235.GA32233@sigill.intra.peff.net> (raw)
Today in one of my repositories I did something like this:
$ mv foo bar
$ ln -s bar foo
$ git add .
and I expected git-status to claim:
typechange: foo
renamed: foo -> bar
but it didn't find the rename (without -C) because the path 'foo' still
exists. So there is a disconnect in what git and I think of as "exists".
Should typechanges make a file eligible as a rename src?
A quickie patch to implement this is:
diff --git a/diffcore-rename.c b/diffcore-rename.c
index f9ebea5..5a34e8a 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -417,6 +417,10 @@ void diffcore_rename(struct diff_options *options)
p->one->rename_used++;
register_rename_src(p->one, p->score);
}
+ else if (DIFF_PAIR_TYPE_CHANGED(p)) {
+ p->one->rename_used++;
+ register_rename_src(p->one, p->score);
+ }
else if (detect_rename == DIFF_DETECT_COPY) {
/*
* Increment the "rename_used" score by
There are a few add-on questions:
- should typechanges in both directions be used, or just file ->
symlink?
- this actually produces a 'copied' status rather than a 'renamed'
since the 'foo' entry does still exist. Is this reasonable?
-Peff
next reply other threads:[~2007-11-21 17:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 17:12 Jeff King [this message]
2007-11-29 0:02 ` [RFC] use typechange as rename source Junio C Hamano
2007-11-29 14:14 ` Jeff King
2007-11-30 1:10 ` Junio C Hamano
2007-11-30 1:57 ` Jeff King
2007-12-01 2:36 ` Junio C Hamano
2007-12-01 4:34 ` Jeff King
2007-12-01 6:08 ` Junio C Hamano
2007-12-01 6:13 ` Junio C Hamano
2007-12-01 6:35 ` Junio C Hamano
2007-12-01 6:49 ` Jeff King
2007-12-02 19:15 ` Junio C Hamano
2007-12-03 1:20 ` Jeff King
2007-12-01 6:17 ` Jeff King
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=20071121171235.GA32233@sigill.intra.peff.net \
--to=peff@peff.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;
as well as URLs for NNTP newsgroup(s).