Skip to content

Commit

Permalink
Correctly populate the creation time of a gitlab repository.
Browse files Browse the repository at this point in the history
- Not handling updated time, as gitlab only returns last_activity_time
  which does not have the same meaning.
  • Loading branch information
Rasheed Abdul-Aziz committed Dec 20, 2022
1 parent 2a15c02 commit ec19416
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions scm/driver/gitlab/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type repository struct {
HTTPURL string `json:"http_url_to_repo"`
Namespace namespace `json:"namespace"`
Permissions permissions `json:"permissions"`
CreatedAt time.Time `json:"created_at"`
}

type namespace struct {
Expand Down Expand Up @@ -495,6 +496,7 @@ func convertRepository(from *repository) *scm.Repository {
Clone: from.HTTPURL,
CloneSSH: from.SSHURL,
Link: from.WebURL,
Created: from.CreatedAt,
Perm: &scm.Perm{
Pull: true,
Push: canPush(from),
Expand Down
1 change: 0 additions & 1 deletion scm/driver/gitlab/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
)

// TODO(bradrydzewski) repository html link is missing
// TODO(bradrydzewski) repository create date is missing
// TODO(bradrydzewski) repository update date is missing

func TestRepositoryCreate(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions scm/driver/gitlab/testdata/merge.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
},
Expand All @@ -68,7 +68,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
}
Expand Down
4 changes: 2 additions & 2 deletions scm/driver/gitlab/testdata/merges.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
},
Expand All @@ -63,7 +63,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
}
Expand Down
2 changes: 1 addition & 1 deletion scm/driver/gitlab/testdata/nested_repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name_with_namespace": "jx-gitlab-test / cluster / Gitlab Import Test 1",
"path": "gitlab-import-test-1",
"path_with_namespace": "jx-gitlab-test/cluster/gitlab-import-test-1",
"created_at": "2021-11-26T16:41:47.275Z",
"created_at": "2015-03-03T18:37:05.387Z",
"default_branch": "main",
"tag_list": [],
"topics": [],
Expand Down
2 changes: 1 addition & 1 deletion scm/driver/gitlab/testdata/nested_repo.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"Clone": "https://gitlab.com/jx-gitlab-test/cluster/gitlab-import-test-1.git",
"CloneSSH": "[email protected]:jx-gitlab-test/cluster/gitlab-import-test-1.git",
"Link": "https://gitlab.com/jx-gitlab-test/cluster/gitlab-import-test-1",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
4 changes: 2 additions & 2 deletions scm/driver/gitlab/testdata/pr_create.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
},
Expand All @@ -47,7 +47,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
},
Expand Down
2 changes: 1 addition & 1 deletion scm/driver/gitlab/testdata/repo.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
2 changes: 1 addition & 1 deletion scm/driver/gitlab/testdata/repos.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Clone": "https://gitlab.com/diaspora/diaspora.git",
"CloneSSH": "[email protected]:diaspora/diaspora.git",
"Link": "https://gitlab.com/diaspora/diaspora",
"Created": "0001-01-01T00:00:00Z",
"Created": "2015-03-03T18:37:05.387+00:00",
"Updated": "0001-01-01T00:00:00Z"
}
]

0 comments on commit ec19416

Please sign in to comment.