NitorCreations / license-maintainer

Maintains license preamble in source files etc in your project
Other
15 stars 11 forks source link

How to resolve merge conflicts via the command line created by trying to integrate the license-maintainer? #9

Open jamesray1 opened 6 years ago

jamesray1 commented 6 years ago

So I got merge conflicts on several files with a pull request here. Here is the patch diff. I'm not sure how to resolve this, following the instructions to resolve the conflicts via the command line didn't help.

jamesray1 commented 6 years ago

I'll try to figure it out myself.

jamesray1 commented 6 years ago

I have no idea, I have spent ages on this now (more than 3 hours in total), and the only difference is that I am adding the license header to each file.

xkr47 commented 6 years ago

ok I will try to have a look in a few hours.. ok if I create a new PR if I manage to fix it? I will keep you as author of the commits as much as I can..

jamesray1 commented 6 years ago

So I get conflicting files, but I don't get any merge conflicts like here.

 ✘ james@james-Streacom  ~/dod   develop  git status
On branch develop
Your branch is up-to-date with 'origin/develop'.

nothing to commit, working tree clean
 james@james-Streacom  ~/dod   develop  git checkout jamesray1-develop
Switched to branch 'jamesray1-develop'
 james@james-Streacom  ~/dod   jamesray1-develop  git status
On branch jamesray1-develop
nothing to commit, working tree clean
 james@james-Streacom  ~/dod   jamesray1-develop  git remote --verbose
githooks-license-maintainer git@github.com:NitorCreations/license-maintainer.git (fetch)
githooks-license-maintainer git@github.com:NitorCreations/license-maintainer.git (push)
origin  https://github.com/jamesray1/diamond_drops.git (fetch)
origin  https://github.com/jamesray1/diamond_drops.git (push)
upstream    https://github.com/Drops-of-Diamond/diamond_drops (fetch)
upstream    https://github.com/Drops-of-Diamond/diamond_drops (push)
jamesray1 commented 6 years ago

@xkr47 I'll see how I go working on it in the meantime.

jamesray1 commented 6 years ago

Stopping for now, I may resume in the morning.

jamesray1 commented 6 years ago

OK I made progress with git diff <commit> <commit>

jamesray1 commented 6 years ago

It's OK I'm making progress with Meld after using git pull --rebase upstream develop, many git rebase --skips, git push origin develop, git pull origin develop and git mergetool --tool=meld.

xkr47 commented 6 years ago

I can see from your commits that using plain YEAR and AUTHORS as template keys was a devastatingly poor choice on my behalf. It will keep changing "AUTHORS" in the middle of the license text with the list of authors sadly. I will need to change that in my project so it will no longer do that. Need to figure out how to do that without breaking it for current users. Will get back to you on this.

jamesray1 commented 6 years ago

Yeah I should've pointed that out, thanks for reviewing!

jamesray1 commented 6 years ago

Note that for the Unlicense, you don't need to have a copyright line with the year and authors. I removed that line from my template and some files, while the output of the commit had the following for each file that didn't have a year or author:

Use of uninitialized value $years_str in split at .githooks/license-maintainer/license.pmline 118.
Use of uninitialized value $_[0] in split at .githooks/license-maintainer/license.pm line155.
xkr47 commented 6 years ago

Ok, this is a clear bug. I will fix it when I can.

jamesray1 commented 6 years ago

This is my patch for license.pm without references to year or authors. https://gist.github.com/jamesray1/914185797d335d96509be33c7062f420

Note that I have no experience with Perl until now. I just removed all references, then hacked modifications to fix compiler errors until I got to an error with the pre-commit.

While that seems to work, I need to modify the pre-commit next.

jamesray1 commented 6 years ago

So I commented out references in the pre-commit, but it is failing on line 131. https://gist.github.com/jamesray1/f9754e72c452a856cf02295991a4734e. I haven't been able to debug it using the Perl Debug extension with VS Code.

 james@james-Streacom  ~/dod   license-maintainer3 ✚  git commit -m "Comment out references to author and years.
dquote> "
Argument "// UML Generator https://github.com/adjivas/ml\nextern c..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use cli::config;\n\n#[derive(PartialEq)]\nenum ConfigTyp..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "/// The mode the client is running in\n#[derive(Debug, P..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use std::env;\n\npub fn get_env() -> String {\n    let k..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use fern;\nuse fern::colors::{Color, ColoredLevelConfig}..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "pub mod config;\npub mod config_env;\npub mod config_log..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use cli::config;\nuse notary;\nuse proposer;\nuse messag..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "#[derive(PartialEq, Debug, Clone)]\npub struct Body;" isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use collation::header;\nuse collation::body;\n\n#[derive..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use ethereum_types;\nuse tiny_keccak;\n\n#[derive(Partia..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "pub mod collation;\npub mod header;\npub mod body;" isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "//! ![uml](ml.svg)\n\n// External crates\nextern crate e..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "extern crate diamond_drops;\n\nextern crate fern;\n\n#[m..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use collation::collation;\n\nuse ethereum_types;\n\n\n#[..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use collation::collation;\nuse message;\nuse client_thre..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use ethereum_types;\n\npub struct Proposer {\n    id: et..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
Argument "use message;\n\nuse ethereum_types;\n\nuse std::sync::mp..." isn't numeric in numeric eq (==) at .git/hooks/pre-commit line 131.
[license-maintainer3 1e1a3cb] Comment out references to author and years.
 1 file changed, 33 insertions(+), 63 deletions(-)