Skip to content

push doesn't select latest commit by default #80

@eschrock

Description

@eschrock

Expected Behavior

titan push repo should select the latest commit.

Actual Behavior

The last commit is selected:

        val commits = commitsApi.listCommits(container)
        ...
        if (!guid.isNullOrEmpty()) {
            ...
        } else {
            commit = commits.last()
        }

The server will always return commits in reverse order, so this actually selects the earliest commit instead of latest. But a better solution here is to use the repo status call and select the last commit from there. That way we don't have to list all the commits, and as the server evolves to make returning that fast, the client doesn't need to adapt how it determines the latest commit.

Steps to Reproduce the Problem

Create a repository with two commits. Run titan push with no commit and observe that it pushes the oldest commit, not the latest.

Version

0.3.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions