kart icon indicating copy to clipboard operation
kart copied to clipboard

`create-patch` unable to apply first commit to an empty repo

Open hamishcampbell opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

kart apply doesn't appear to work on empty repositories.

To Reproduce

Download d8e498c6329465569a0b815402b7b56fb3f2cc83.patch.zip and extract - this contains a single patch file d8e498c6329465569a0b815402b7b56fb3f2cc83.patch. This is a patch creating a dataset test containing a single point.

It was generated via kart create-patch with no other options.

  1. Create a new empty kart repo mkdir test && cd test && kart init
  2. Attempt to apply the above patch kart apply ../d8e498c6329465569a0b815402b7b56fb3f2cc83.patch

The error is as follows:

» kart apply ../test2/d8e498c6329465569a0b815402b7b56fb3f2cc83.patch                                                                                                                         
Traceback (most recent call last):
  File "kart_cli.py", line 4, in <module>
  File "kart/cli.py", line 415, in entrypoint
  File "click/core.py", line 1130, in __call__
  File "click/core.py", line 1055, in main
  File "kart/cli.py", line 165, in invoke
  File "click/core.py", line 1657, in invoke
  File "click/core.py", line 1404, in invoke
  File "click/core.py", line 760, in invoke
  File "click/decorators.py", line 26, in new_func
  File "kart/apply.py", line 341, in apply
  File "kart/apply.py", line 216, in apply_patch
  File "pygit2/repository.py", line 204, in get
TypeError
[91122] Failed to execute script kart_cli

Expected behaviour

The patch to be applied, creating the dataset populated with the point.

Output

As above

Version Info

  • OS: MacOS 13 Ventura
  • Version: Kart v0.11.4.dev0+ci.3949.gitef9964df

Full patch content

(email redacted)

{
  "kart.patch/v1": {
    "authorName": "Hamish Campbell",
    "authorEmail": "[email protected]",
    "authorTime": "2022-11-02T22:12:45Z",
    "authorTimeOffset": "+13:00",
    "message": "Import from test.shp:test to test/",
    "base": null
  },
  "kart.diff/v1+hexwkb": {
    "test": {
      "meta": {
        "schema.json": {
          "+": [
            {
              "id": "4650f4b2-835f-4e3e-9f44-5a96b36b6487",
              "name": "auto_pk",
              "dataType": "integer",
              "primaryKeyIndex": 0,
              "size": 64
            },
            {
              "id": "3d568cbe-cb72-498e-b259-0694fdd7c973",
              "name": "geom",
              "dataType": "geometry",
              "geometryType": "POINT",
              "geometryCRS": "EPSG:4326"
            },
            {
              "id": "0fc0abd0-566b-402d-ab5e-ebf1752b6bd7",
              "name": "id",
              "dataType": "numeric",
              "precision": 10,
              "scale": 0
            }
          ]
        },
        "crs/EPSG:4326.wkt": {
          "+": "GEOGCS[\"WGS 84\",\n    DATUM[\"WGS_1984\",\n        SPHEROID[\"WGS 84\", 6378137, 298.257223563,\n            AUTHORITY[\"EPSG\", \"7030\"]],\n        AUTHORITY[\"EPSG\", \"6326\"]],\n    PRIMEM[\"Greenwich\", 0,\n        AUTHORITY[\"EPSG\", \"8901\"]],\n    UNIT[\"degree\", 0.0174532925199433,\n        AUTHORITY[\"EPSG\", \"9122\"]],\n    AXIS[\"Latitude\", NORTH],\n    AXIS[\"Longitude\", EAST],\n    AUTHORITY[\"EPSG\", \"4326\"]]\n"
        }
      },
      "feature": [
        {
          "+": {
            "auto_pk": 1,
            "geom": "0101000000F8DC5E7AF4F8654018641B46D86843C0",
            "id": "1"
          }
        }
      ]
    }
  }
}

hamishcampbell avatar Nov 02 '22 22:11 hamishcampbell

Hi, I would like to work on this bug. it would be great could you please assign this issue to me

jhunjhunwala1234 avatar Feb 19 '23 14:02 jhunjhunwala1234

@jhunjhunwala1234 Great! Open a PR when you have something ready.

rcoup avatar Feb 19 '23 17:02 rcoup

Hey @rcoup ,

Is this issue still open? If yes can you assign it to me please as I want to contribute on this.

Thank you

king04aman avatar Mar 01 '23 04:03 king04aman

@king04aman feel free to submit a PR

rcoup avatar Mar 06 '23 14:03 rcoup