|
@@ -187,6 +187,13 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit
|
|
|
protectBranch.WhitelistTeamIDs = strings.Join(base.Int64sToStrings(validTeamIDs), ",")
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if protectBranch.ID == 0 {
|
|
|
+ if _, err = x.Insert(protectBranch); err != nil {
|
|
|
+ return fmt.Errorf("Insert: %v", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
var whitelists []*ProtectBranchWhitelist
|
|
|
if hasUsersChanged || hasTeamsChanged {
|
|
@@ -226,12 +233,6 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- if protectBranch.ID == 0 {
|
|
|
- if _, err = sess.Insert(protectBranch); err != nil {
|
|
|
- return fmt.Errorf("Insert: %v", err)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if _, err = sess.Id(protectBranch.ID).AllCols().Update(protectBranch); err != nil {
|
|
|
return fmt.Errorf("Update: %v", err)
|
|
|
}
|