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

Add --squash-history option #127

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

framillien
Copy link

Issue: #126

This option is similar to --no-history (avoid bloating the repository size) but keep data. We squash all commits from gh-pages branch filtered on the current commit message.

This allow workflows like keeping commits and data for a released doc and always override nightlies documentations.

This option is similar to --no-history (avoid bloating the repository
size) but keep data. We squash all commits from gh-pages branch filtered
on the current commit message.

This allow workflows like keeping commits and data for a released doc
and always override nightlies documentations.
@framillien
Copy link
Author

Initial commit, openning PR for discussion. Know issues or things to test:

  • filter-branch script is a bash script using grep. What happen on Windows machines ?
  • filter-branch always write info on stdout, when other ghp-import commands print nothing. Should we mask them ?
  • We may want to avoid warning and delay by adding FILTER_BRANCH_SQUELCH_WARNING=1 (currently the caller could define it)

Tested on Linux with:

❯ FILTER_BRANCH_SQUELCH_WARNING=1 ghp-import -a doc
Rewrite a2bccfe1898a5de024d0e1d4110352095c5ad644 (6/6) (0 seconds passed, remaining 0 predicted)
Ref 'refs/heads/gh-pages' was rewritten

❯ ghp-import -a -m "Update latest" doc
WARNING: git-filter-branch has a glut of gotchas generating mangled history
         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
         alternative filtering tool such as 'git filter-repo'
         (https://github.com/newren/git-filter-repo/) instead.  See the
         filter-branch manual page for more details; to squelch this warning,
         set FILTER_BRANCH_SQUELCH_WARNING=1.
Rewrite 07dcc674ba1d249b54623b5e439e2744ff6ad766 (6/6) (0 seconds passed, remaining 0 predicted)
Ref 'refs/heads/gh-pages' was rewritten

Add env var FILTER_BRANCH_SQUELCH_WARNING to avoid warnings and
temporisation when git-filter is called.
@framillien
Copy link
Author

FILTER_BRANCH_SQUELCH_WARNING issue is fixed in above commit.

About Windows, this is working with my current git installation: https://gitforwindows.org/ + recommended setup option to add third-party tools in PATH (by default setup option). We may want to add a note in documentation, or just keep it like this.

@framillien
Copy link
Author

Playing with GitHub actions, I see Flake8 results, fixed above.

For my Github actions tests, I need to remove Python 2.7 checks, updating Python versions to 3.7 and 3.12. See: https://github.com/framillien/ghp-import/actions/runs/7657957284

@c-w
Copy link
Owner

c-w commented Jan 29, 2024

Apologies for the delay. Code LGTM. Could you also add your CI fixes to this PR and then I'll merge. Thank you.

Avoid deprecated Python version 2.7, being removed from GitHub Actions
images.
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