{"thread":{"id":"29188","subject":"Strange behaviour with git-add, .gitignore and a tracked file","startedAt":"2011-12-16T21:57:57Z","lastAt":"2011-12-16T23:42:30Z","messageCount":2,"participants":["David ‘Bombe’ Roden","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181343","messageId":"201112162258.04661.bombe@pterodactylus.net","threadId":"29188","inReplyTo":null,"subject":"Strange behaviour with git-add, .gitignore and a tracked file","fromName":"David ‘Bombe’ Roden","fromEmail":"bombe@pterodactylus.net","sentAt":"2011-12-16T21:57:57Z","receivedAt":"2011-12-16T21:57:57Z","isPatch":false,"sender":{"key":"bombe@pterodactylus.net","avatar":"https://gravatar.com/avatar/6845b170b5e882edcb27b015cdad0fb918f2d079c2cf77e668dcc71ae645ed87?d=mp&s=160"},"body":"Hi.\n\nI stumbled across some strange behaviour today:\n\n---\ngit init git-test\ncd git-test\necho '*' > .gitignore\ngit add -f .gitignore\ngit commit -m \"Add gitignore.\"\nmkdir dir\necho a > dir/file\ngit add -f dir/file\ngit commit -m \"Add dir/file.\"\necho b >> dir/file\ngit add dir/file\n---\n\nThe last git-add results in the following error message:\n\n---\nThe following paths are ignored by one of your .gitignore files:\ndir\nUse -f if you really want to add them.\nfatal: no files added\n---\n\nWhile it is true that the file specification matches a pattern in .gitignore, \nthe file is already tracked and should not be ignored.\n\nThis behaviour was reproduced with 1.7.7.4 (on OS X), 1.7.5.4, 1.7.1, \n1.7.8-247-g10f4eb6 (latest master as of a couple of hours ago) (all Linux).\n\n\nGreetings,\n\n\tDavid\n-- \nDavid ‘Bombe’ Roden <bombe@pterodactylus.net>\n"},{"id":"181353","messageId":"7vmxasf5i1.fsf@alter.siamese.dyndns.org","threadId":"29188","inReplyTo":"201112162258.04661.bombe@pterodactylus.net","subject":"Re: Strange behaviour with git-add, .gitignore and a tracked file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-12-16T23:42:30Z","receivedAt":"2011-12-16T23:42:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David ‘Bombe’ Roden  <bombe@pterodactylus.net> writes:\n\n> This behaviour was reproduced with 1.7.7.4 (on OS X), 1.7.5.4, 1.7.1, \n> 1.7.8-247-g10f4eb6 (latest master as of a couple of hours ago) (all Linux).\n\nDoesn't that suggest perhaps it could be a designed behaviour?\n\nPerhaps to help users to realize that their .gitignore pattern may want to\nbe improved?\n"}]}