Skip to content

Get tree entries per type. [Old: Allow sorting of tree entries] #220

Closed
@Patrick-Beuks

Description

@Patrick-Beuks

To get entries of a tree this library uses cat-file.

From what I can tell this returns the tree items based on the code point of the file name.

The outcome of this is that trees/commitRefs are combined with blobs.

My suggestion would be to add an additional parameter (either an enum or const) that allows you to pick a sorting algorithm that would be applied to the entries before they are returned.

I am willing to make an implementations for this, but there are a multitude of ways to sort a directory and I would need to know that if this should be implemented how far it should go.

Some sorting suggestions

  • Only separate tree/commitRef from the blobs and keep sorting based on code point
  • Sort but ignore case
  • Use natural sorting
  • Use case independent sorting
  • Ignore leading dots while sorting
  • Allow sorting using the intl library (this library does need to know what locale to use while sorting, you might take it from the system, or you allow it to set it somehow or allow you to pass a collator parameter instead of the additional parameter

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