{"thread":{"id":"31783","subject":"rm and add, but not rename, of identical files","startedAt":"2012-10-10T18:39:07Z","lastAt":"2012-10-11T16:53:12Z","messageCount":5,"participants":["Drew Northup","Andreas Schwab","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"200937","messageId":"1349894347.32696.10.camel@drew-northup.unet.maine.edu","threadId":"31783","inReplyTo":null,"subject":"rm and add, but not rename, of identical files","fromName":"Drew Northup","fromEmail":"drew.northup@maine.edu","sentAt":"2012-10-10T18:39:07Z","receivedAt":"2012-10-10T18:39:07Z","isPatch":false,"sender":{"key":"drew.northup@maine.edu","avatar":"https://avatars.githubusercontent.com/u/18331571?v=4"},"body":"I use etckeeper on some of my systems, backed by Git. On a system still\nusing a SYSV style init I recently modified my iptables settings,\nchanging which runlevels would stop/start the firewall.\n\n[root@drew-northup ~]# etckeeper vcs status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add/rm <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#       modified:   inittab\n#       deleted:    rc.d/rc2.d/K92iptables\n#       deleted:    rc.d/rc3.d/K92iptables\n#       deleted:    rc.d/rc4.d/K92iptables\n#       deleted:    rc.d/rc5.d/K92ip6tables\n#       modified:   sysconfig/ip6tables\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       rc.d/rc2.d/S08iptables\n#       rc.d/rc3.d/S08iptables\n#       rc.d/rc4.d/S08iptables\n#       rc.d/rc5.d/S08ip6tables\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nIt detects the changes as renames however—which in this case isn't\nappropriate:\n\n[root@drew-northup ~]# etckeeper vcs status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       renamed:    rc.d/rc2.d/K92iptables -> rc.d/rc2.d/S08iptables\n#       renamed:    rc.d/rc3.d/K92iptables -> rc.d/rc3.d/S08iptables\n#       renamed:    rc.d/rc4.d/K92iptables -> rc.d/rc4.d/S08iptables\n#       renamed:    rc.d/rc5.d/K92ip6tables -> rc.d/rc5.d/S08ip6tables\n#\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#       modified:   inittab\n#       modified:   sysconfig/ip6tables\n#\n\nIs there something I should be doing to suppress rename detection in\nthis case? (I presume changing the default—detecting as a rename—isn't\nsuch a bright idea.)\n\n[root@drew-northup ~]# etckeeper vcs --version\ngit version 1.7.11.3\n\n-- \n-Drew Northup\n________________________________________________\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"},{"id":"200948","messageId":"m2wqyyw0l0.fsf@igel.home","threadId":"31783","inReplyTo":"1349894347.32696.10.camel@drew-northup.unet.maine.edu","subject":"Re: rm and add, but not rename, of identical files","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-10-10T20:09:47Z","receivedAt":"2012-10-10T20:09:47Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Drew Northup <drew.northup@maine.edu> writes:\n\n> It detects the changes as renames however—which in this case isn't\n> appropriate:\n\nWhy is that a problem?  A rename is just something which is computed on\nthe fly for display purpose, the repository only stores a snapshot of\nthe resulting tree.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"200958","messageId":"7v1uh6atjl.fsf@alter.siamese.dyndns.org","threadId":"31783","inReplyTo":"1349894347.32696.10.camel@drew-northup.unet.maine.edu","subject":"Re: rm and add, but not rename, of identical files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-10-10T21:47:26Z","receivedAt":"2012-10-10T21:47:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Drew Northup <drew.northup@maine.edu> writes:\n\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #       rc.d/rc2.d/S08iptables\n> #       rc.d/rc3.d/S08iptables\n> #       rc.d/rc4.d/S08iptables\n> ...\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>\n> It detects the changes as renames however―which in this case isn't\n> appropriate:\n>\n> [root@drew-northup ~]# etckeeper vcs status\n> # On branch master\n> # Changes to be committed:\n> #   (use \"git reset HEAD <file>...\" to unstage)\n> #\n> #       renamed:    rc.d/rc2.d/K92iptables -> rc.d/rc2.d/S08iptables\n> #       renamed:    rc.d/rc3.d/K92iptables -> rc.d/rc3.d/S08iptables\n> #       renamed:    rc.d/rc4.d/K92iptables -> rc.d/rc4.d/S08iptables\n> #...\n\nGiven that all of these six files have the same contents, I actually\nam slightly impressed how well Git matched them up ;-).\n\nBut more seriously, why do you have rc.d/rc2.d/S08iptables untracked\nin the working tree but in the index to be committed?\n"},{"id":"200989","messageId":"1349968240.32696.22.camel@drew-northup.unet.maine.edu","threadId":"31783","inReplyTo":"7v1uh6atjl.fsf@alter.siamese.dyndns.org","subject":"Re: rm and add, but not rename, of identical files","fromName":"Drew Northup","fromEmail":"drew.northup@maine.edu","sentAt":"2012-10-11T15:10:40Z","receivedAt":"2012-10-11T15:10:40Z","isPatch":false,"sender":{"key":"drew.northup@maine.edu","avatar":"https://avatars.githubusercontent.com/u/18331571?v=4"},"body":"On Wed, 2012-10-10 at 14:47 -0700, Junio C Hamano wrote:\n> Drew Northup <drew.northup@maine.edu> writes:\n> \n> > # Untracked files:\n> > #   (use \"git add <file>...\" to include in what will be committed)\n> > #\n> > #       rc.d/rc2.d/S08iptables\n> > #       rc.d/rc3.d/S08iptables\n> > #       rc.d/rc4.d/S08iptables\n> > ...\n> > no changes added to commit (use \"git add\" and/or \"git commit -a\")\n> >\n> > It detects the changes as renames however―which in this case isn't\n> > appropriate:\n> >\n> > [root@drew-northup ~]# etckeeper vcs status\n> > # On branch master\n> > # Changes to be committed:\n> > #   (use \"git reset HEAD <file>...\" to unstage)\n> > #\n> > #       renamed:    rc.d/rc2.d/K92iptables -> rc.d/rc2.d/S08iptables\n> > #       renamed:    rc.d/rc3.d/K92iptables -> rc.d/rc3.d/S08iptables\n> > #       renamed:    rc.d/rc4.d/K92iptables -> rc.d/rc4.d/S08iptables\n> > #...\n> \n> Given that all of these six files have the same contents, I actually\n> am slightly impressed how well Git matched them up ;-).\n> \n> But more seriously, why do you have rc.d/rc2.d/S08iptables untracked\n> in the working tree but in the index to be committed?\n\nMissing steps in the mail body: etckeeper vcs add <File> & etckeeper vcs\nrm <File> commands. I pared it back to the absolute minimum.\n\nIs that what you're asking about?\n\n-- \n-Drew Northup\n________________________________________________\n\"As opposed to vegetable or mineral error?\"\n-John Pescatore, SANS NewsBites Vol. 12 Num. 59\n"},{"id":"200997","messageId":"7v4nm17xxj.fsf@alter.siamese.dyndns.org","threadId":"31783","inReplyTo":"1349968240.32696.22.camel@drew-northup.unet.maine.edu","subject":"Re: rm and add, but not rename, of identical files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-10-11T16:53:12Z","receivedAt":"2012-10-11T16:53:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Drew Northup <drew.northup@maine.edu> writes:\n\n> On Wed, 2012-10-10 at 14:47 -0700, Junio C Hamano wrote:\n>> Drew Northup <drew.northup@maine.edu> writes:\n>> \n>> > # Untracked files:\n>> > #   (use \"git add <file>...\" to include in what will be committed)\n>> > #\n>> > #       rc.d/rc2.d/S08iptables\n>> > #       rc.d/rc3.d/S08iptables\n>> > #       rc.d/rc4.d/S08iptables\n>> > ...\n>> > no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>> >\n>> > It detects the changes as renames however―which in this case isn't\n>> > appropriate:\n>> >\n>> > [root@drew-northup ~]# etckeeper vcs status\n>> > # On branch master\n>> > # Changes to be committed:\n>> > #   (use \"git reset HEAD <file>...\" to unstage)\n>> > #\n>> > #       renamed:    rc.d/rc2.d/K92iptables -> rc.d/rc2.d/S08iptables\n>> > #       renamed:    rc.d/rc3.d/K92iptables -> rc.d/rc3.d/S08iptables\n>> > #       renamed:    rc.d/rc4.d/K92iptables -> rc.d/rc4.d/S08iptables\n>> > #...\n>> \n>> Given that all of these six files have the same contents, I actually\n>> am slightly impressed how well Git matched them up ;-).\n>> \n>> But more seriously, why do you have rc.d/rc2.d/S08iptables untracked\n>> in the working tree but in the index to be committed?\n>\n> Missing steps in the mail body: etckeeper vcs add <File> & etckeeper vcs\n> rm <File> commands. I pared it back to the absolute minimum.\n>\n> Is that what you're asking about?\n\nYes.  Without the \"add\" step, detecting the K92iptables that has\nbeen moved to an untracked S08iptables as rename looked like a magic\n(read: bug) to me, and that was why I asked.\n\nAren't K92iptables and S08iptables the same script with\n\n  case \"$1\" in start) ... start thing ...;; stop) ... stop thing ...;; esac\n\nin it?\n\nOn Debian, these S/K files appear directly under /etc without\nintermediate rc.d level, and they are symbolic links to real files\nin /etc/init.d/, so extrapolating from that knowledge and with a bit\nof imagination that some systems might keep copies of these files\ninstead of linking to the same thing, I would actually find it\ndesireable to call the move from K92iptables to S08iptables a\nrename, rather than reporting a removal and a addition of unrelated\nfiles.\n"}]}