Closed cyrus-smith-93 closed 7 years ago
I partially fix it by replacing in .git/hooks/pre-commit
# require '.githooks/license-maintainer/license.pm';
require '/home/lx93uv/ansi-c89/.githooks/license-maintainer/license.pm';
Also, it shows
NOTE: Some files had license problems, kindly fix them in a separate commit by running:
INJECT_LICENSES=1 git commit --allow-empty -m 'Add/update licenses for all maintained files' --edit
This adds/updates licenses for all maintained files, i.e.
- adds license to files lacking an license
- adds the author (configured in the "license.author" configuration option) to
files lacking an author
- adds missing years to existing licenses, for example if some user committed
stuff without updating the license e.g. did not have the pre-commit hook
installed
So, script doesn't insert license automatically. User must manually execute this
`
INJECT_LICENSES=1 git commit --allow-empty -m 'Add/update licenses for all maintained files' --edit
command, right? Is here way to automate this?
and, what is it?
$ git log --oneline
22726b2 Add/update licenses for all maintained files
be4eaf6 git license maintaining hook test
e676d78 Merge remote-tracking branch 'githooks-license-maintainer/hooks-only'
5ba86ca adds `GNU Make` build scripts, necessary books
aa2a4a5 Merge pull request #6 from lalloni/hooks-only
77e0f3a Allow author names to contain email addresses
47da504 README: git 2.9 fixes to installation instructions
01a02d4 Update README.md
7636375 Add xml support
47c3095 NOTE! Add note about directory structure update
e162019 Update README.md
77e8394 Fixes #1
558c6a0 README: Command for verifying license template configuration
ef672cd Document .gitattributes file in overview
f6ba278 Copy .gitignore from master
fbf1102 Include filename if license file cannot be read
7480d1a Install script should be executable
c50ee5f README: How to temporarily inhibit license maintenance
c29c290 README: Add license section
630c915 Implement #2: Externalize license configuration by adopting gitattributes instead.
f6fafc0 automatic install is optional
7fa964e Initial instructions
So, it's also pollutes log.
Hi, thanks for your report.
I have been able to reproduce your Can't locate .githooks/license-maintainer/license.pm in @INC
on one machine.. I must have accidentally misused some undocumented feature/bug or something since it used to work. Will find a proper fix.
Yes it pollutes the log with all commits from the license-maintainer tree. I guess I could separately make releases with squashed commits as well for those who prefer. Of course you can always just copy the files into your tree (instead of using git to import them) and do the committing yourself..
The idea with injecting licenses only to changed files is meant so that it doesn't change the list of files included in the commit, i.e. keep the scope the same. A separate commit for license injection is imo cleaner, but you can of course use --amend or similar measures to merge them if you want.
Usually you only need to run the suggested command once or a few times (if you configure new file extensions that needs license preamble), so having it in a script isn't that helpful.. and allows you to easily edit the command / commit message as you like.
Thank you for replies,
I simply looked for solution of auto-inserting license to sources.
I make hook works when change in .git/hooks/pre-commit
# require '.githooks/license-maintainer/license.pm';
require '/home/lx93uv/.../.githooks/license-maintainer/license.pm';
But I couldn't understand, why absolute path works, and relative doesn't?
It seems that "current directory" used to be in @INC
e.g. Perl's search path before, but nowadays it isn't anymore. So I fixed it (hopefully!) by always adding "current directory" to @INC
.
Please try the new version and let me know if it worked for you too.
debian 9
I have made, folowing the instructions, in my custom git repo:
In my repo root I add
.gitattributes
:And, when I
git commit
next message appears:Can someone help to fix it?