Hello all,
I had a play and managed to figure out how to launch LVMerge based on the previous scripts in this thread.
This is the bash script I use:
#!/bin/bash# Method to determine absolute path# The -W parameter on the pwd command is necessary to return the Windows version of the path.# Not using the -W parameter will result in a conversion of temp directory to a 'tmp' path meaningful only in the Linux # environment.# Piping the result through tr '/' '' translates the forward slashes to backslashes.# Windows understands forward slashes, but LVMerge.exe does not.abspath () { ( DIR=$(dirname "$1") FN=$(basename "$1") cd "$DIR" printf "%s/%s" "$(pwd -W)" "$FN" | tr '/' '' )}lvmerge="C:Program FilesNational InstrumentsSharedLabVIEW MergeLVMerge.exe"remote=$(abspath "$1")local=$(abspath "$2")merged=$(abspath "$3")base=$(abspath "$4")echo Launching "$lvmerge"exec "$lvmerge" "$base" "$remote" "$local" "$merged"
The relevant section of my global .gitconfig file is configure as follows:
[merge "lvmerge"] command = lvmergewrapper.sh "$LOCAL" "$REMOTE" "$MERGED" "$BASE"[mergetool "sourcetree"] cmd = 'C:/GitRepositories/lvmergewrapper.sh' $REMOTE $LOCAL $MERGED $BASE trustExitCode = true
And finally, in sourcetree the options menu under the diff tab is set to Custom with
Diff Command: C:/GitRepositories/lvmergewrapper.sh and
Arguments: "$REMOTE" "$LOCAL" "$MERGED" "$BASE"
I'm not sure exactly what trustExitCode = true does, but I did notice that choosing "No" in the accept merge dialog of the LVMerge tool results in the .git lock file not being cleared and consequently I couldn't do any git operations without first deleting that file. It may be the case that trustExitCode should be set to false. If anyone feels inclined to map this behaviour out, I'd love to hear back. I'm sure I'll probably stumble across the right way to do it eventually but hey.
Cheers,
Alex
Edit: I'm not sure if some parts of the .gitconfig file are redundant in that they are only relevant to calling it from the commandline? Really not sure, but it seems to work this way (Hopefully it doesn't twist up which ones are remote and which ones are local).