GithubHelp home page GithubHelp logo

Support for git-mergetool about fac HOT 6 OPEN

mkchoi212 avatar mkchoi212 commented on May 20, 2024 6
Support for git-mergetool

from fac.

Comments (6)

hkdobrev avatar hkdobrev commented on May 20, 2024 2

@auscompgeek I haven't. Forgot about that! Thanks for the tip!

OK, so this works:

git config --global mergetool.fac.cmd fac
git config --global merge.tool fac

Now git-mergetool starts fac. However, it's started with all files and when you close it, Git opens it for the next file. So it's not suitable in this mode. I think it should detect it's used as a mergetool based on the command line arguments passed to it and open only the specified file so this workflow works.

from fac.

mkchoi212 avatar mkchoi212 commented on May 20, 2024

I have no idea. I will look into it though! Thanks for the heads up!

from fac.

auscompgeek avatar auscompgeek commented on May 20, 2024

@hkdobrev Did you set mergetool.fac.cmd, as per git-config(1)?

from fac.

mkchoi212 avatar mkchoi212 commented on May 20, 2024

Tried fmt.Println(len(os.Args), os.Args) but seems like nothing special is passed to the program by git. Any ideas on how we could detect if git-mergetool started fac?

Only one that comes to my mind is running ps || pgrep to find if git-mergetool is running.

from fac.

auscompgeek avatar auscompgeek commented on May 20, 2024

A number of environment variables are set by git-mergetool(1). You could take a look at how the known mergetools to git are implemented by looking at the shell scripts in /usr/lib/git-core/mergetools/.

You can pass any argument you like in the cmd setting, so there's definitely no need for pgrep hacks.

from fac.

hkdobrev avatar hkdobrev commented on May 20, 2024

From git help config:

mergetool.<tool>.cmd
Specify the command to invoke the specified merge tool. The specified command is evaluated in shell with the following variables available:
BASE is the name of a temporary file containing the common base of the files to be merged, if available;
LOCAL is the name of a temporary file containing the contents of the file on the current branch;
REMOTE is the name of a temporary file containing the contents of the file from the branch being merged;
MERGED contains the name of the file to which the merge tool should write the results of a successful merge.

So the configuration in .gitconfig should be something like:

[mergetool.fac]
    cmd = fac $BASE $LOCAL $REMOTE

An example from the opendiff mergetool opening FileMerge from XCode:

"$merge_tool_path" "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED" | cat

I guess you can either specify arguments or command line options for these and include a simple shell file in the repo to run it. This way it would be a 2-line configuration to use fac as your mergetool :)

from fac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.