{"thread":{"id":"57547","subject":"Request: a way to ignore .gitattributes","startedAt":"2022-03-12T18:14:15Z","lastAt":"2022-03-13T16:20:07Z","messageCount":4,"participants":["Sean MacLennan","rsbecker@nexbridge.com","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"451224","messageId":"20220312130712.6d9d2d00@zonker.seanm.ca","threadId":"57547","inReplyTo":null,"subject":"Request: a way to ignore .gitattributes","fromName":"Sean MacLennan","fromEmail":"seanm@seanm.ca","sentAt":"2022-03-12T18:07:12Z","receivedAt":"2022-03-12T18:14:15Z","isPatch":false,"sender":{"key":"seanm@seanm.ca","avatar":null},"body":"Hi,\n\nWe have a git repo that is a mirror of an svn repo. The tools create a\nhuge .gitattribute file that is about 83,000 entries. Almost all are of\nthe form: <path> -text\n\nThis file kills git grep. A grep that takes <1s without the file takes\nalmost 2 minutes with the file. So git grep it unusable.\n\nMy current solution is to rename the file:\n\n-#define GITATTRIBUTES_FILE \".gitattributes\"\n+#define GITATTRIBUTES_FILE \".gitattributes-no\"\n\nBut I would like a cleaner solution so I don't have to maintain my own\ngit.\n\nMy request is more for what would be the best gitish way to solve this;\nI am willing to do the actual patch.\n\nThis needs to be something in the local config and not global. My\ncurrent thoughts are:\n\n1) A way to override the default name (much like I do now):\n   gitattributesfile = .gitattributes-no\n\n2) A flag variable:\n   gitattributes = ignore\n        or\n   ignoreattributes = true\n\nI personally like 1) because it would also work for the case where you\nwant to override a bad .gitattributes file (that you have no control\nover) with a good .gitattributes file. I just think it would be more\ngenerally useful.\n\nBut I would like to pick a solution that is most likely to get\naccepted.\n\nCheers,\n   Sean MacLennan\n"},{"id":"451226","messageId":"01ab01d83656$071d7cd0$15587670$@nexbridge.com","threadId":"57547","inReplyTo":"20220312130712.6d9d2d00@zonker.seanm.ca","subject":"RE: Request: a way to ignore .gitattributes","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2022-03-12T21:13:26Z","receivedAt":"2022-03-12T21:13:38Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On March 12, 2022 1:07 PM, Sean MacLennan wrote:\n>We have a git repo that is a mirror of an svn repo. The tools create a huge\n>.gitattribute file that is about 83,000 entries. Almost all are of the\nform: <path> -\n>text\n>\n>This file kills git grep. A grep that takes <1s without the file takes\nalmost 2 minutes\n>with the file. So git grep it unusable.\n>\n>My current solution is to rename the file:\n>\n>-#define GITATTRIBUTES_FILE \".gitattributes\"\n>+#define GITATTRIBUTES_FILE \".gitattributes-no\"\n>\n>But I would like a cleaner solution so I don't have to maintain my own git.\n>\n>My request is more for what would be the best gitish way to solve this; I\nam willing\n>to do the actual patch.\n>\n>This needs to be something in the local config and not global. My current\nthoughts\n>are:\n>\n>1) A way to override the default name (much like I do now):\n>   gitattributesfile = .gitattributes-no\n>\n>2) A flag variable:\n>   gitattributes = ignore\n>        or\n>   ignoreattributes = true\n>\n>I personally like 1) because it would also work for the case where you want\nto\n>override a bad .gitattributes file (that you have no control\n>over) with a good .gitattributes file. I just think it would be more\ngenerally useful.\n>\n>But I would like to pick a solution that is most likely to get accepted.\n\nThese may seem a little off the wall, but:\n1. Could you use a clean/smudge approach to mess with your bad\n.gitattributes file before it gets put down on disk? I realize that\nregistering the filter might not be possible given that you need to muck\nwith .gitattributes to do it, but if you have any control at all and can get\nthe filter in, perhaps that might be a way to clean up the bad\n.gitattributes file.\n2. What about a post-checkout hook that fixes .gitattributes and then does\nan update-index --assume-unchanged on it. This is under the assumption that\nyou will never change .gitattributes in your clone.\n\nMy $0.02,\n--Randall\n\n--\nBrief whoami: NonStop&UNIX developer since approximately\nUNIX(421664400)\nNonStop(211288444200000000)\n-- In real life, I talk too much.\n\n\n\n"},{"id":"451228","messageId":"xmqq8rten31r.fsf@gitster.g","threadId":"57547","inReplyTo":"01ab01d83656$071d7cd0$15587670$@nexbridge.com","subject":"Re: Request: a way to ignore .gitattributes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-12T23:50:40Z","receivedAt":"2022-03-12T23:50:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"<rsbecker@nexbridge.com> writes:\n\n> These may seem a little off the wall, but:\n> 1. Could you use a clean/smudge approach to mess with your bad\n> .gitattributes file before it gets put down on disk? I realize that\n> registering the filter might not be possible given that you need to muck\n> with .gitattributes to do it, but if you have any control at all and can get\n> the filter in, perhaps that might be a way to clean up the bad\n> .gitattributes file.\n> 2. What about a post-checkout hook that fixes .gitattributes and then does\n> an update-index --assume-unchanged on it. This is under the assumption that\n> you will never change .gitattributes in your clone.\n\nAhh, that's cleverer than what I had initially as a knee-jerk\nreaction, which was \"fix the tool that emits '$path -text' for each\nand every path in the repository and instead use '* -text' perhaps?\".\n\n\n\n"},{"id":"451249","messageId":"20220313121951.093495fb@zonker.seanm.ca","threadId":"57547","inReplyTo":"01ab01d83656$071d7cd0$15587670$@nexbridge.com","subject":"Re: Request: a way to ignore .gitattributes","fromName":"Sean MacLennan","fromEmail":"seanm@seanm.ca","sentAt":"2022-03-13T16:19:51Z","receivedAt":"2022-03-13T16:20:07Z","isPatch":false,"sender":{"key":"seanm@seanm.ca","avatar":null},"body":"On Sat, 12 Mar 2022 16:13:26 -0500\n<rsbecker@nexbridge.com> wrote:\n\n> These may seem a little off the wall, but:\n> 1. Could you use a clean/smudge approach to mess with your bad\n> .gitattributes file before it gets put down on disk? I realize that\n> registering the filter might not be possible given that you need to\n> muck with .gitattributes to do it, but if you have any control at all\n> and can get the filter in, perhaps that might be a way to clean up\n> the bad .gitattributes file.\n\nI have no access to the servers.\n\n> 2. What about a post-checkout hook that fixes .gitattributes and then\n> does an update-index --assume-unchanged on it. This is under the\n> assumption that you will never change .gitattributes in your clone.\n\nThat seems to work. I did not know about update-index.\n\n> My $0.02,\n> --Randall\n\nCheers,\n   Sean\n"}]}