-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally warn (once) if repository is shallow/sparse #253
Conversation
license-maven-plugin/src/main/java/com/mycila/maven/plugin/license/AbstractLicenseMojo.java
Outdated
Show resolved
Hide resolved
@dbwiddis I'm adding github actions ci in...waiting on abilty to self merge as I'm otherwise waiting. I trust that a bit more than what all this seems to be trying to pull off in travis CI so I'll come back to this afterwards. Hopefully later this weekend. As to the change, I feel like the default may need flipped but false to start with while its being floated around seems like a logic first step. We did something similar on formatter maven plugin and even flipped the flag for our next release after it was proven out. Anyway, this is useful in regards to your other findings ;) |
I went back and forth on a few other ideas. The shallow history is only really relevant if you're generating copyright range using I pondered checking for those definitions in the template and defaulting to true only if they were defined, and/or issuing a log warning but figured it would get lost in log spam if defaulting true, and lost in header rewrite spam otherwise, and ultimately increases complexity. What I really wanted to do is do a regex digit match for the beginning year of the copyright, only when those substitutions were used, and ignore the "newer" year if it was a shallow clone. Once I got to the two branches (strict vs. not) I decided it wasn't worth the effort. Potentially this setting should be mentioned in the documentation for those two template substitutions, though. |
Converting this to a draft because I think this can be done one of two ways without the
|
Thanks guys for looking into that 👍 |
OK, new approach! I think this makes a lot more sense, causing a failure when it should...
|
Hmm, obviously I messed something up. Will hunt down that NPE. |
It's throwing NPE on this line (two places):
After my latest fix it is impossible for |
Ah, I see the problem, the test is passing
I'll instantiate a new somethingMojo in the test... |
Switched back to draft for 2 discussion points:
|
...en-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/CopyrightAuthorProvider.java
Outdated
Show resolved
Hide resolved
license-maven-plugin-git/src/main/java/com/mycila/maven/plugin/license/git/GitLookup.java
Show resolved
Hide resolved
I I maybe lacking context (I don't understand fully the question), but if it is regarding injected Maven properties, then we have to stub them in our test. In real life they won't be null. Or the question is regarding the existence or not of a git repo when this plugin is used ? |
That was essentially the question. The context was that in the test cases (here) we were passing null which wasn't a problem when we never referred to the mojo, but is now. So my "test fix" creating a new mojo was the appropriate way to address this. I'll mark this as ready again, pending further discussion! |
ba06ac9
to
59146fc
Compare
@dbwiddis I'm sorry I didn't notice all your last activity... I was wondering if your PR is ready to be reviewed again, and also if you could rebase it if it is ? Thanks a lot! |
Rebased to master, although I don't think that's necessary when GitHub says "This branch has no conflicts with the base branch." I think this PR is GTG but please note #300 which is essentially the same problem as I'm trying to solve here, but far less detectable, and I believe is a blocking bug to your next release. I'd suggest at least thinking through the solution to #300 before merging this to see if there are any changes needed. Also note that I had submitted #286 for comment, which would be a workaround to this. I withdrew it because I think there's room for a much more flexible way of tokenizing the whole copyright line (basically everything after the word "copyright" up to the next newline should be allowed to be kept as is) which would also be a workaround for this. |
Thanks! Will merge. |
Fixes #252.
Adds a new parameterskipIfShallow
that will have the same effect asskip
if executed on a shallow clone.