From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Renaming files with git not all that bad? Date: Thu, 09 Dec 2021 11:24:56 +0200 Message-ID: <83h7biuo47.fsf@gnu.org> References: <19fed68e4cabf6148ef8f2d18e852d97@webmail.orcon.net.nz> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8875"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, stefan@marxist.se, mathias.dahl@gmail.com To: Phil Sainty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 09 10:26:13 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 1mvFgr-00023H-0u for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Dec 2021 10:26:13 +0100 Original-Received: from localhost ([::1]:55736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvFgq-0002BU-06 for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Dec 2021 04:26:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvFft-0001UC-EI for emacs-devel@gnu.org; Thu, 09 Dec 2021 04:25:13 -0500 Original-Received: from [2001:470:142:3::e] (port=35846 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvFfs-0005aZ-Tc; Thu, 09 Dec 2021 04:25:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3OiJ4yMPrzy/U++2cJ4ZWd/bd0D17O1xtL2bD38wU0M=; b=TYoaltrETl+F pFFmS6m+jST4lWywIPUc2EK0jT8I6mWLqYvKJ0Z1N+cjtwQVecoKvBo3O40bMkLsjcA0FG1NhpUi8 yFcXfltzcvpxBJvW2hklJE4ilXeDu28lxz1m4XW7OKZnw6OdPiAjDoaIJSXLI4Dtg/ITxuqgZzfbt cf7OY+/0uvmmmYl8yYrMQvrAEwvTB0B3C44lOfA9xeMqRqcg0RnmnEd+E/1vZpCOCmi2m3Q2eA0Q7 hVTgxwsGBsFv1+zEG5N4y+yTcBvVHzlJ3knkIsq2bCLukcLNIqq/D3VyKk9xVDu2sj660H+b5z5sq aBqYVF4tki2BYvUAklrYTQ==; Original-Received: from [87.69.77.57] (port=4577 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvFfs-0002aF-Nc; Thu, 09 Dec 2021 04:25:13 -0500 In-Reply-To: <19fed68e4cabf6148ef8f2d18e852d97@webmail.orcon.net.nz> (message from Phil Sainty on Thu, 09 Dec 2021 16:56:05 +1300) 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:281468 Archived-At: > Date: Thu, 09 Dec 2021 16:56:05 +1300 > From: Phil Sainty > Cc: Mathias Dahl , emacs-devel@gnu.org > > Git does seem fairly good at calling things a rename even if > I've forgotten to do it separately -- it seems to notice when > the old and the new are very similar, and make the assumption -- > but if the old and new files are literally the same then Git > will be dealing with an identical hash for that blob; and so if > a commit is deleting a filename for that blob and also adding > a filename for the identical blob, Git doesn't have to work > very hard to decide that it's a rename! (For the same reason > I would assume that it's also more efficient to follow renames > when they are done this way). The problem is not with deciding a change is a rename, the problem is with following the rename in a way that is useful for whatever Git command you are invoking. > It should be noted that (IIRC) it isn't *default* behaviour for > Git to follow changes across renames[1], but AFAIK the "--follow" > option is the typical way to ask it to do so, and the likes of > vc and magit can ensure that this is used automatically in cases > where it's necessary. Some Git commands don't have the --follow switch, AFAIR, or have it in a way that forbids using other useful options. So renaming still has its downsides, albeit they aren't catastrophic nor affect every single Git feature.