Skip to content

Conversation

@xwjdsh
Copy link
Contributor

@xwjdsh xwjdsh commented Jan 19, 2018

Fix #3378 . Updated local copy repository's git remote URL after repository renamed.

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jan 19, 2018
@lafriks lafriks added this to the 1.4.0 milestone Jan 19, 2018
@lafriks lafriks changed the title Fix #3378 Change local copy origin url after repository rename Jan 19, 2018
@ShalokShalom
Copy link

Thanks a lot @xwjdsh ^-^

@ShalokShalom
Copy link

CI fails for Postgres: https://drone.gitea.io/go-gitea/gitea/3281/10

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 19, 2018
@sapk
Copy link
Member

sapk commented Jan 19, 2018

CI failed is related to #3386 not this PR


localPath := repo.LocalCopyPath()
if com.IsExist(localPath) {
_, err := git.NewCommand("remote", "set-url", "origin", newRepoPath).RunInDir(localPath)
Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@9e842c8). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3399   +/-   ##
=========================================
  Coverage          ?   35.58%           
=========================================
  Files             ?      281           
  Lines             ?    40586           
  Branches          ?        0           
=========================================
  Hits              ?    14442           
  Misses            ?    24004           
  Partials          ?     2140
Impacted Files Coverage Δ
models/repo.go 43.06% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e842c8...eadd0d3. Read the comment docs.

@lafriks lafriks merged commit b627f11 into go-gitea:master Jan 27, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncommitable after renaming

7 participants