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

"Nice to have" FR: a way to do the equivalent of git show --stat *if* a commit is created #189

Closed
ilyagr opened this issue Nov 6, 2023 · 3 comments

Comments

@ilyagr
Copy link

ilyagr commented Nov 6, 2023

What I want is easy to achieve if calling mike with --allow-empty, since a commit is always created in this case:

mike deploy --allow-empty ...
git show --stat gh-pages

However, it'd be nice if I could get a correct response even without --allow-empty:

Alternatively, this could be something like:

mike deploy --exec-on-commit-creation "git show --stat gh-pages"
@ilyagr ilyagr changed the title FR: a way to do the equivalent of git show --stat **if** a commit is created FR: a way to do the equivalent of git show --stat *if* a commit is created Nov 6, 2023
@ilyagr ilyagr changed the title FR: a way to do the equivalent of git show --stat *if* a commit is created "Nice to have" FR: a way to do the equivalent of git show --stat *if* a commit is created Nov 6, 2023
@jimporter
Copy link
Owner

I assume your goal is to show the result of git show --stat only if mike actually generated a commit? In that case, just compare the Git SHA before and after you run mike, e.g. something like this:

OLD_REV=`git rev-parse gh-pages`
mike deploy ...
if [ "$OLD_REV" != "`git-rev-parse gh-pages`" ]; then
  git show --stat gh-pages
fi

This could possibly be handled via #161, but I don't intend to add anything that directly supports this in mike. It's rather specialized, and I'd prefer to avoid adding any more new features to mike unless they're extremely important; it's already quite a bit more complex than I'd ever intended.

@jimporter jimporter closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2023
@ilyagr
Copy link
Author

ilyagr commented Nov 6, 2023

Fair enough.

Originally, I was concerned about preserving the error code if I went with the script you suggested, but on second thought, that could be fixed with the appropriate sh option (set -x, I think).

Thanks for taking a look!

@jimporter
Copy link
Owner

Not a problem! And like I said, it might be possible to address this in a different way via a plugin system. I think that would cover most cases where people want to hook into various parts of what mike does internally.

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

No branches or pull requests

2 participants