← Winnitude! Search  ·  Reader Mode (803 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 13 LINKS

Sorting in TreeModifier.set_done() seems to be inconsistent with git's own sorting -> breaks repository · Issue #369 · gitpython-developers/GitPython

Repository navigation

Sorting in TreeModifier.set_done() seems to be inconsistent with git's own sorting -> breaks repository  #369


New issue

New issue

Closed

Closed
Sorting in TreeModifier.set_done() seems to be inconsistent with git's own sorting -> breaks repository #369 Assignees Byron is assigned Labels
acknowledged

critical

Description

@ddanier's profile ddanier opened on Dec 8, 2015

git enforces tree objects to be sorted by name. GitPython enables users to sort their tree's by calling TreeModifier.set_done(), see:
https://github.com/gitpython-developers/GitPython/blob/master/git/objects/tree.py#L45

This sorting somehow seems to be inconsistent with git's own sorting mechanism, which means adding a tree might break the git repository. This means "git fsck" will throw errors and some remotes (gitlab for example) will no accept the commit. Anyways this bug leaves the git object store in an broken state which cannot be fixed easily, especially if there is much history after the broken commit/tree. I had to delete multiple branches from projects I manage because of their broken state so far.

About the problem itself:

GitPython uses core Python functions to sort the file list. This looks correct, but has one major difference to what git itself does. If you have two files beginning with the same chars (for example "file" and "file.second") their ordering will differ:

What git does:

  1. "file.second"
  2. "file"

What GitPython does:

  1. "file"
  2. "file.second"

We found this problem using fabdeploit for deployments using git, which allows us to add/removed files to/from the git repository. This way tree's will be modified which means sorting is essential.

Please fix this. ;-)

Metadata

Metadata

Assignees

Labels


acknowledged

critical

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions