Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e3d7dfe
trim trailing slash from custom URLs
harrisoncramer Feb 26, 2024
438d126
Updated .github/CONTRIBUTING.md
harrisoncramer Feb 26, 2024
d29bd0b
Updated .github/ISSUE_TEMPLATE/bug_report.md
harrisoncramer Feb 26, 2024
a6401d9
Feat: Improve discussion tree toggling (#192)
jakubbortlik Feb 27, 2024
d985d71
Fix Multi Line Issues (Large Refactor) (#197)
harrisoncramer Feb 27, 2024
8859c47
Fix: location provider (#198)
harrisoncramer Feb 28, 2024
00e3e24
fix: add nil check for diffview performance issue (#199)
harrisoncramer Feb 28, 2024
8937783
Fix: Switch Tabs During Comment Creation (#200)
harrisoncramer Feb 28, 2024
7a3e761
Fix: Check if file is modified (#201)
harrisoncramer Feb 28, 2024
4c4f4b5
Fix: Off by 1 Error in Old Sha (#202)
harrisoncramer Feb 28, 2024
2010c24
Fix: Rebuild Diagnostics + Signs (#203)
harrisoncramer Mar 2, 2024
f6ada57
Fixes Off-By-One Issue w/ New SHA (#205)
harrisoncramer Mar 2, 2024
949e076
Fix: Reviewer Jump (#206)
harrisoncramer Mar 3, 2024
816338f
Merge branch 'main' into develop
harrisoncramer Mar 3, 2024
e6cc34c
Fix Typo In Settings Check (#209)
harrisoncramer Mar 3, 2024
d5ad0ea
fix: Calculate new line in ranged comment after all hunks correctly (…
harrisoncramer Mar 4, 2024
ca35faa
fix: range in new SHA (#212)
harrisoncramer Mar 4, 2024
6288ab5
Merge branch 'main' into develop
harrisoncramer Mar 4, 2024
1bf75e2
fix: address mIssing get_lines function (#224)
harrisoncramer Mar 26, 2024
6016624
fix: diagnostic creation for comments on deleted lines (#226)
harrisoncramer Mar 28, 2024
3e9b155
feat: Allow insecure https connection to Gitlab (#229)
harrisoncramer Mar 29, 2024
6b4fba3
Merge branch 'main' into develop
harrisoncramer Apr 3, 2024
f55852f
Merge branch 'main' into develop
harrisoncramer Apr 3, 2024
8b4ccaf
fix: remove esc keybinding (#240)
harrisoncramer Apr 4, 2024
61291a3
Removes backup register option (#242)
harrisoncramer Apr 4, 2024
09d5c55
fix: update go-gitlab and fix label code (#243)
harrisoncramer Apr 6, 2024
081ad8f
feat: enable pipeline command on main/master (#244)
harrisoncramer Apr 7, 2024
b00b168
Expose Gitlab Data via API (#235)
harrisoncramer Apr 8, 2024
db90a36
fix: line code fix (#245)
harrisoncramer Apr 8, 2024
3852084
Merge branch 'main' into develop
harrisoncramer Apr 8, 2024
bce50d0
feat: add squash and remove source branch (#230)
jakubbortlik Apr 8, 2024
50cded6
Fix: Treat INFO.labels as a table not as a string (#250)
jakubbortlik Apr 8, 2024
330c012
merged main
harrisoncramer Apr 8, 2024
77a6d92
feat: ssh remote url can have custom port (#248)
sunfuze Apr 9, 2024
2d59ac6
feat: Allow saving popup contents to temp_registers when quitting (#238)
jakubbortlik Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ require("gitlab").setup({
pipeline = nil,
reply = nil,
squash_message = nil,
temp_registers = {}, -- List of registers for backing up popup content (see `:h gitlab.nvim.temp-registers`)
},
discussion_tree = { -- The discussion tree that holds all comments
auto_open = true, -- Automatically open when the reviewer is opened
Expand Down Expand Up @@ -169,8 +170,12 @@ require("gitlab").setup({
"conflicts",
"assignees",
"reviewers",
"branch",
"pipeline",
"branch",
"target_branch",
"delete_branch",
"squash",
"labels",
},
},
discussion_signs = {
Expand All @@ -195,13 +200,11 @@ require("gitlab").setup({
success = "✓",
failed = "",
},
merge = { -- The default behaviors when merging an MR, see "Merging an MR"
squash = false,
delete_branch = false,
},
create_mr = {
target = nil, -- Default branch to target when creating an MR
template_file = nil, -- Default MR template in .gitlab/merge_request_templates
delete_branch = false, -- Whether the source branch will be marked for deletion
squash = false, -- Whether the commits will be marked for squashing
title_input = { -- Default settings for MR title input window
width = 40,
border = "rounded",
Expand Down
12 changes: 8 additions & 4 deletions cmd/create_mr.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type CreateMrRequest struct {
Title string `json:"title"`
Description string `json:"description"`
TargetBranch string `json:"target_branch"`
DeleteBranch bool `json:"delete_branch"`
Squash bool `json:"squash"`
}

/* createMr creates a merge request */
Expand Down Expand Up @@ -49,10 +51,12 @@ func (a *api) createMr(w http.ResponseWriter, r *http.Request) {
}

opts := gitlab.CreateMergeRequestOptions{
Title: &createMrRequest.Title,
Description: &createMrRequest.Description,
TargetBranch: &createMrRequest.TargetBranch,
SourceBranch: &a.gitInfo.BranchName,
Title: &createMrRequest.Title,
Description: &createMrRequest.Description,
TargetBranch: &createMrRequest.TargetBranch,
SourceBranch: &a.gitInfo.BranchName,
RemoveSourceBranch: &createMrRequest.DeleteBranch,
Squash: &createMrRequest.Squash,
}

_, res, err := a.client.CreateMergeRequest(a.projectInfo.ProjectId, &opts)
Expand Down
10 changes: 10 additions & 0 deletions cmd/create_mr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func TestCreateMr(t *testing.T) {
Title: "Some title",
Description: "Some description",
TargetBranch: "main",
DeleteBranch: false,
Squash: false,
}

request := makeRequest(t, http.MethodPost, "/create_mr", body)
Expand All @@ -48,6 +50,8 @@ func TestCreateMr(t *testing.T) {
Title: "Some title",
Description: "Some description",
TargetBranch: "main",
DeleteBranch: false,
Squash: false,
}
request := makeRequest(t, http.MethodPost, "/create_mr", body)
server, _ := createRouterAndApi(fakeClient{createMrFn: createMrFnErr})
Expand All @@ -60,6 +64,8 @@ func TestCreateMr(t *testing.T) {
Title: "Some title",
Description: "Some description",
TargetBranch: "main",
DeleteBranch: false,
Squash: false,
}
request := makeRequest(t, http.MethodPost, "/create_mr", body)
server, _ := createRouterAndApi(fakeClient{createMrFn: createMrFnNon200})
Expand All @@ -72,6 +78,8 @@ func TestCreateMr(t *testing.T) {
Title: "",
Description: "Some description",
TargetBranch: "main",
DeleteBranch: false,
Squash: false,
}
request := makeRequest(t, http.MethodPost, "/create_mr", body)
server, _ := createRouterAndApi(fakeClient{createMrFn: createMrFn})
Expand All @@ -86,6 +94,8 @@ func TestCreateMr(t *testing.T) {
Title: "Some title",
Description: "Some description",
TargetBranch: "",
DeleteBranch: false,
Squash: false,
}
request := makeRequest(t, http.MethodPost, "/create_mr", body)
server, _ := createRouterAndApi(fakeClient{createMrFn: createMrFn})
Expand Down
4 changes: 1 addition & 3 deletions cmd/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ it to the client for initialization. The current directory must be a valid
Gitlab project and the branch must be a feature branch
*/
func extractGitInfo(refreshGitInfo func() error, getProjectRemoteUrl func() (string, error), getCurrentBranchName func() (string, error)) (GitProjectInfo, error) {

err := refreshGitInfo()
if err != nil {
return GitProjectInfo{}, fmt.Errorf("Could not get latest information from remote: %v", err)
}

url, err := getProjectRemoteUrl()

if err != nil {
return GitProjectInfo{}, fmt.Errorf("Could not get project Url: %v", err)
}
Expand All @@ -52,7 +50,7 @@ func extractGitInfo(refreshGitInfo func() error, getProjectRemoteUrl func() (str
https://[email protected]/namespace/subnamespace/dummy-test-repo.git
git@[email protected]:namespace/subnamespace/dummy-test-repo.git
*/
re := regexp.MustCompile(`(?:^https?:\/\/|^ssh:\/\/|^git@)(?:[^\/:]+)[\/:](.*)\/([^\/]+?)(?:\.git)?$`)
re := regexp.MustCompile(`(?:^https?:\/\/|^ssh:\/\/|^git@)(?:[^\/:]+)(?::\d+)?[\/:](.*)\/([^\/]+?)(?:\.git)?$`)
matches := re.FindStringSubmatch(url)
if len(matches) != 3 {
return GitProjectInfo{}, fmt.Errorf("Invalid Git URL format: %s", url)
Expand Down
12 changes: 12 additions & 0 deletions cmd/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ func TestExtractGitInfo_Success(t *testing.T) {
Namespace: "namespace-1/namespace-2/namespace-3",
},
},
{
desc: "Project configured in SSH:// and have a custom port",
getProjectRemoteUrl: func() (string, error) {
return "ssh://custom-gitlab.com:2222/namespace-1/project-name", nil
},
expected: GitProjectInfo{
RemoteUrl: "ssh://custom-gitlab.com:2222/namespace-1/project-name",
BranchName: "feature/abc",
ProjectName: "project-name",
Namespace: "namespace-1",
},
},
{
desc: "Project configured in HTTP and under a single folder without .git extension",
getProjectRemoteUrl: func() (string, error) {
Expand Down
Loading