mergeInProgress reports whether the repository at path is in the middle of a merge.
(path string)
| 115 | |
| 116 | // mergeInProgress reports whether the repository at path is in the middle of a merge. |
| 117 | func mergeInProgress(path string) (bool, error) { |
| 118 | mergeHeadPath, err := Run(context.Background(), path, "rev-parse", "--git-path", "MERGE_HEAD") |
| 119 | if err != nil { |
| 120 | return false, err |
| 121 | } |
| 122 | if !filepath.IsAbs(mergeHeadPath) { |
| 123 | mergeHeadPath = filepath.Join(path, mergeHeadPath) |
| 124 | } |
| 125 | if _, err := os.Stat(mergeHeadPath); err != nil { |
| 126 | if errors.Is(err, os.ErrNotExist) { |
| 127 | return false, nil |
| 128 | } |
| 129 | return false, err |
| 130 | } |
| 131 | return true, nil |
| 132 | } |
| 133 | |
| 134 | // CommitAll stages all changes in the working tree and creates a commit with the given message. |
| 135 | // If pathspec is non-empty, staging and the empty-commit check are scoped to that pathspec. |
no test coverage detected