Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Deleting a ref does not work. #426

Copy link
Copy link
Closed
@adam-arold

Description

@adam-arold
Issue body actions

I can query a repo for its refs:

val toDelete = repo.listRefs().asList().filter { it.ref == "refs/heads/$version" || it.ref == "refs/heads/$otherVersion" }

but when I try to delete a ref:

toDelete.forEach {
    it.delete()
}

I get a NullPointerException because root is null within the GHRef for some reason.

What is the proper way of deleting a ref?

A workaround I found is to do this:

toDelete.forEach {
    repo.getRef(it.ref.replace("refs/", "")).delete()
}

This highlights another discrepancy: when I call getRef I have to remove the refs/ part to properly fetch the ref.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.