Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Upstream
Gitea
Commits
4d643a59
Commit
4d643a59
authored
5 years ago
by
zeripath
Committed by
Lunny Xiao
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
SetDefaultBranch on pushing to empty repository (#7610)
parent
a957d4ee
main
release/v1.10
release/v1.11
release/v1.12
release/v1.13
release/v1.14
release/v1.15
release/v1.16
release/v1.17
release/v1.18
v1.19.0-dev
v1.18.1
v1.18.0
v1.18.0-rc1
v1.18.0-rc0
v1.18.0-dev
v1.17.4
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.17.0-rc1
v1.17.0-dev
v1.16.9
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.0
v1.16.0-rc1
v1.16.0-dev
v1.15.11
v1.15.10
v1.15.9
v1.15.8
v1.15.7
v1.15.6
v1.15.5
v1.15.4
v1.15.3
v1.15.2
v1.15.1
v1.15.0
v1.15.0-rc3
v1.15.0-rc2
v1.15.0-rc1
v1.15.0-dev
v1.14.7
v1.14.6
v1.14.5
v1.14.4
v1.14.3
v1.14.2
v1.14.1
v1.14.0
v1.14.0-rc2
v1.14.0-rc1
v1.14.0-dev
v1.13.7
v1.13.6
v1.13.5
v1.13.4
v1.13.3
v1.13.2
v1.13.1
v1.13.0
v1.13.0-rc2
v1.13.0-rc1
v1.13.0-dev
v1.12.6
v1.12.5
v1.12.4
v1.12.3
v1.12.2
v1.12.1
v1.12.0
v1.12.0-rc2
v1.12.0-rc1
v1.12.0-dev
v1.11.8
v1.11.7
v1.11.6
v1.11.5
v1.11.4
v1.11.3
v1.11.2
v1.11.1
v1.11.0
v1.11.0-rc2
v1.11.0-rc1
v1.11.0-dev
v1.10.6
v1.10.5
v1.10.4
v1.10.3
v1.10.2
v1.10.1
v1.10.0
v1.10.0-rc2
v1.10.0-rc1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/action.go
+11
-0
models/action.go
with
11 additions
and
0 deletions
+11
-0
models/action.go
View file @
4d643a59
...
...
@@ -685,6 +685,17 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
if
repo
.
IsEmpty
&&
opts
.
NewCommitID
!=
git
.
EmptySHA
&&
strings
.
HasPrefix
(
opts
.
RefFullName
,
git
.
BranchPrefix
)
{
repo
.
DefaultBranch
=
refName
repo
.
IsEmpty
=
false
if
refName
!=
"master"
{
gitRepo
,
err
:=
git
.
OpenRepository
(
repo
.
RepoPath
())
if
err
!=
nil
{
return
err
}
if
err
:=
gitRepo
.
SetDefaultBranch
(
repo
.
DefaultBranch
);
err
!=
nil
{
if
!
git
.
IsErrUnsupportedVersion
(
err
)
{
return
err
}
}
}
}
// Change repository empty status and update last updated time.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help