diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-02 01:35:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 01:35:38 -0800 |
commit | 2dffbec4866fef00e3b438472dd79ca7fca56263 (patch) | |
tree | 76ff997fcd52212fdbd32192725d26dfa6a136ca /.gitattributes | |
parent | 8e3ff9b39c8e9ecd9549c04ceef6665fdc6c11b1 (diff) | |
download | spack-2dffbec4866fef00e3b438472dd79ca7fca56263.tar.gz spack-2dffbec4866fef00e3b438472dd79ca7fca56263.tar.bz2 spack-2dffbec4866fef00e3b438472dd79ca7fca56263.tar.xz spack-2dffbec4866fef00e3b438472dd79ca7fca56263.zip |
git: add .gitattributes file (#13947)
Add a line to .gitattributes so that `git grep -p` shows function names
properly for `*.py` files. Without this, the class name is shown instead
of the function for python files.
This also causes diff output to use proper functions as hunk headers in
`diff` output.
Here's an example with `git grep -p`.
Before:
$ git grep -p spack_cc var/spack/repos/builtin/packages/athena
var/spack/repos/builtin/packages/athena/package.py=class Athena(AutotoolsPackage):
var/spack/repos/builtin/packages/athena/package.py: env.set('CC', spack_cc)
var/spack/repos/builtin/packages/athena/package.py: env.set('LDR', spack_cc)
After:
$ git grep -p spack_cc var/spack/repos/builtin/packages/athena
var/spack/repos/builtin/packages/athena/package.py= def setup_build_environment(self, env):
var/spack/repos/builtin/packages/athena/package.py: env.set('CC', spack_cc)
var/spack/repos/builtin/packages/athena/package.py: env.set('LDR', spack_cc)
Here's an example with `diff`.
Before:
$ git show c5da94eb585d503248234ce18f24ffff4bd1f47c
[...]
@@ -28,6 +29,7 @@ print(u'\\xc3')
# make it executable
fs.set_executable(script_name)
+ filter_shebangs_in_directory('.', [script_name])
# read the unicode back in and see whether things work
script = ex.Executable('./%s' % script_name)
After:
$ git show c5da94eb585d503248234ce18f24ffff4bd1f47c
[...]
@@ -28,6 +29,7 @@ def test_read_unicode(tmpdir):
# make it executable
fs.set_executable(script_name)
+ filter_shebangs_in_directory('.', [script_name])
# read the unicode back in and see whether things work
script = ex.Executable('./%s' % script_name)
Diffstat (limited to '.gitattributes')
-rw-r--r-- | .gitattributes | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..95105a3731 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.py diff=python |