-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change local copy origin url after repository rename #3399
Conversation
Thanks a lot @xwjdsh ^-^ |
CI fails for Postgres: https://drone.gitea.io/go-gitea/gitea/3281/10 |
CI failed is related to #3386 not this PR |
return fmt.Errorf("rename repository directory: %v", err) | ||
} | ||
|
||
localPath := repo.LocalCopyPath() | ||
if com.IsExist(localPath) { | ||
_, err := git.NewCommand("remote", "set-url", "origin", newRepoPath).RunInDir(localPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You usually need to acquire a lock before running a git
command in the local copy repo, although I suppose in this case it may be alright not to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, if we really wanted to be safe, we would hold the local-copy lock while renaming the bare repo and while running git remote set-url origin ...
.
Between renaming the bare repo and running git remote set-url origin ...
, any other threads that try to run git
commands involving origin
in the local copy will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, you are right, I'll try to do it.
Codecov Report
@@ Coverage Diff @@
## master #3399 +/- ##
=========================================
Coverage ? 35.58%
=========================================
Files ? 281
Lines ? 40586
Branches ? 0
=========================================
Hits ? 14442
Misses ? 24004
Partials ? 2140
Continue to review full report at Codecov.
|
Fix #3378 . Updated local copy repository's git remote URL after repository renamed.