On failure of a pre-commit hook, run git stash pop

未关闭
#762 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
git, ruby
领域
devtools

调研方向

The issue reports that a failed pre-commit run leaves the stash unrestored, and the README is cited as documenting the stash step. Start by reading the README section on stashing and then reproduce with a pre-commit hook that fails, using a .overcommit.yml with a deliberately broken hook. Done means that after a failed run the stashed changes are restored, with a spec covering the failure path.

由索引模型根据 Issue 内容生成。

描述

I'm getting an error in the pre-commit hook run (I don't have any pre-commit hooks, but that's another issue). When the program finishes running, files have been stashed (as is mentioned in the README) but are not restored.

kenyon@Kenyons-MacBook-Pro ~b % git status
On branch BBS-3445-b
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   db/schema.rb

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   .git_hooks/post_commit/run_annotate_models.rb
	modified:   .overcommit.yml
kenyon@Kenyons-MacBook-Pro ~b % git commit       
Unable to setup environment for pre-commit hook run:
STDOUT:
STDERR:Signature of configuration file has changed!
Run `overcommit --sign` once you've verified the configuration changes.
For more information, see https://github.com/sds/overcommit#security
kenyon@Kenyons-MacBook-Pro ~b % git status
On branch dev
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   file1.txt

kenyon@Kenyons-MacBook-Pro ~b % git stash pop
On branch dev
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   file1.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   file2.txt
	modified:   file3.txt
主要语言
Ruby
星标
4k
派生
288
平均合并
2 天 4 小时
30 天内合并 PR
18

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sds/overcommit 的其他 Issue

查看 sds/overcommit 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。