From: Yuri Khan <yuri.v.khan@gmail.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: Mathias Dahl <mathias.dahl@gmail.com>,
Emacs developers <emacs-devel@gnu.org>,
Tassilo Horn <tsdh@gnu.org>
Subject: Re: Renaming files with git not all that bad?
Date: Sat, 11 Dec 2021 19:11:14 +0700 [thread overview]
Message-ID: <CAP_d_8VTchcZmCjja40=oMzSNReQ8c3_yjQpxX9W-pT6oxNUbw@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmnME3xrzyPwFyCHWBE6n3LyvTYwCpJ4LE3_ZedKyb2OzQ@mail.gmail.com>
On Fri, 10 Dec 2021 at 05:03, Stefan Kangas <stefan@marxist.se> wrote:
> >> Couldn't the same effect be achieved in a simpler manner by copying the
> >> original file N times in one commit and then stripping the copies and
> >> original down to what they should eventually become? (AFAIK, git has no
> >> problem detecting literal copies.)
> >
> > Indeed, I tried this and it works for me, as long as the first commit
> > is only literal copies. Maybe Git’s ancestry detection through copies
> > was not as advanced in the unspecified times when Raymond invented his
> > technique.
>
> I'm having no luck with this.
>
> Could you describe the exact steps you took?
I start with the same steps described in Raymond Chen’s article:
git init
>foods echo apple
>>foods echo celery
>>foods echo cheese
git add foods
git commit --author="Alice <alice>" -m created
>>foods echo eggs
>>foods echo grape
>>foods echo lettuce
git commit --author="Bob <bob>" -am middle
>>foods echo milk
>>foods echo orange
>>foods echo peas
git commit --author="Carol <carol>" -am last
git tag ready
Next:
cp foods dairy
cp foods fruits
git mv foods veggies
git add dairy fruits
git commit --author="Donald <donald>" -m "split part 1"
sed -rni '/^a|^g|^o/p' fruits
sed -rni '/^ce|^l|^p/p' veggies
sed -rni '/^ch|^e|^m/p' dairy
git commit --author="Donald <donald>" -am "split part 2"
At this point, the line history in each file is preserved:
git blame dairy
^2221a21 foods (Alice 2021-12-09 13:27:21 +0700 1) cheese
d12be427 foods (Bob 2021-12-09 13:27:27 +0700 2) eggs
ada8f5c5 foods (Carol 2021-12-09 13:27:31 +0700 3) milk
git blame fruits
^2221a21 foods (Alice 2021-12-09 13:27:21 +0700 1) apple
d12be427 foods (Bob 2021-12-09 13:27:27 +0700 2) grape
ada8f5c5 foods (Carol 2021-12-09 13:27:31 +0700 3) orange
git blame veggies
^2221a21 foods (Alice 2021-12-09 13:27:21 +0700 1) celery
d12be427 foods (Bob 2021-12-09 13:27:27 +0700 2) lettuce
ada8f5c5 foods (Carol 2021-12-09 13:27:31 +0700 3) peas
‘git log’, however, does not trace file history beyond the split by default:
git log --oneline dairy
8d6d788 (HEAD -> master) split part 2
4be5ed0 split part 1
It does if you ask:
git log --oneline --follow veggies
8d6d788 (HEAD -> master) split part 2
4be5ed0 split part 1
ada8f5c (tag: ready, split-via-rename) last
d12be42 middle
2221a21 created
Doing it Raymond’s way (via multiple branches with a single rename and
paring down on each branch, then octopus-merging the branches)
produces the same effects: blame assigned correctly, file-filtered log
complete only on --follow.
next prev parent reply other threads:[~2021-12-11 12:11 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 21:50 Splitting image-dired.el into smaller files Stefan Kangas
2021-12-08 22:24 ` Stefan Monnier
2021-12-08 22:54 ` Stefan Kangas
2021-12-09 1:05 ` Lars Ingebrigtsen
2021-12-09 7:28 ` Eli Zaretskii
2021-12-09 13:58 ` Stefan Kangas
2021-12-09 14:03 ` Eli Zaretskii
2022-01-27 21:26 ` Mathias Dahl
2021-12-09 3:20 ` Renaming files with git not all that bad? Stefan Kangas
2021-12-09 3:56 ` Phil Sainty
2021-12-09 8:43 ` Andreas Schwab
2021-12-09 9:00 ` tomas
2021-12-09 9:24 ` Eli Zaretskii
2021-12-09 13:57 ` Stefan Kangas
2021-12-09 5:40 ` Yuri Khan
2021-12-09 6:02 ` Tassilo Horn
2021-12-09 6:35 ` Yuri Khan
2021-12-09 7:04 ` Tassilo Horn
2021-12-09 7:28 ` Yuri Khan
2021-12-09 22:03 ` Stefan Kangas
2021-12-10 12:28 ` Tassilo Horn
2021-12-11 12:11 ` Yuri Khan [this message]
2021-12-09 14:55 ` Stefan Kangas
2021-12-09 15:50 ` tomas
2021-12-09 22:18 ` Stefan Kangas
2021-12-10 8:17 ` tomas
2022-08-21 0:56 ` Splitting image-dired.el into smaller files Stefan Kangas
2022-08-21 5:50 ` Eli Zaretskii
2022-08-21 14:32 ` Stefan Kangas
2022-08-21 14:35 ` Eli Zaretskii
2022-08-21 15:11 ` Stefan Kangas
2022-08-21 15:16 ` Lars Ingebrigtsen
2022-08-21 15:20 ` Eli Zaretskii
2022-08-21 15:22 ` Lars Ingebrigtsen
2022-08-21 17:02 ` Stefan Monnier
2022-08-23 19:02 ` Stefan Kangas
2022-08-23 19:09 ` Eli Zaretskii
2022-08-23 19:53 ` Stefan Kangas
2022-08-21 16:20 ` Juri Linkov
2022-08-22 13:08 ` Stefan Kangas
2022-08-22 15:18 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP_d_8VTchcZmCjja40=oMzSNReQ8c3_yjQpxX9W-pT6oxNUbw@mail.gmail.com' \
--to=yuri.v.khan@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=mathias.dahl@gmail.com \
--cc=stefan@marxist.se \
--cc=tsdh@gnu.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).