提交更多文件作为预提交挂钩是否安全? [英] Is it safe to commit more files as a pre-commit hook?

查看:25
本文介绍了提交更多文件作为预提交挂钩是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在 Subversion 中将文件从一个分支复制到另一个分支时,我想自动提交数据库.假设我们在非常特定的情况下使用 svn commmit 作为预提交钩子的一部分是否安全?

I want to automatically commit the database when we copy files from one branch to the other in Subversion. Is it safe to use svn commmit as part of a pre-commit hook assuming that we do it in very specific cases?

推荐答案

即使是安全的,也可能达不到你所期望的效果.

Even if it's safe, it probably doesn't have the effect you would expect.

当您处于预提交状态时,新事务已经创建,但尚未提交.您可以访问该信息来完成您的工作,但额外的 svn commit 将创建一个单独的事务,该事务也尚未提交.

When you're in pre-commit the new transaction has already been created, but not committed. You have access to that information to do your work, but an additional svn commit would create a separate transaction that is also not committed, yet.

该新交易不会看到您当前交易中的任何更改,因为它还没有完成.

That new transaction wouldn't see any of the changes in your current transaction, because it hasn't been finalized, yet.

您可能想要一些您运行的自定义脚本来为您执行此操作,也许是您构建系统的一部分.

You probably want some custom scripts you run to do this for you, maybe part of your build system.

此外,你需要一个工作副本来提交,你没有在服务器上运行 pre-commit 钩子的地方.你可能可以用共享的工作副本拼凑一些东西,并希望没有两个人导致 pre-commit 钩子同时运行,但同样,你可能最好使用自定义脚本解决方案.

Additionally, you need a working copy to commit from, you don't have that where the pre-commit hook runs, on the server. You might be able to cobble something together with a shared working copy and hope no two people cause the pre-commit hook to run at the same time, but again, you're probably better off with a custom scripting solution.

这篇关于提交更多文件作为预提交挂钩是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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