smashwilson / merge-conflicts

Resolve git merge conflicts in Atom
https://atom.io/packages/merge-conflicts
MIT License
431 stars 42 forks source link

feat(cli): create git merge compatible mergetool script #195

Closed dudymas closed 8 years ago

dudymas commented 8 years ago

This addresses #43

There's a simple script that spawns a wait loop and then throws the merge target into atom... you can then run merge-conflicts on that guy.

Once the file changes, the stat will update for the file, thus killing the script and git will throw up the next merge conflict. This can be very quick to use if you already have the repo open in atom, as you only need to run the merge-conflicts once, and then each file that atom opens will have the conflicts ready for you to change.

The only wuddyup I noticed was that env vars don't seem to be passed to bash atm... so I included a file ( lib/mergetool.gitconfig ) that should be sourceable for extending the local user's gitconfig.

As long as you get an absolute path for the atom_merge script or add it to the path, that guy should work fine... I probably won't have time to find a 'install' method for this script, but it does the heavy lifting. Maybe you could trick git into asking apm for a path to the merge-conflicts install dir?

Thoughts?

dudymas commented 8 years ago

Please note I've only tested this on OSX... might not behave the same on BSD or linux since stat might have different flags

smashwilson commented 8 years ago

Oh, neat! Polling for file changes does feel a little hacky, but because of the way that mergetool works, I'm not sure we can do much else.

As long as you get an absolute path for the atom_merge script or add it to the path, that guy should work fine... I probably won't have time to find a 'install' method for this script, but it does the heavy lifting. Maybe you could trick git into asking apm for a path to the merge-conflicts install dir?

I think we can derive the install dir from __dirname, but I'm fine doing that in another PR.