Apply multiple filters for same files in git

不打扰是莪最后的温柔 提交于 2019-12-21 17:37:38

问题


I am using Git for version control of local files, which finally have to be checked in into another version control system. Now I am experiencing some problems with most of the C code files:

  1. They all have an automatic version history in their header comment
  2. Most of the files are cluttered by EasyCode or EasyCase comments

I now simply created two git filters "History" and "EasyTool" to clean up the code before being checked in to Git. How is it possible to filter all C and H files with both of the filters?

Specifying the commands multiple times does not work and concatenation of the filter command does neither (or I at least did not find the correct syntax).

This was my first try:

*.c  filter=History
*.c  filter=EasyTool           # This one wins, "History" is not executed

Then I tried something like this:

*.c  filter=History EasyTool   # The first wins, other separators work neither

回答1:


I don't think you can chain filters that way.

The simplest way would be to write a wrapper which would call both sequentially (at least through a pipe in a shell script).
(as in "Is it possible to redirect output of one program to input of other program in different operational systems?").



来源:https://stackoverflow.com/questions/13988619/apply-multiple-filters-for-same-files-in-git

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