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:49050431-af29-fe88-4adf-ca33130a523a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF58:1CEF06:75BF28:9EE4A0:6A5EE2C0 |
| html-safe-nonce | 99245a345c0720478f293bdf3b73d02e3ed3fd1012b901a559284371046d9176 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjU4OjFDRUYwNjo3NUJGMjg6OUVFNEEwOjZBNUVFMkMwIiwidmlzaXRvcl9pZCI6IjY3ODg5NTkyNjkzMTkyNzExMDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bc1b55a73643d033ab1ede29785900b69186b86ba214ea517f0da0142b0e61db |
| 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 | 82d0004a35927bdb00c652a57f456c55aa0eda4ade1bc7956d7510fdea6e454b |
| 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 | d2d913dd727d2d7ac189fb4d05b10bc34ecd03ee |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width