Search code examples
gitcygwin

preventing deletion of tmp files by Git


I would like to use IntelliJ as a diff tool at Cygwin. But before IDEA is showing up the diff screen, the tmp file which is created under /tmp is being deleted.

My question is how can I prevent deletion of tmp files? Is there any config at git for this?

Edit:

 [difftool "ideadiff"]
 cmd =  echo  \"$(cygpath -wla $LOCAL)\" \"$(cygpath -wla $REMOTE)\"

When you echo paths, I can see paths but there is not any file in this path. I have also cat files in console which is perfectly showing content. But after exiting from difftool command I can not see any file at under /tmp? Why?


Solution

  • My conjecture is that IDEA «detaches» itself (by forking and exiting). You can easily check if it's true by launching it from a terminal — if the prompt is shown right after the launch, then it's true.

    To git it looks like your diff tool has exited, and so it cleans up the temporary files.

    I can see two possible solutions:

    1. Perhaps IDEA has a flag which prevent detaching. For instance. there is such a flag for gvim — -f.
    2. If not, than you may wrap IDEA in a shell script that would copy the files and then launch IDEA itself with your copies (which git knows nothing about). Then again you have to think about when to delete them. You may copy them again to /tmp and then hope that your OS will clean them up.