浏览代码

Also disallow pushing to/from upstream branch when branch names do not match

rl1987 6 年之前
父节点
当前提交
7f0516022b
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      scripts/maint/pre-push.git-hook

+ 3 - 2
scripts/maint/pre-push.git-hook

@@ -44,8 +44,9 @@ do
 			range="$remote_sha..$local_sha"
 		fi
 
-                if ref_is_upstream_branch "$local_ref" == 0 ||
-                        ref_is_upstream_branch "$remote_ref"  == 0
+                if (ref_is_upstream_branch "$local_ref" == 0 ||
+                        ref_is_upstream_branch "$remote_ref"  == 0) &&
+                        [ "$local_ref" != "$remote_ref" ]
                 then
                         if [ "$remote" == "origin" ]
                         then