René's URL Explorer Experiment


Title: pre-commit can delete/revert unstaged files if error occurs during git diff-index · Issue #2773 · pre-commit/pre-commit · GitHub

Open Graph Title: pre-commit can delete/revert unstaged files if error occurs during git diff-index · Issue #2773 · pre-commit/pre-commit

X Title: pre-commit can delete/revert unstaged files if error occurs during git diff-index · Issue #2773 · pre-commit/pre-commit

Description: search you tried in the issue tracker diff-index describe your issue I performed a git commit with some modifications unstaged. After the commit, most of the modifications had been reverted and my work was lost. The diff saved in the pat...

Open Graph Description: search you tried in the issue tracker diff-index describe your issue I performed a git commit with some modifications unstaged. After the commit, most of the modifications had been reverted and my ...

X Description: search you tried in the issue tracker diff-index describe your issue I performed a git commit with some modifications unstaged. After the commit, most of the modifications had been reverted and my ...

Opengraph URL: https://github.com/pre-commit/pre-commit/issues/2773

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pre-commit can delete/revert unstaged files if error occurs during git diff-index","articleBody":"### search you tried in the issue tracker\n\ndiff-index\n\n### describe your issue\n\nI performed a git commit with some modifications unstaged.  After the commit, most of the modifications had been reverted and my work was lost.  The diff saved in the patch directory had only a few of the modifications in - the ones that survived. The rest were gone.\r\n\r\nTo reproduce:\r\n- Modify four files and stage one with `git add`\r\n- Use `git status` to determine the order of the three unstaged files.\r\n- Change the permission on the middle one so that git will not be able to read it\r\n- Now do `git commit`: the changes to the first unstaged file will be preserved but the other two will be lost.\r\n\r\nThe key point, I think, is that the code in `staged_files_only.py` checks that the return code when creating the diff is non-zero which it takes to mean that the code is `1` meaning that there were diffs.   However, in this case the return code is `128` which *is* non-zero but does _not_ mean success - it means error.  So the code assumes the diff is OK even though it is incomplete.\n\n### pre-commit --version\n\n2.17.0\n\n### .pre-commit-config.yaml\n\n```yaml\nrepos:\r\n- repo: https://github.com/pre-commit/pre-commit-hooks\r\n  rev: 56b4a7e506901ff86f8de5c2551bc41f8eacf717\r\n  hooks:\r\n     -   id: check-yaml\r\n#     -   id: end-of-file-fixer\r\n     -   id: trailing-whitespace\r\n- repo: https://github.com/psf/black\r\n  rev: 21.11b0\r\n  hooks:\r\n    -   id: black\r\n        language_version: python3.6\r\n- repo: https://github.com/PyCQA/isort\r\n  rev: 5.10.1\r\n  hooks:\r\n    -   id: isort\r\n        args: [\"--profile\", \"black\", \"--filter-files\"]\n```\n\n\n### ~/.cache/pre-commit/pre-commit.log (if present)\n\n_No response_","author":{"url":"https://github.com/strubbly","@type":"Person","name":"strubbly"},"datePublished":"2023-02-21T16:18:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2773/pre-commit/issues/2773"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:586ae21c-208a-b36d-19f9-e4faafdf2067
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBB6A:2CEF6D:4EED8C5:6EEAA80:6A570544
html-safe-nonce6cf0485b03d7014a028d82c176b7ddd67dc857d9834e035797be9b8ec1f43075
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjZBOjJDRUY2RDo0RUVEOEM1OjZFRUFBODA6NkE1NzA1NDQiLCJ2aXNpdG9yX2lkIjoiMTI4Mjg4ODQ0MDgzMzU3NDIxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1d3faae8ec40e3ebb92314bdaefe0f97d44fac962142122795c8ade7c5c92cb3
hovercard-subject-tagissue:1593756040
github-keyboard-shortcutsrepository,issues,commits,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pre-commit/pre-commit/2773/issue_layout
twitter:imagehttps://opengraph.githubassets.com/173acbcdfa23c8ae7cff7623c7e29e8edf783dd526291c42b6e973293ce26b7a/pre-commit/pre-commit/issues/2773
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/173acbcdfa23c8ae7cff7623c7e29e8edf783dd526291c42b6e973293ce26b7a/pre-commit/pre-commit/issues/2773
og:image:altsearch you tried in the issue tracker diff-index describe your issue I performed a git commit with some modifications unstaged. After the commit, most of the modifications had been reverted and my ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamestrubbly
hostnamegithub.com
expected-hostnamegithub.com
None4eb29e5f807bd95e41196adfbc6d28f9af12d89830d8b684f3e871774ddff2fc
turbo-cache-controlno-preview
go-importgithub.com/pre-commit/pre-commit git https://github.com/pre-commit/pre-commit.git
octolytics-dimension-user_id6943086
octolytics-dimension-user_loginpre-commit
octolytics-dimension-repository_id17689377
octolytics-dimension-repository_nwopre-commit/pre-commit
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id17689377
octolytics-dimension-repository_network_root_nwopre-commit/pre-commit
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb056788a129fb0194b61f2ebb4c43f6a9f4dfd27
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pre-commit/pre-commit/issues/2773#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpre-commit%2Fpre-commit%2Fissues%2F2773
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpre-commit%2Fpre-commit%2Fissues%2F2773
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=pre-commit%2Fpre-commit
Reloadhttps://github.com/pre-commit/pre-commit/issues/2773
Reloadhttps://github.com/pre-commit/pre-commit/issues/2773
Reloadhttps://github.com/pre-commit/pre-commit/issues/2773
Please reload this pagehttps://github.com/pre-commit/pre-commit/issues/2773
pre-commit https://github.com/pre-commit
pre-commithttps://github.com/pre-commit/pre-commit
Please reload this pagehttps://github.com/pre-commit/pre-commit/issues/2773
Notifications https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Fork 985 https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Star 15.4k https://github.com/login?return_to=%2Fpre-commit%2Fpre-commit
Code https://github.com/pre-commit/pre-commit
Issues 22 https://github.com/pre-commit/pre-commit/issues
Pull requests 13 https://github.com/pre-commit/pre-commit/pulls
Actions https://github.com/pre-commit/pre-commit/actions
Security and quality 0 https://github.com/pre-commit/pre-commit/security
Insights https://github.com/pre-commit/pre-commit/pulse
Code https://github.com/pre-commit/pre-commit
Issues https://github.com/pre-commit/pre-commit/issues
Pull requests https://github.com/pre-commit/pre-commit/pulls
Actions https://github.com/pre-commit/pre-commit/actions
Security and quality https://github.com/pre-commit/pre-commit/security
Insights https://github.com/pre-commit/pre-commit/pulse
#2774https://github.com/pre-commit/pre-commit/pull/2774
pre-commit can delete/revert unstaged files if error occurs during git diff-indexhttps://github.com/pre-commit/pre-commit/issues/2773#top
#2774https://github.com/pre-commit/pre-commit/pull/2774
bughttps://github.com/pre-commit/pre-commit/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/strubbly
strubblyhttps://github.com/strubbly
on Feb 21, 2023https://github.com/pre-commit/pre-commit/issues/2773#issue-1593756040
bughttps://github.com/pre-commit/pre-commit/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.