Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876 · GitHub
Open Graph Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876
X Title: What's wrong with resetting with both --mixed and paths? · gitpython-developers/GitPython · Discussion #1876
Description: What's wrong with resetting with both --mixed and paths?
Open Graph Description: The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecated. # See h...
X Description: The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecate...
Opengraph URL: https://github.com/gitpython-developers/GitPython/discussions/1876
X: @github
Domain: Github.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"What's wrong with resetting with both --mixed and paths?","text":"\u003cp dir=\"auto\"\u003eThe \u003ccode class=\"notranslate\"\u003eHEAD.reset\u003c/code\u003e method includes this code:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003c/p\u003e\u003cdiv class=\"Box Box--condensed my-2\"\u003e\n \u003cdiv class=\"Box-header f6\"\u003e\n \u003cp class=\"mb-0 text-bold\"\u003e\n \u003ca href=\"https://github.com/gitpython-developers/GitPython/blob/e880c33284f2abff55d3cddfef2302663b178005/git/refs/head.py#L97-L105\"\u003eGitPython/git/refs/head.py\u003c/a\u003e\n \u003c/p\u003e\n \u003cp class=\"mb-0 color-fg-muted\"\u003e\n Lines 97 to 105\n in\n \u003ca data-pjax=\"true\" class=\"commit-tease-sha Link--inTextBlock\" href=\"/gitpython-developers/GitPython/commit/e880c33284f2abff55d3cddfef2302663b178005\"\u003ee880c33\u003c/a\u003e\n \u003c/p\u003e\n \u003c/div\u003e\n \u003cdiv itemprop=\"text\" class=\"Box-body p-0 blob-wrapper blob-wrapper-embedded data\"\u003e\n \u003ctable class=\"highlight tab-size mb-0 js-file-line-container\" data-tab-size=\"8\" data-paste-markdown-skip=\"\"\u003e\n\n \u003ctbody\u003e\u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L97\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"97\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC97\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eindex\u003c/span\u003e: \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L98\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"98\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC98\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-s1\"\u003emode\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"--mixed\"\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L99\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"99\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC99\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L100\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"100\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC100\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-c\"\u003e# Tt appears some git versions declare mixed and paths deprecated.\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L101\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"101\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC101\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-c\"\u003e# See http://github.com/Byron/GitPython/issues#issue/2.\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L102\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"102\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC102\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-k\"\u003eif\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003epaths\u003c/span\u003e: \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L103\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"103\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC103\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-s1\"\u003emode\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003eNone\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L104\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"104\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC104\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-c\"\u003e# END special case\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n\n \u003ctr class=\"border-0\"\u003e\n \u003ctd id=\"L105\" class=\"blob-num border-0 tmp-px-3 py-0 color-bg-default\" data-line-number=\"105\"\u003e\u003c/td\u003e\n \u003ctd id=\"LC105\" class=\"blob-code border-0 tmp-px-3 py-0 color-bg-default blob-code-inner js-file-line\"\u003e \u003cspan class=\"pl-c\"\u003e# END handle index\u003c/span\u003e \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\u003c/table\u003e\n \u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThe issue URL is broken and seems it may not be archived. Is more known about this issue, and is there anything that can be replaced with?\u003c/p\u003e","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003eAlthough I can't be certain there isn't further relevant information in the lost issue, I think I've figured this out. It's much more straightforward than I'd feared and indeed trying it out as you suggested in \u003ca class=\"issue-link js-issue-link\" data-error-text=\"Failed to load title\" data-id=\"6371726\" data-permission-text=\"Title is private\" data-url=\"https://github.com/gitpython-developers/GitPython/discussions/1876\" data-hovercard-type=\"discussion\" data-hovercard-url=\"/gitpython-developers/GitPython/discussions/1876/hovercard?comment_id=8784228\" href=\"https://github.com/gitpython-developers/GitPython/discussions/1876#discussioncomment-8784228\"\u003e#1876 (comment)\u003c/a\u003e led directly to the answer.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eRunning \u003ccode class=\"notranslate\"\u003egit reset --mixed -- \u003cem\u003epath\u003c/em\u003e\u003c/code\u003e always shows a warning. For example:\u003c/p\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"\u0026gt; git diff --staged --stat\n git/__init__.py | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)\n\u0026gt; git reset --mixed -- git/__init__.py\nwarning: --mixed with paths is deprecated; use 'git reset -- \u0026lt;paths\u0026gt;' instead.\nUnstaged changes after reset:\nM git/__init__.py\"\u003e\u003cpre lang=\"text\" class=\"notranslate\"\u003e\u003ccode class=\"notranslate\"\u003e\u0026gt; git diff --staged --stat\n git/__init__.py | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)\n\u0026gt; git reset --mixed -- git/__init__.py\nwarning: --mixed with paths is deprecated; use 'git reset -- \u0026lt;paths\u0026gt;' instead.\nUnstaged changes after reset:\nM git/__init__.py\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe suggestion of what to do instead was added in \u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/git/git/commit/a4941a81c8a67abad2000b044ecad71ceff9d695/hovercard\" href=\"https://github.com/git/git/commit/a4941a81c8a67abad2000b044ecad71ceff9d695\"\u003egit/git@\u003ctt\u003ea4941a8\u003c/tt\u003e\u003c/a\u003e, but the behavior of issuing a deprecation message is older than that.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eIt looks like it came in at \u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/git/git/commit/0e5a7faa3a903cf7a0a66c81e20a76b91f17faab/hovercard\" href=\"https://github.com/git/git/commit/0e5a7faa3a903cf7a0a66c81e20a76b91f17faab\"\u003egit/git@\u003ctt\u003e0e5a7fa\u003c/tt\u003e\u003c/a\u003e when \u003ccode class=\"notranslate\"\u003egit-reset\u003c/code\u003e was changed from being implemented as a shell script \u003ccode class=\"notranslate\"\u003egit-reset.sh\u003c/code\u003e (retained as an example, then later removed in \u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/git/git/commit/49eb8d39c78f161231e63293df60f343d208f409/hovercard\" href=\"https://github.com/git/git/commit/49eb8d39c78f161231e63293df60f343d208f409\"\u003egit/git@\u003ctt\u003e49eb8d3\u003c/tt\u003e\u003c/a\u003e along with other such examples) to a builtin implemented in a newly introduced \u003ccode class=\"notranslate\"\u003ebuiltin-reset.c\u003c/code\u003e. The first stable version of \u003ccode class=\"notranslate\"\u003egit\u003c/code\u003e to include these changes was 1.5.4, whose \u003ca href=\"https://github.com/git/git/blob/master/Documentation/RelNotes/1.5.4.txt\"\u003erelease notes\u003c/a\u003e mention \u003ccode class=\"notranslate\"\u003egit reset\u003c/code\u003e becoming a builtin but do not mention the deprecation of passing paths after \u003ccode class=\"notranslate\"\u003e--mixed\u003c/code\u003e. But it is not to be found in the old shell script.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eAs for why one \u003cem\u003eshouldn't\u003c/em\u003e write \u003ccode class=\"notranslate\"\u003e--mixed\u003c/code\u003e when passing paths, it seems the idea is that a reset with paths--which must always have the same effect as when \u003ccode class=\"notranslate\"\u003e--mixed\u003c/code\u003e is passed--is already just its own separate kind of operation from other resets. Anyway, the approach taken in the code of simply omitting \u003ccode class=\"notranslate\"\u003e--mixed\u003c/code\u003e, not passing \u003ccode class=\"notranslate\"\u003e--hard\u003c/code\u003e or \u003ccode class=\"notranslate\"\u003e--soft\u003c/code\u003e either, and still passing the paths after \u003ccode class=\"notranslate\"\u003e--\u003c/code\u003e, seems to be robust and congruent with the expanded deprecation message.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI'll open a small PR to clarify the comment.\u003c/p\u003e","upvoteCount":1,"url":"https://github.com/gitpython-developers/GitPython/discussions/1876#discussioncomment-8975656"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:06318880-2b10-46fb-f98c-52817bf1b6aa |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | A56A:1B6542:7F1C3D:B33D72:6A638885 |
| html-safe-nonce | fa42fc9330753203da239714a5bd55ae8e30607d33a8e1ab3ebd000d30696b6e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTZBOjFCNjU0Mjo3RjFDM0Q6QjMzRDcyOjZBNjM4ODg1IiwidmlzaXRvcl9pZCI6IjM1NjA2OTUzMjA4NzkwMDc4NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f387698dbbd57a05201e0c9fa37fcd9e7885d289686fae20c7324eeda91ff38c |
| hovercard-subject-tag | discussion:6371726 |
| github-keyboard-shortcuts | repository,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/Voltron::DiscussionsFragmentsController/show/gitpython-developers/GitPython/1876/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/41d989b35470a2f11e8d23cb577f79f9be72407f5edf11fc3ba0a0f4ba9ede69/gitpython-developers/GitPython/discussions/1876 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41d989b35470a2f11e8d23cb577f79f9be72407f5edf11fc3ba0a0f4ba9ede69/gitpython-developers/GitPython/discussions/1876 |
| og:image:alt | The HEAD.reset method includes this code: GitPython/git/refs/head.py Lines 97 to 105 in e880c33 if index: mode = "--mixed" # Tt appears some git versions declare mixed and paths deprecated. # See h... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ca676e17c4da4532dc68541e9fc874034ae840c26b5f34da7f1c42d9a600659 |
| 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 | 3a0a9f049e072eb8e5795dfddcefdba9e277501d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width