测试git的合并后挂钩脚本 [英] Testing a post-merge hooks script for git

查看:60
本文介绍了测试git的合并后挂钩脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GIT的新手,我有以下疑问:

如何在没有其他人向存储库推送伪造更改的情况下测试合并后脚本是否将履行职责? (合并后的脚本是否正确,如果我希望每次从存储库中拉出时都会调用它,并且找到了一些修改?即使拉出错误退出(例如由于冲突),它也会执行吗?)

我问这个问题与我面临的另一个问题.

解决方案

我宁愿通过将虚假更改推送到实际仓库的 clone 来测试合并后的钩子.
我将以与在当前存储库中设置的方式相同的方式在克隆中注册该钩子.

这样,您就不会用必须清除的虚假历史记录污染原始回购协议.


如果要避免克隆,可以:

  • 为这些合并指定一个分支
  • 在更改user.nameuser.email(git config user.name xxx)之后按一下,以便为合并模拟其他作者和提交者.

一旦这些测试合并在该分支上完成,您就可以足够容易地删除它.

I am very new to GIT, and I have the following doubt:

How can I test if a post-merge script will be doing its duty, without having other people pushing fake changes to the repository? (Is post-merge the correct script, if I want it to be called every time I pull from the repository and some modifications are found? Will it be executed even if the pull exits with error, for example because of conflicts?)

I ask this question related to this other problem I am facing.

解决方案

I would rather test that post-merger hook by pushing fake changes to a clone of your actual repo.
I would register that hook in the clone the same way it is setup in the current repo.

That way, you don't pollute your original repo with fake history you would have to clean.


If you want to avoid the clone, you can:

  • dedicate a branch for those merges
  • push after having changed user.name and user.email (git config user.name xxx), in order to simulate other authors and committers for your merges.

Once those test merges are done on that branch, you can delete it easily enough.

这篇关于测试git的合并后挂钩脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆