BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
58427749
Commit
58427749
authored
Jun 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update repository head when change default project branch
parent
0705a7a5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
project_observer.rb
app/observers/project_observer.rb
+6
-0
shell.rb
lib/gitlab/backend/shell.rb
+12
-0
No files found.
app/observers/project_observer.rb
View file @
58427749
...
@@ -13,6 +13,12 @@ class ProjectObserver < BaseObserver
...
@@ -13,6 +13,12 @@ class ProjectObserver < BaseObserver
def
after_update
(
project
)
def
after_update
(
project
)
project
.
send_move_instructions
if
project
.
namespace_id_changed?
project
.
send_move_instructions
if
project
.
namespace_id_changed?
project
.
rename_repo
if
project
.
path_changed?
project
.
rename_repo
if
project
.
path_changed?
GitlabShellWorker
.
perform_async
(
:update_repository_head
,
project
.
path_with_namespace
,
project
.
default_branch
)
if
project
.
default_branch_changed?
end
end
def
before_destroy
(
project
)
def
before_destroy
(
project
)
...
...
lib/gitlab/backend/shell.rb
View file @
58427749
...
@@ -36,6 +36,18 @@ module Gitlab
...
@@ -36,6 +36,18 @@ module Gitlab
system
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects"
,
"mv-project"
,
"
#{
path
}
.git"
,
"
#{
new_path
}
.git"
system
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects"
,
"mv-project"
,
"
#{
path
}
.git"
,
"
#{
new_path
}
.git"
end
end
# Update HEAD for repository
#
# path - project path with namespace
# branch - repository branch name
#
# Ex.
# update_repository_head("gitlab/gitlab-ci", "3-1-stable")
#
def
update_repository_head
(
path
,
branch
)
system
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects"
,
"update-head"
,
"
#{
path
}
.git"
,
branch
end
# Fork repository to new namespace
# Fork repository to new namespace
#
#
# path - project path with namespace
# path - project path with namespace
...
...
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