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: 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:11e0c96a-fea0-55c9-4508-15756b5f2a78 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C494:1FCAE7:11943C2:18EA5C2:6968ADDA |
| html-safe-nonce | b3da11a7984e71f0c63a1899138eb2490aa6d60f105195e82880cc540987918a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDk0OjFGQ0FFNzoxMTk0M0MyOjE4RUE1QzI6Njk2OEFEREEiLCJ2aXNpdG9yX2lkIjoiMjkxOTg4MTE4Mzc3NzU2NjE3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 295431216fffda49fcb1e38c1818968c3e708a0cdac854c09bee85df79a40461 |
| 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 | fdc7c66bd36a6c12eb8e771e806db863266e573fc299e77f27505a768d4f8a98 |
| 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 | 3223a6503d318917691422cdadfbe16cd8fb21e5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width