Phpstorm and pre commit hooks that modify files

為{幸葍}努か 提交于 2019-12-23 18:04:26

问题


TLDR: PhpStorm behaves in a weird way when a pre-commit hook modifies a file.


I have this pre-commit hook that checks for modifications on js and css files, and if one of them has been modified, we want the hook to change a configuration file (a file that we use to force a cache reload on all browsers of that "client-side files") so that change would be included in the commit.

The hook looks like this:

#!/bin/bash
JSCSSCHANGE=`git status|grep -E "(.css|.js)"|wc -l`
if [ $JSCSSCHANGE -ne 0 ]; then
  #MODIFY THE FILE
  git add .
fi

The fact is that when we commit through command line or even with SourceTree it works fine: the file it's modified and included in the commit.

But when we make the commit through PhpStorm, after the commit it's done including the modified file, we are left with that same file pending for commit, with modified status. The commit was done perfectly, and it included the modification, but we are left with a the same file in modified status.


回答1:


It's a known issue: https://youtrack.jetbrains.com/issue/IDEA-133873

It should be fixed in PhpStorm 8.0.3 EAP: http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program



来源:https://stackoverflow.com/questions/26931103/phpstorm-and-pre-commit-hooks-that-modify-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!