`
scm002
  • 浏览: 318612 次
社区版块
存档分类
最新评论

Why does Gerrit not include the change-id into merge commits?

 
阅读更多

 

 

The underlying problem in Git is that commit-msg hooks are not called for merge commits without conflicts.

However, the prepare-commit-msg is called for (any) merge commits. So what I currently do to get Gerrit's Change-Id also added to merge commits without conflicts is to use a prepare-commit-msghook like this:

#!/bin/sh

if [ "$2" = "merge" -a -f .git/MERGE_MSG ]; then
    # Explicitly call Gerrit's commit-msg hook for merge commits.
    .git/hooks/commit-msg "$1"
fi

The check for .git/MERGE_MSG ensures that commit-msg will not be called if amending a merge commit, because in that case that hook is called directly by Git anyway. Note that for merge commits with conflicts this approach will result in commit-msg being called twice, once as part of this prepare-commit-msg hook and once by Git when it calls commit-msg after committing the conflicts resolution, but that does not cause any problems as Gerrit's commit-msg hook checks whether the Change-Id has already been added and does not add it again if that's the case.

If you're now asking your self why Gerrit does not simply use only a prepare-commit-msg hook to add the Change-Id, I guess that just to prevent the user from accidentally deleting the Change-Idfrom the commit message. Adding it as part of a commit-msg hook after the editor has closed is just safer.

 

 

http://stackoverflow.com/questions/19917025/why-does-gerrit-not-include-the-change-id-into-merge-commits

分享到:
评论

相关推荐

    gerrit-rest-java-client, Gerrit代码审查的Java REST客户端.zip

    gerrit-rest-java-client, Gerrit代码审查的Java REST客户端 gerrit-rest-java-client 简介Gerrit代码审查工具 REST API的Java实现。仅支持 Gerrit 2.6或者更新版本的( 。旧版本中缺少/不完整的REST API ) 。

    gerrit-intellij-plugin-1.2.6-203

    标题 "gerrit-intellij-plugin-1.2.6-203" 指的是一款集成在IntelliJ IDEA中的Gerrit代码审查插件的特定版本。这个插件允许开发者在IDE内部直接与Gerrit代码审查系统进行交互,提高开发效率和代码审查流程的便捷性。...

    gerrit-rest-java-client:用于Gerrit代码审查的Java REST客户端

    gerrit-rest-java-client 介绍 REST API的Java实现。 仅支持Gerrit 2.6或更高版本(旧版本中缺少/不完整的REST API)。 例如,此实现用作。 支持许多不同的身份验证方法(HTTP基本,HTTP摘要,带形式的LDAP,来自...

    gerrit-intellij-plugin-1.0.6-146.zip

    `gerrit-intellij-plugin`是专为IntelliJ IDEA设计的插件,允许开发者在IDE内部直接与Gerrit进行交互,简化了代码审查的过程。 此插件版本为`1.0.6-146`,意味着它已经过多次迭代和优化,以适应Gerrit和IntelliJ ...

    gerrit-oauth-provider-v3.0.0.jar

    gerrit-oauth-provider-v3.0.0.jar , 用于gerrit和keycloak整合使用的, 适合keycloak-4.8.3.Final.zip ,具体安装教程 https://yellowcong.blog.csdn.net/article/details/127108078

    gerrit-2.10和bcpkix-jdk15on-152

    Gerrit-2.10和Bouncy Castle的BCPKIX-JDK15on-152是两个在IT行业中非常关键的组件,主要用于开源版本控制系统和加密算法的支持。 Gerrit-2.10是一个基于Web的代码审查和协同开发系统,广泛应用于Git仓库的管理。它...

    commit-msg

    ERROR:“missing Change-Id in commit message footer” 解决方法: 拷贝commit-msg到每个需要使用gerrit提交代码的项目中 将commit-msg文件拷贝到 -> 项目文件夹\.git\hooks(文件夹不存在则新建), 这时将上次...

    gerrit使用文档手册,适合新手学习gerrit

    Gerrit 使用文档手册,适合新手学习 Gerrit Gerrit 是一个基于 Web 的代码レビュー工具,用于管理代码的提交和审核。下面是 Gerrit 使用文档手册的知识点总结: 一、获取权限 在使用 Gerrit 之前,需要获取权限,...

    gerrit-code-review-plugin:詹金斯CI的Gerrit SCM插件

    詹金斯的Gerrit Code Review插件 该插件允许将任何Jenkins多分支管道与无缝集成,以进行分支和更改验证。 为什么还有另一个插件? 我想将Gerrit CI验证工作流程用于任何项目,包括Gerrit插件或任何其他想要采用它...

    gerrit-2.15-rc4.war

    gerrit-2.15-rc4.war,gerrit 最新稳定版本 gerrit 最新稳定版本

    gerrit-2.12.war,bcpkix-jdk15on-152.jar,bcprov-jdk15on-152.jar

    在提供的文件名中,我们看到了`gerrit-2.12.war`,这表明您可能在处理Gerrit的一个特定版本,即2.12。`.war`文件是Web应用程序档案(Web Application Archive)的缩写,它是Java Web应用的标准打包格式,可以被Web...

    gerrit-hooks-examples:Gerrit 钩子示例

    在"Gerrit-hooks-examples"项目中,我们看到的是一个包含Gerrit钩子的示例集,主要使用Python语言编写。这个压缩包可能包含了多种不同类型的钩子脚本,用于演示如何在Gerrit环境中应用它们。下面将详细介绍Gerrit...

    gerrit-stable-2.11.tar.gz

    gerrit-stable-2.11.tar.gz gerrit-stable-2.11.tar.gz gerrit-stable-2.11.tar.gz gerrit-stable-2.11.tar.gz gerrit-stable-2.11.tar.gz gerrit-stable-2.11.tar.gz

    [代码评审] Gerrit 代码评审入门教程 (英文版)

    Leverage the power of Gerrit Code Review to make software development more cooperative and social Overview Understand the concepts of collective code review using Gerrit through a set of simple ...

    gerrit-2.11.10.war

    gerrit-2.11.10.wargerrit-2.11.10.wargerrit-2.11.10.war

    gerrit-sync-hooks:Hook脚本与github或gitlab一起使用gerrit

    gerrit-sync-hooks 挂钩脚本,用于将gerrit与github或gitlab一起使用。 这使您可以使用github或其他存储库作为源,而仅使用gerrit进行代码检查。 这些脚本应放置在gerrit / hooks目录中。 当补丁集提交给gerrit进行...

    Gerrit FE Dev Helper-crx插件

    来源:https://gerrit-review.googlesource.com/q/project:gerrit-fe-dev-helper #### v0.0.8-** BREAKN CHNAGE **:Gerrit正在迁移至`gr-app.js仅限`,因此`gr-app.html`将不再存在,我们还更新了默认规则以转发至`...

    gerrit-change-trigger:一个 Gerrit 插件,用于从 Web UI 向 Gerrit 事件流引发事件

    gerrit-change-trigger:Gerrit 变更触发器插件 添加一名作者 存储库: : 发布: : 概要 这是一个 Gerrit 插件。 这可以在 gerrit 事件流的更改中触发最新补丁patchset-created事件。 Trigger按钮被添加到修订...

    gerrit-full-2.5.2.war

    gerrit-full-2.5.2.war 安装文件 详细安装过程可以参考 http://blog.csdn.net/zwhfyy/article/details/8662543 http://blog.csdn.net/zwhfyy/article/details/8663826

Global site tag (gtag.js) - Google Analytics