Re: [PATCHv3 2/2] Documentation: enhance gitignore whitelist example
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:59
Eric Blake [off-list ref] writes:
v3: split out fnmatch tweaks, don't tweak specification of patterns or existing examples but instead add an entirely new example, make the example use a deeper hierarchy
Somebody has to compare this vs making the existing example larger. Generally speaking, I prefer to keep the number of examples smaller (the less the beginner has to read, the better), but the end result might be more readable with a separate example, like this patch does.
+ $ cat .gitignore + # Use anchoring, since `build' would ignore Documentation/build.
+ # Do not ignore the directory itself, ... + # /build/ + # rather ignore files in the top-level build directory, ...
Do you _really_ need these three lines? I suspect that it is unclear to the first reader that the second one is a _bad_ example that is commented out. That is, how about starting like this, without the above three?
+ # Ignore files in the top-level build directory, ... + /build/* + # but permit child directories, ... + !/build/*/ + # then ignore all nested files, ... + /build/*/* + # and finally white-list the special file
Nit; s/the special file/&./;
+ !/build/foo/baz + $ git status + [...] + # Untracked files: + [...] + # Documentation/build/file + # build/foo/baz + [...]
Other than that, as a free-standing example this was very straightforward illustration. I didn't check the flow-of-learning though. Thanks.