Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict only in posting commits for elapsed time decisions #150

Merged
merged 2 commits into from
Jun 14, 2023
Merged

Restrict only in posting commits for elapsed time decisions #150

merged 2 commits into from
Jun 14, 2023

Conversation

kachick
Copy link
Collaborator

@kachick kachick commented Jun 14, 2023

現在のリマインダー判定ロジックだと、既存のデータに対する typo 修正やラベルの付け外し等で生じる変化に対しても「記事を書いた」という扱いになってリマインダーが送られません。
これはパン粉さんの投稿を楽しみにしている読者に対して不誠実、或いは「最後にブログを書いてから n 日過ぎました」という目的に対して不正確かと思いますので、ファイルの増分が確認されない限り投稿していないという判定に変えてみました。

go-git は --diff-filter 周りへ対応できていないようなので、git コマンドへ直接依存するようにしています。

refs:

)

func main() {
r, err := git.PlainOpen(".")
lastCommitDateLine, err := exec.Command("git", "log", "-1", "--diff-filter=A", "--pretty=%aI", "--", "content/posts").Output()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go-git、diff-filter に対応してないかー

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git は巨大だから全部は対応できてないんす。

と書いてあったけど、この箇所とかまさにでした

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI

treefmtという自分も一部で使っているプロジェクトがあって、それも最近 go-git への依存性を落としてました

https://github.com/numtide/treefmt/releases/tag/v2.1.0

In addition, we no longer rely on [go-git](https://github.com/go-git/go-git); instead, we use git itself.

We have seen some issues with [go-git](https://github.com/go-git/go-git) and decided that it wasn't adding much value and would always remain a source of discrepancy with git itself.

numtide/treefmt#439

@pankona
Copy link
Owner

pankona commented Jun 14, 2023

やっていこう

@pankona pankona merged commit dd1239b into pankona:main Jun 14, 2023
@kachick
Copy link
Collaborator Author

kachick commented Jun 14, 2023

ありがとうございます、先生の新作楽しみです

@kachick kachick deleted the collect-posts-added-only-date branch June 14, 2023 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants