Title: Repo.index.reset fails on windows · Issue #1630 · gitpython-developers/GitPython · GitHub
Open Graph Title: Repo.index.reset fails on windows · Issue #1630 · gitpython-developers/GitPython
X Title: Repo.index.reset fails on windows · Issue #1630 · gitpython-developers/GitPython
Description: How to reproduce clone any repo edit a tracked file in python, try to reset with Repo().index.reset(working_tree=True) You will get a stack trace. Step by step recipe: $ git clone https://github.com/gitpython-developers/GitPython git-pyt...
Open Graph Description: How to reproduce clone any repo edit a tracked file in python, try to reset with Repo().index.reset(working_tree=True) You will get a stack trace. Step by step recipe: $ git clone https://github.co...
X Description: How to reproduce clone any repo edit a tracked file in python, try to reset with Repo().index.reset(working_tree=True) You will get a stack trace. Step by step recipe: $ git clone https://github.co...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/1630
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Repo.index.reset fails on windows","articleBody":"## How to reproduce\r\n1. clone any repo\r\n2. edit a tracked file\r\n3. in python, try to reset with\r\n ```python\r\n Repo().index.reset(working_tree=True)\r\n ```\r\n You will get a stack trace.\r\n\r\n## Step by step recipe:\r\n```\r\n$ git clone https://github.com/gitpython-developers/GitPython git-python\r\n$ cd git-python\r\n$ python -m venv --prompt git venv\r\n$ .\\venv\\Scirpts\\Activate.ps1 # or whatever script is appropriate for you\r\n$ rm pyproject.toml # make any edit\r\n$ git status -sb\r\n## main...origin/main\r\n D pyproject.toml\r\n$ python\r\n\u003e\u003e\u003e from git import Repo\r\n\u003e\u003e\u003e repo.index.reset(working_tree=True)\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"C:\\Users\\\u003cuser\u003e\\code\\git-python\\git\\index\\util.py\", line 103, in check_default_index\r\n return func(self, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\\u003cuser\u003e\\code\\git-python\\git\\index\\base.py\", line 1320, in reset\r\n new_inst = type(self).from_tree(self.repo, commit)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\\u003cuser\u003e\\code\\git-python\\git\\index\\base.py\", line 367, in from_tree\r\n repo.git.read_tree(*arg_list, **kwargs)\r\n File \"C:\\Users\\\u003cuser\u003e\\code\\git-python\\git\\cmd.py\", line 739, in \u003clambda\u003e\r\n return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\user\u003e\\code\\git-python\\git\\cmd.py\", line 1312, in _call_process\r\n return self.execute(call, **exec_kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"C:\\Users\\\u003cuser\u003e\\code\\git-python\\git\\cmd.py\", line 1107, in execute\r\n raise GitCommandError(redacted_command, status, stderr_value, stdout_value)\r\ngit.exc.GitCommandError: Cmd('git') failed due to: exit code(128)\r\n cmdline: git read-tree --index-output=C:\\Users\\\u003cuser\u003e\\code\\git-python\\.git\\tmpxnmxtmmu HEAD\r\n stderr: 'fatal: unable to write new index file'\r\n```\r\n\r\n## Expectation\r\nI was expecting the result would be the equivalent of `git reset --hard HEAD`. Am I doing something incorrectly here? I'm unfamiliar with Windows, so it's quite possible.","author":{"url":"https://github.com/suvayu","@type":"Person","name":"suvayu"},"datePublished":"2023-08-19T07:59:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1630/GitPython/issues/1630"}
| 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:e25c7db0-af9e-ae3e-d532-dd45695fb91e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A32:1756ED:8F670C:CBAD0B:69725115 |
| html-safe-nonce | d795d696ad037512660384481048111aba699a929e4ca31dfcce0589e0a00a25 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTMyOjE3NTZFRDo4RjY3MEM6Q0JBRDBCOjY5NzI1MTE1IiwidmlzaXRvcl9pZCI6IjcxMzE5MTEzNDcwMzI0NDUyMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b9d46caa5e81d42c9de4ea8caa3bf5edcee6b810a855bff8ee40db07d74167aa |
| hovercard-subject-tag | issue:1857627257 |
| 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/gitpython-developers/GitPython/1630/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c256a43eb7626887591682628d0d832bcb407ad021f423e94efa701f3e0bb50/gitpython-developers/GitPython/issues/1630 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c256a43eb7626887591682628d0d832bcb407ad021f423e94efa701f3e0bb50/gitpython-developers/GitPython/issues/1630 |
| og:image:alt | How to reproduce clone any repo edit a tracked file in python, try to reset with Repo().index.reset(working_tree=True) You will get a stack trace. Step by step recipe: $ git clone https://github.co... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | suvayu |
| hostname | github.com |
| expected-hostname | github.com |
| None | f6d9b08324bb62b2cf170b9e435da2bdc7efa5aa93e7ca70ee3162552c05329b |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| 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 | 169d2b5c72bff9cc676084f0ac7f8ea888f15f54 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width