Skip to content

Commit 3e3342a

Browse files
dannylongeuaychristophwitzko
authored andcommitted
chore(*): 🔧 update docs and add another test
1 parent 077daa7 commit 3e3342a

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ To use this plugin you need to include the following block in your
4343
| auth_private_key | | The path to an SSH private key file. |
4444
| git_path | . | The path to the Git repository. |
4545
| push_options | | The push options for the git tag push. |
46+
| log_order | dfs | The log order traversal algorithm. |
4647

4748
### Authentication
4849

@@ -70,6 +71,17 @@ For this method you'll need to set `auth_username` and
7071
`auth_private_key`. If your private key uses a password then you'll
7172
also need to set `auth_password`.
7273

74+
### Log Order Options
75+
76+
log_order=dfs (Default) - Ordering by depth-first search in pre-order
77+
78+
log_order=dfs_post - Ordering by depth-first search in post-order (useful to traverse
79+
history in chronological order)
80+
81+
log_order=bfs - Ordering by breadth-first search
82+
83+
log_order=ctime - Ordering by committer time (more compatible with `git log`)
84+
7385
## Licence
7486

7587
The [MIT License (MIT)](http://opensource.org/licenses/MIT)

pkg/provider/git_test.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ func TestGit(t *testing.T) {
2626
t.Run("GetInfo", getInfo)
2727
t.Run("GetReleases", getReleases)
2828
t.Run("GetCommits", getCommits)
29-
t.Run("GetCommitsNoFFMerge", getCommitsNoFFMerge)
29+
t.Run("GetCommitsNoFFMergeDFS", getCommitsNoFFMergeDFS)
30+
t.Run("GetCommitsNoFFMergeDFSPost", getCommitsNoFFMergeDFSPost)
3031
t.Run("GetCommitsNoFFMergeCTime", getCommitsNoFFMergeCTime)
3132
t.Run("CreateRelease", createRelease)
3233
}
@@ -206,7 +207,7 @@ func getCommits(t *testing.T) {
206207
}
207208
}
208209

209-
func getCommitsNoFFMerge(t *testing.T) {
210+
func getCommitsNoFFMergeDFS(t *testing.T) {
210211
require := require.New(t)
211212
dir, err := os.MkdirTemp("", "provider-git")
212213
require.NoError(err)
@@ -237,6 +238,22 @@ func getCommitsNoFFMergeCTime(t *testing.T) {
237238
require.Len(commits, 2)
238239
}
239240

241+
func getCommitsNoFFMergeDFSPost(t *testing.T) {
242+
require := require.New(t)
243+
dir, err := os.MkdirTemp("", "provider-git")
244+
require.NoError(err)
245+
repo, err := cloneRepo(dir, "http://localhost:3000/test/no_ff_merge.git")
246+
repo.logOrder = git.LogOrderCommitterTime
247+
require.NoError(err)
248+
releases, err := repo.GetReleases("")
249+
require.NoError(err)
250+
require.Len(releases, 1)
251+
initialCommitSha := releases[0].GetSHA()
252+
commits, err := repo.GetCommits(initialCommitSha, "master")
253+
require.NoError(err)
254+
require.Len(commits, 2)
255+
}
256+
240257
func createRelease(t *testing.T) {
241258
require := require.New(t)
242259
repo, err := createRepo()

0 commit comments

Comments
 (0)