【问题标题】:Apply multiple filters for same files in git对 git 中的相同文件应用多个过滤器
【发布时间】:2012-12-21 20:29:05
【问题描述】:

我正在使用 Git 对本地文件进行版本控制,最终必须将其签入另一个版本控制系统。现在我遇到了大多数 C 代码文件的一些问题:

  1. 它们的标题注释中都有自动版本历史记录
  2. 大部分文件都被 EasyCode 或 EasyCase cmets 弄乱了

我现在只是创建了两个 git 过滤器“History”和“EasyTool”来清理代码,然后再签入 Git。如何使用这两个过滤器过滤所有 C 和 H 文件?

多次指定命令不起作用,过滤命令的串联也不起作用(或者我至少没有找到正确的语法)。

这是我的第一次尝试:

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

然后我尝试了这样的事情:

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

【问题讨论】:

    标签: git version-control filter gitattributes


    【解决方案1】:

    我认为你不能这样链接过滤器。

    最简单的方法是编写一个包装器,它会顺序调用两者(至少通过 shell 脚本中的管道)。
    (如“Is it possible to redirect output of one program to input of other program in different operational systems?”)。

    【讨论】:

      猜你喜欢
      • 2020-12-19
      • 1970-01-01
      • 2016-09-16
      • 1970-01-01
      • 2023-02-23
      • 2018-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多