- 
                Notifications
    You must be signed in to change notification settings 
- Fork 55
Open
Description
Repro
$ cat .github/LICENSE
Copyright 2024 Marc-Antoine Ruel. All rights reserved.
Use of this source code is governed under the Apache License, Version 2.0
that can be found in the LICENSE file.
$ cat .pre-commit-config.yaml
# Copyright 2024 Marc-Antoine Ruel. All rights reserved. 
# Use of this source code is governed under the Apache License, Version 2.0 
# that can be found in the LICENSE file. 
 
repos: 
- repo: https://github.com/Lucas-C/pre-commit-hooks 
  rev: v1.5.5 
  hooks: 
  - id: insert-license 
    name: "Insert license header in C++ source files" 
    args: ["--license-filepath=.github/LICENSE"] 
Expected
Hook insert-license doesn't touch the file specified as --license-filepath
Actual
Hook insert-license inserts the license (duplicate) to the file specified as --license-filepath, breaking the license check.
$ pre-commit
Insert license header in C++ source files................................Failed
- hook id: insert-license
- exit code: 1
- files were modified by this hook
Some sources were modified by the hook ['.github/LICENSE']
Now aborting the commit.
You should check the changes made. Then simply "git add --update ." and re-commit
$ git diff
diff --git .github/LICENSE .github/LICENSE
index cb92896..ba4255b 100644
--- .github/LICENSE
+++ .github/LICENSE
@@ -1,3 +1,7 @@
+# Copyright 2024 Marc-Antoine Ruel. All rights reserved.
+# Use of this source code is governed under the Apache License, Version 2.0
+# that can be found in the LICENSE file.
+
 Copyright 2024 Marc-Antoine Ruel. All rights reserved.
 Use of this source code is governed under the Apache License, Version 2.0
 that can be found in the LICENSE file.
Metadata
Metadata
Assignees
Labels
No labels