Keep git history for legacy custom modules

Created on 28 September 2023, over 1 year ago
Updated 10 October 2023, over 1 year ago

RE https://www.drupal.org/project/sector/issues/3389691

If these modules are part of sector_legacy it would be helpful to try keep the git history. I'll do a quick poc on this issue branch

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇳🇿New Zealand ericgsmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ericgsmith
  • 🇳🇿New Zealand ericgsmith

    That looks to be promising.

    I can't remember off the top of my head if Drupal forces you to squash commits when you merge, but if that is the case this could be done on the 1.0.x branch.

    These are the steps I took to do this using the awesome git-filter-repo tool.

    # Clone Sector 9.5.x
    git clone -b 9.5.x git@git.drupal.org:project/sector.git sector_legacy
    # Checkout a new branch of the issue fork
    git checkout -b 3390304-keep-git-history
    cd sector_legacy
    # Filter out everything except the modules folder
    python3 ~/git-filter-repo --path modules
    # Filter out sector_default_content and sector_wysiwyg_utils
    python3 ~/git-filter-repo --invert-paths --path modules/sector_default_content
    python3 ~/git-filter-repo --invert-paths --path modules/sector_wysiwyg_utils
    # Add the remote - in this case the issue fork, if we can't keep individual commits you could do this with true git origin
    git remote add sector_legacy-3390304 git@git.drupal.org:issue/sector_legacy-3390304.git\ngit fetch sector_legacy-3390304
    # Rebase onto the existing 1.0.x branch of sector_legacy
    git rebase sector_legacy-3390304/1.0.x
  • @ericgsmith opened merge request.
  • 🇳🇿New Zealand ericgsmith

    (This was just a POC to see the history rewrite, it doesn't include the actual D10 compatibility in the sector 10.x branch - I used 9.5.x since that had the full history)

  • Status changed to Needs review over 1 year ago
  • First commit to issue fork.
  • Status changed to Fixed over 1 year ago
  • 🇳🇿New Zealand dieuwe Auckland, NZ

    Cheers, this should be done and dusted now - but any further issues and we can follow up next week. Adding a reference to the Sector issue that removes these from the 10.0.x branch.

  • 🇳🇿New Zealand ericgsmith

    Ah looks like the merge squashed it down to 1 commit

  • 🇳🇿New Zealand dieuwe Auckland, NZ

    If I had used the Gitlab UI that might have been avoidable... lesson for next time

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024