{"thread":{"id":"60613","subject":"End-of-line comments are prompted with \"is not a valid attribute name\"","startedAt":"2023-12-13T17:32:23Z","lastAt":"2023-12-17T17:28:43Z","messageCount":4,"participants":["D无数","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"485623","messageId":"CAOQ=bxz8txyOt6p5L0qfx5DFKfxUhWvHW0pJP+YTbWVfBpvYxg@mail.gmail.com","threadId":"60613","inReplyTo":null,"subject":"End-of-line comments are prompted with \"is not a valid attribute name\"","fromName":"D无数","fromEmail":"wushuripple@gmail.com","sentAt":"2023-12-13T17:32:11Z","receivedAt":"2023-12-13T17:32:23Z","isPatch":false,"sender":{"key":"wushuripple@gmail.com","avatar":null},"body":"> macos 13.5.2\n> git version 2.37.0 (Apple Git-136)\n\nI use end-of-line comments in my .gitattributes file, and it is often\n(not always present, but often) prompted with '# is not a valid\nattribute name: .gitattributes:1' when performing many operations.\n\nThis is my .gitattributes:\n```\nres/csv/*.txt eol=lf # 保证csv为lf，以匹配解析格式\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n```\n\nWhen performing certain operations:\n···shell\n> git status\n# is not a valid attribute name: .gitattributes:1\nOn branch master\nYour branch is up to date with 'origin/master'.\n\nnothing to commit, working tree clean\n···\n\nOther repositories that have .gitattributes files and include\nend-of-line comments do the same thing. I'm sure there are no special\ncharacters in my files.\n"},{"id":"485626","messageId":"xmqqsf45nbzm.fsf@gitster.g","threadId":"60613","inReplyTo":"CAOQ=bxz8txyOt6p5L0qfx5DFKfxUhWvHW0pJP+YTbWVfBpvYxg@mail.gmail.com","subject":"Re: End-of-line comments are prompted with \"is not a valid attribute name\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-12-13T19:22:53Z","receivedAt":"2023-12-13T19:22:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"D无数 <wushuripple@gmail.com> writes:\n\n> This is my .gitattributes:\n> ```\n> res/csv/*.txt eol=lf # 保证csv为lf，以匹配解析格式\n\nI do not think of any version of Git ignoring what you wrote after #\n(including #) in the middle of the line.\n\n> # Custom for Visual Studio\n\nI know I designed the parser to allow this as a comment, though.\n\nSo\n\n> When performing certain operations:\n> ···shell\n>> git status\n> # is not a valid attribute name: .gitattributes:1\n\nThis is totally expected; nothing to see here.\n\n"},{"id":"485759","messageId":"xmqqo7eoiwcb.fsf@gitster.g","threadId":"60613","inReplyTo":"xmqqsf45nbzm.fsf@gitster.g","subject":"Re: End-of-line comments are prompted with \"is not a valid attribute name\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-12-17T17:15:48Z","receivedAt":"2023-12-17T17:15:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> This is totally expected; nothing to see here.\n\nTo put it another way, we do not have \"end-of-line comment\"\n(i.e. the leading part of a line has payload, but the line is\nchomped in the middle with a comment character and the remainder of\nthe line is ignored) at all.  We have \"commented line\" (in other\nwords, a line that is totally commented out and gets ignored).\n\nI think it is very clearly documented in \"git help attributes\":\n\n    A `gitattributes` file is a simple text file that gives\n    `attributes` to pathnames.\n\n    Each line in `gitattributes` file is of form:\n\n            pattern attr1 attr2 ...\n\n    That is, a pattern followed by an attributes list,\n    separated by whitespaces. Leading and trailing whitespaces are\n    ignored. Lines that begin with '#' are ignored. Patterns\n    that begin with a double quote are quoted in C style.\n\n"},{"id":"485760","messageId":"CAOQ=bxyBVRJN68iLs7g=DjB+J7aHEFgwnGuhS_ub2=q3StiRkQ@mail.gmail.com","threadId":"60613","inReplyTo":"xmqqo7eoiwcb.fsf@gitster.g","subject":"Re: End-of-line comments are prompted with \"is not a valid attribute name\"","fromName":"D无数","fromEmail":"wushuripple@gmail.com","sentAt":"2023-12-17T17:28:30Z","receivedAt":"2023-12-17T17:28:43Z","isPatch":false,"sender":{"key":"wushuripple@gmail.com","avatar":null},"body":"I see, thanks for the answer.\nI was fooled by the VSCode highlighting, but also because I didn't try\nto figure out the documentation carefully.\n\nJunio C Hamano <gitster@pobox.com> 于2023年12月18日周一 01:15写道：\n>\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> > This is totally expected; nothing to see here.\n>\n> To put it another way, we do not have \"end-of-line comment\"\n> (i.e. the leading part of a line has payload, but the line is\n> chomped in the middle with a comment character and the remainder of\n> the line is ignored) at all.  We have \"commented line\" (in other\n> words, a line that is totally commented out and gets ignored).\n>\n> I think it is very clearly documented in \"git help attributes\":\n>\n>     A `gitattributes` file is a simple text file that gives\n>     `attributes` to pathnames.\n>\n>     Each line in `gitattributes` file is of form:\n>\n>             pattern attr1 attr2 ...\n>\n>     That is, a pattern followed by an attributes list,\n>     separated by whitespaces. Leading and trailing whitespaces are\n>     ignored. Lines that begin with '#' are ignored. Patterns\n>     that begin with a double quote are quoted in C style.\n>\n"}]}