{"thread":{"id":"7637","subject":"[PATCH 0/3] attributes","startedAt":"2007-04-13T09:01:20Z","lastAt":"2007-04-13T15:02:17Z","messageCount":2,"participants":["Junio C Hamano","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"39274","messageId":"7vslb4d4wv.fsf@assigned-by-dhcp.cox.net","threadId":"7637","inReplyTo":null,"subject":"[PATCH 0/3] attributes","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-13T09:01:20Z","receivedAt":"2007-04-13T09:01:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is a series to implement the plumbing side support for\nassigning attributes to paths, and affect behaviour of git based\non them.\n\nAn attribute is a simple string.  A path either has it set, has\nit unset, or unspecified.  The assignment is done via\n$GIT_DIR/info/attributes file, and .gitattributes file in the\ndirectory that contain the path, and its parent directories.\nEntries in the .gitattribute file from the closest directory of\nthe path in question takes precedence, and entries in\n$GIT_DIR/info/attributes are used as the fallback.  In a single\nfile, later entries override earlier ones.  These rules are\nexactly the same as the existing path exclusion with\n$GIT_DIR/info/exclude file and .gitignore files in directories.\n\nEach line of these configuration files consists of a glob\npattern followed by white-space separated list of attribute\nnames.  Each attribute name can be prefixed with '!' to mean\n\"this attribute is not set for this path\".  The pattern matching\nrule of glob pattern is exactly the same as that of .gitignore.\nA pattern that has a slash in it matches using FNM_PATHNAME\n(i.e. the match is anchored to the directory the .gitattributes\nfile is found in), a pattern that doesn't matches just the\nbasename.\n\nSo, you can express:\n\n    \t*\tcrlf !nodiff\n        *.[oa]\t!crlf nodiff\n\t*.ps\tnodiff\n\tt/*.ps\t!nodiff\n\nto mean:\n\n\tIn general, I want all files to undergo autocrlf\n\tconversion, and I do not want to disable textual diff\n\toutput for them, but files whose name match *.o or *.a\n\tare binaries so do not touch them with autocrlf and do\n\tnot show textual diff for them.  Also, I do not want to\n\tsee diffs for *.ps files because I cannot read\n\tPostScript, but I do want to see diffs of PostScript\n\tfiles in t/ directory.  In either case, PostScript files\n\tundergo autocrlf conversion.\n\nSide note: You can think of .gitignore file to assign a single\nattribute, 'ignored', to each path, although it is not\nimplemented that way for two reasons (historical, and\nefficiency).\n\nSide note: Unlike the .gitattributes file, the .gitignore file\nformat has the negation '!' at the beginning of glob, but this\nis only because it only defines the implicit 'ignored' attribute\nand there is no \"list of attribute names\" to hang '!' mark to.\n\nThe first patch only defines the basic infrastructure to assign\nand check the attributes with paths.  The subsequent ones are\nsmall examples to have them affect some operations of git.\n\nThere are some things I considered but did not implement myself\n(at least not yet).  People who are interested in .gitattributes\nsupport would want to enhance in these areas.\n\n * There is no support for synthetic attributes yet.  The sample\n   conversion in [PATCH 2/3] makes autocrlf to be disabled by\n   '!crlf', and [PATCH 3/3] makes textual diff to be disabled by\n   'nodiff'.  The user should be able to set a single attribute,\n   'binary', to paths and, absense of other more specific\n   entries for crlf/nodiff sttributes, that should be enough to\n   automatically unset crlf and set nodiff.\n\n * Currently convert_to_{git,work_tree} routines have only \"do\n   we run autocrlf or not\" choice.  Ideally, there should be a\n   way to build a custom pipeline of filters, depending on the\n   set of attributes given to each path.\n\n * I've added sample hooks to the autocrlf conversion codepath\n   and textual diff generation codepath.  I think it should not\n   be too difficult to teach merge-recursive to notice an\n   attribute that says \"do not use usual file-level 3-way merge\n   on this path\", and use an external merge program.\n"},{"id":"39287","messageId":"81b0412b0704130802n185bd009l8c72a1dd6c00eb16@mail.gmail.com","threadId":"7637","inReplyTo":"7vslb4d4wv.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 0/3] attributes","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-04-13T15:02:17Z","receivedAt":"2007-04-13T15:02:17Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 4/13/07, Junio C Hamano <junkio@cox.net> wrote:\n> So, you can express:\n>\n>         *       crlf !nodiff\n>         *.[oa]  !crlf nodiff\n>         *.ps    nodiff\n>         t/*.ps  !nodiff\n>\n> to mean:\n>\n>         In general, I want all files to undergo autocrlf\n>         conversion, and I do not want to disable textual diff\n>         output for them, but files whose name match *.o or *.a\n>         are binaries so do not touch them with autocrlf and do\n>         not show textual diff for them.  Also, I do not want to\n>         see diffs for *.ps files because I cannot read\n>         PostScript, but I do want to see diffs of PostScript\n>         files in t/ directory.  In either case, PostScript files\n>         undergo autocrlf conversion.\n>\n\nI'd suggest to extend git-ls-files with a switch listing the\nfiles with attributes (and their attributes, of course).\nWill help to diagnose problems with attribute assignment.\n"}]}