Title: Regression in git_index_write_tree_to · Issue #5015 · libgit2/libgit2 · GitHub
Open Graph Title: Regression in git_index_write_tree_to · Issue #5015 · libgit2/libgit2
X Title: Regression in git_index_write_tree_to · Issue #5015 · libgit2/libgit2
Description: This is a regression, it works fine with 0.27 Found while upgrading pygit2 to v0.28, see https://travis-ci.org/libgit2/pygit2/jobs/503956525#L1044 This is the only test failure in the pygit2 test suite, it blocks release of pygit2 0.28.0...
Open Graph Description: This is a regression, it works fine with 0.27 Found while upgrading pygit2 to v0.28, see https://travis-ci.org/libgit2/pygit2/jobs/503956525#L1044 This is the only test failure in the pygit2 test s...
X Description: This is a regression, it works fine with 0.27 Found while upgrading pygit2 to v0.28, see https://travis-ci.org/libgit2/pygit2/jobs/503956525#L1044 This is the only test failure in the pygit2 test s...
Opengraph URL: https://github.com/libgit2/libgit2/issues/5015
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression in git_index_write_tree_to","articleBody":"This is a regression, it works fine with 0.27\r\n\r\nFound while upgrading pygit2 to v0.28, see https://travis-ci.org/libgit2/pygit2/jobs/503956525#L1044\r\nThis is the only test failure in the pygit2 test suite, it blocks release of pygit2 0.28.0\r\n\r\n### Reproduction steps\r\n\r\nPrepare the repositories:\r\n\r\n```bash\r\n$ git init src\r\nInitialized empty Git repository in [...]/src/.git/\r\n$ cat - \u003e src/hello.txt\r\nworld\r\n^D\r\n$ cd src\r\n$ git add hello.txt \r\n$ cd ..\r\n$ git init dst\r\nInitialized empty Git repository in [...]/dst/.git/\r\n```\r\n\r\nRun the following program:\r\n\r\n```c\r\n#include \u003cstdio.h\u003e\r\n#include \u003cgit2.h\u003e \r\n \r\nint main() \r\n{ \r\n char hex[GIT_OID_HEXSZ+1] = {0};\r\n int err;\r\n git_repository *src, *dst; \r\n git_index *index;\r\n git_oid id;\r\n \r\n git_libgit2_init(); \r\n \r\n err = git_repository_open(\u0026src, \"src\"); \r\n err = git_repository_open(\u0026dst, \"dst\");\r\n err = git_repository_index(\u0026index, src);\r\n \r\n/*\r\n err = git_index_write_tree(\u0026id, index);\r\n if (err \u003c 0) {\r\n printf(\"git_index_write ERROR\\n\");\r\n printf(\"%s\\n\", giterr_last()-\u003emessage);\r\n return 1;\r\n } else {\r\n git_oid_fmt(hex, \u0026id);\r\n printf(\"git_index_write SUCCESS %s\\n\", hex);\r\n }\r\n*/\r\n\r\n err = git_index_write_tree_to(\u0026id, index, dst);\r\n if (err \u003c 0) {\r\n printf(\"git_index_write_to ERROR\\n\");\r\n printf(\"%s\\n\", giterr_last()-\u003emessage);\r\n return 1;\r\n } else {\r\n git_oid_fmt(hex, \u0026id);\r\n printf(\"git_index_write_to SUCCESS %s\\n\", hex);\r\n }\r\n \r\n return 0;\r\n} \r\n```\r\n\r\n### Expected behavior\r\n\r\nExpected output:\r\n\r\n```bash\r\n$ gcc bug.c -lgit2 \u0026\u0026 ./a.out \r\ngit_index_write_to SUCCESS 7f2dbfa479cbe99062de2ef82b713f044c4406d8\r\n```\r\n\r\n### Actual behavior\r\n\r\nActual output:\r\n\r\n```bash\r\n$ gcc bug.c -lgit2 \u0026\u0026 ./a.out \r\ngit_index_write_to ERROR\r\nfailed to insert entry: invalid object specified - hello.txt\r\n``` \r\n\r\nIf you uncomment the commented block in the c program above, then it works.\r\n\r\n### Version of libgit2 (release number or SHA1)\r\n\r\n0.28.1\r\n\r\n### Operating system(s) tested\r\n\r\nGentoo Linux, and Travis (Ubuntu Linux)","author":{"url":"https://github.com/jdavid","@type":"Person","name":"jdavid"},"datePublished":"2019-03-09T17:48:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/5015/libgit2/issues/5015"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:402472c1-0985-eb10-85ea-a33a47d70c7d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC18:350AA1:10FA901:16BD05F:6A5EA80E |
| html-safe-nonce | 68937a55bb28ae6ab95745cf72c0d2a40f6656857f3c738b905782d417a12d3d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzE4OjM1MEFBMToxMEZBOTAxOjE2QkQwNUY6NkE1RUE4MEUiLCJ2aXNpdG9yX2lkIjoiNzQ4NzQzODE0MDQxMjExMDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 534f1810a78c15ac7f3e171f06ddd9910a5c8f42b35d5704f442467c5ba69dcc |
| hovercard-subject-tag | issue:419097531 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/5015/issue_layout |
| twitter:image | https://opengraph.githubassets.com/31407b6d0ce551a2fc513bf345eff2fc9a50a01f7466b1b27d481e0b4beb9e44/libgit2/libgit2/issues/5015 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/31407b6d0ce551a2fc513bf345eff2fc9a50a01f7466b1b27d481e0b4beb9e44/libgit2/libgit2/issues/5015 |
| og:image:alt | This is a regression, it works fine with 0.27 Found while upgrading pygit2 to v0.28, see https://travis-ci.org/libgit2/pygit2/jobs/503956525#L1044 This is the only test failure in the pygit2 test s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jdavid |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7c7e31acb6a895494e518b880f5ccf39604f7fa9a8f2f3c64145efc3b776256d |
| turbo-cache-control | no-preview |
| go-import | github.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git |
| octolytics-dimension-user_id | 394745 |
| octolytics-dimension-user_login | libgit2 |
| octolytics-dimension-repository_id | 901662 |
| octolytics-dimension-repository_nwo | libgit2/libgit2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 901662 |
| octolytics-dimension-repository_network_root_nwo | libgit2/libgit2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2d2ac9bdd71d5f53f2b731c9330677e38624e301 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width