From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Renaming files with git not all that bad? Date: Sat, 11 Dec 2021 19:11:14 +0700 Message-ID: References: <878rwuia7g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mathias Dahl , Emacs developers , Tassilo Horn To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 11 13:12:23 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mw1Ek-0006fy-DL for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 13:12:22 +0100 Original-Received: from localhost ([::1]:54070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw1Ei-0002uy-V8 for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 07:12:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw1E0-0002F0-V1 for emacs-devel@gnu.org; Sat, 11 Dec 2021 07:11:36 -0500 Original-Received: from [2607:f8b0:4864:20::92c] (port=39781 helo=mail-ua1-x92c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw1Dx-0000Y3-8D; Sat, 11 Dec 2021 07:11:36 -0500 Original-Received: by mail-ua1-x92c.google.com with SMTP id i6so21255345uae.6; Sat, 11 Dec 2021 04:11:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+2AtFC80BBmhXk0lttAZ0m88MrqSR4Tuh+/S1icdUc0=; b=InxMfdZYWf/kS8N7eE4cSyn42LlvFOWrplgWIikIAykPtwLh8+B83Ye1zrFLGjDI1h 5Vg2EhQyu3dJGkFySrrG4FdV79X+i17qCJ3FonX/79QkiG+j7EPtTq0QHTWof7AGBX9B cHOfbgtwJ3Kin7XYXflVGI0KskuMvSukzm2IdDiK1J9U7o00jmipls1H6pcjAF6GJijW hhozpNRvWxWN3tHq0HAW8Y+hww8HHNM3hRMPXaJXmLNCuHOkKb7YkvYURj8mxkxxHH9a eK+YY58xYjOiexWwjru50ayi/oV1wmhPSfD1p7vxKRoPfOk2N/WczCcfXW6AbCI2x/3x dy4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+2AtFC80BBmhXk0lttAZ0m88MrqSR4Tuh+/S1icdUc0=; b=av9XjmDPExH52cZFHPf/2zx/DBaQntwMNWd9J0MvnNUQcFw1MUN1QNO7XuTtuojyy1 ze3f+k8Y69xhjN3i2w+Q8KCqGgI7z8ymqWqor0Cb3CKocN5Bc5LjRjofXG8WVv5OgQLj GieED2QkCt886G3hUsFx3JxvSWiox8a9We/xPqv2IrfrjJXb9OYi/N2vg3ECWwUhPyJN 9DEFnCtTIN+kpCgG0/6E8uP+7+jxU299exPqDlz8bE/v3Bo1dGy3IyJC5l7XRldqZ15Y Wx2wZGDVsFVSvF1GWDBXimc6vHh+eVt1UHtZ2d34DyZJL7v/3F4CQKNmxV0gtgM7Jbo2 20qg== X-Gm-Message-State: AOAM530BBXxz52ZuOGnzZmHhB5tfwRe0CWBiOV3d9W0A+/XHB9crGkzt QLlUYFL87nVyv2iOZY/mk8iU3aTbyxrFw8fWXBUirzr/VKDiRA== X-Google-Smtp-Source: ABdhPJykobDiEFjw8X85spf8Useghd7RZC7eaUccT88IrO6TjUTb4jVBZd0zxnfeHP3PnyM17GmBwqrdPlUv+pWJCL0= X-Received: by 2002:a05:6102:109b:: with SMTP id s27mr22043979vsr.84.1639224685879; Sat, 11 Dec 2021 04:11:25 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::92c (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::92c; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x92c.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281679 Archived-At: On Fri, 10 Dec 2021 at 05:03, Stefan Kangas wrote: > >> Couldn't the same effect be achieved in a simpler manner by copying th= e > >> 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=E2=80=99s 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=E2=80=99s article: git init >foods echo apple >>foods echo celery >>foods echo cheese git add foods git commit --author=3D"Alice " -m created >>foods echo eggs >>foods echo grape >>foods echo lettuce git commit --author=3D"Bob " -am middle >>foods echo milk >>foods echo orange >>foods echo peas git commit --author=3D"Carol " -am last git tag ready Next: cp foods dairy cp foods fruits git mv foods veggies git add dairy fruits git commit --author=3D"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=3D"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 =E2=80=98git log=E2=80=99, 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=E2=80=99s 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.