{"thread":{"id":"30225","subject":"Unexpected empty directory removal","startedAt":"2012-04-12T17:08:20Z","lastAt":"2012-04-12T19:11:07Z","messageCount":3,"participants":["Gary Wilson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189120","messageId":"4F870C04.9060304@of-networks.co.uk","threadId":"30225","inReplyTo":null,"subject":"Unexpected empty directory removal","fromName":"Gary Wilson","fromEmail":"gary.wilson@of-networks.co.uk","sentAt":"2012-04-12T17:08:20Z","receivedAt":"2012-04-12T17:08:20Z","isPatch":false,"sender":{"key":"gary.wilson@of-networks.co.uk","avatar":null},"body":"Hi\n\nI do not normally report things such as this and they are usually\n\"features\", however this one seems overly strange to me as directories\nand files are different things and I would expected a source code\nversioning system to adhere to that.\n\nUse case to replicate:\n\n1. Have path/files/a.file exists (and/or path/files/*) on client A and\nclient B\n2. Remove the physical files from the path/files/ directory on client A,\nso that the directory is empty\n3. git commit\n4. git pull on client B\n5. On client A an empty path/files/ directory exists on client B it has\nbeen removed, meaning path/files/ no longer exists.\n\nIs this the expected behaviour?  As if it is, I will definitely bear\nthat in mind and note that git will not make empty directories AND will\nremove empty directories from all clients apart from the client that\nemptied the directory.\n\nclient A: git version 1.7.0.4\nclient B: git version 1.7.1\ngit server: whatever github.com is running\n\nRegards\nGary\n"},{"id":"189127","messageId":"7vehrs6bt1.fsf@alter.siamese.dyndns.org","threadId":"30225","inReplyTo":"4F870C04.9060304@of-networks.co.uk","subject":"Re: Unexpected empty directory removal","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-12T18:32:26Z","receivedAt":"2012-04-12T18:32:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gary Wilson <gary.wilson@of-networks.co.uk> writes:\n\n> Use case to replicate:\n>\n> 1. Have path/files/a.file exists (and/or path/files/*) on client A and\n> client B\n> 2. Remove the physical files from the path/files/ directory on client A,\n> so that the directory is empty\n> 3. git commit\n> 4. git pull on client B\n> 5. On client A an empty path/files/ directory exists on client B it has\n> been removed, meaning path/files/ no longer exists.\n>\n> Is this the expected behaviour?\n\nAs Git does not track directories at all, but merely uses directories as a\nmeans to instantiate files (which it tracks), when the last file is\nremoved as the result of a merge in repository B, it notices that the\ndirectory is no longer needed to hold anything it cares about, and removes\nit.\n\nIf you ran \"git rm path/files/a.file\" in repository A to remove the last\nfile in the directory may also remove the now-empty directory (I do not\nremember offhand if it does), which is also expected.\n"},{"id":"189129","messageId":"4F8728CB.2030201@of-networks.co.uk","threadId":"30225","inReplyTo":"7vehrs6bt1.fsf@alter.siamese.dyndns.org","subject":"Re: Unexpected empty directory removal","fromName":"Gary Wilson","fromEmail":"gary.wilson@of-networks.co.uk","sentAt":"2012-04-12T19:11:07Z","receivedAt":"2012-04-12T19:11:07Z","isPatch":false,"sender":{"key":"gary.wilson@of-networks.co.uk","avatar":null},"body":"Thanks for the clarification and verification of that expected behaviour\nJunio.  I shall keep this in mind.\n\nRegards\nGary\n\nOn 12/04/12 19:32, Junio C Hamano wrote:\n> Gary Wilson <gary.wilson@of-networks.co.uk> writes:\n>\n>> Use case to replicate:\n>>\n>> 1. Have path/files/a.file exists (and/or path/files/*) on client A and\n>> client B\n>> 2. Remove the physical files from the path/files/ directory on client A,\n>> so that the directory is empty\n>> 3. git commit\n>> 4. git pull on client B\n>> 5. On client A an empty path/files/ directory exists on client B it has\n>> been removed, meaning path/files/ no longer exists.\n>>\n>> Is this the expected behaviour?\n> As Git does not track directories at all, but merely uses directories as a\n> means to instantiate files (which it tracks), when the last file is\n> removed as the result of a merge in repository B, it notices that the\n> directory is no longer needed to hold anything it cares about, and removes\n> it.\n>\n> If you ran \"git rm path/files/a.file\" in repository A to remove the last\n> file in the directory may also remove the now-empty directory (I do not\n> remember offhand if it does), which is also expected.\n>\n"}]}