@@ -32,46 +32,6 @@ import (
32
32
// /_______ /\____ | |__||__| \___ / |__|____/\___ >
33
33
// \/ \/ \/ \/
34
34
35
- // discardLocalRepoBranchChanges discards local commits/changes of
36
- // given branch to make sure it is even to remote branch.
37
- func discardLocalRepoBranchChanges (localPath , branch string ) error {
38
- if ! com .IsExist (localPath ) {
39
- return nil
40
- }
41
- // No need to check if nothing in the repository.
42
- if ! git .IsBranchExist (localPath , branch ) {
43
- return nil
44
- }
45
-
46
- refName := "origin/" + branch
47
- if err := git .ResetHEAD (localPath , true , refName ); err != nil {
48
- return fmt .Errorf ("git reset --hard %s: %v" , refName , err )
49
- }
50
- return nil
51
- }
52
-
53
- // DiscardLocalRepoBranchChanges discards the local repository branch changes
54
- func (repo * Repository ) DiscardLocalRepoBranchChanges (branch string ) error {
55
- return discardLocalRepoBranchChanges (repo .LocalCopyPath (), branch )
56
- }
57
-
58
- // checkoutNewBranch checks out to a new branch from the a branch name.
59
- func checkoutNewBranch (repoPath , localPath , oldBranch , newBranch string ) error {
60
- if err := git .Checkout (localPath , git.CheckoutOptions {
61
- Timeout : time .Duration (setting .Git .Timeout .Pull ) * time .Second ,
62
- Branch : newBranch ,
63
- OldBranch : oldBranch ,
64
- }); err != nil {
65
- return fmt .Errorf ("git checkout -b %s %s: %v" , newBranch , oldBranch , err )
66
- }
67
- return nil
68
- }
69
-
70
- // CheckoutNewBranch checks out a new branch
71
- func (repo * Repository ) CheckoutNewBranch (oldBranch , newBranch string ) error {
72
- return checkoutNewBranch (repo .RepoPath (), repo .LocalCopyPath (), oldBranch , newBranch )
73
- }
74
-
75
35
// UpdateRepoFileOptions holds the repository file update options
76
36
type UpdateRepoFileOptions struct {
77
37
LastCommitID string
0 commit comments