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

chore: merge jquery-form history into third-party/projects/ #395

Closed
wants to merge 215 commits into from

Conversation

wincent
Copy link
Contributor

@wincent wincent commented Feb 8, 2021

Just a draft PR to see if CI likes the merge here.

This is for #394 — if CI is good, I'll push directly to master (no merge commit) and then apply the patch on top of there.

Details (from third-to-last commit) follow:


chore: merge jquery-form history into third-party/projects/

In service of #394.

Basically, we want to pull in the code from this third-party project (which is mostly on life-support at this point) and apply a small patch on top. We don't anticipate having to change it much, if ever, so we are sticking it under "third-party/projects/" and we won't cover it with our normal linting/formatting/testing.

Note that because everything else in the repo pulls in history via subtree merge, doing it here as well. That way if we ever need to git blame in here we'll have something useful to look at.

Note also that in liferay-portal we are using v3.51 of this plugin and have no plans to switch to the latest (v4.3.0) at this time, but I am still pulling in and re-writing all of the tags so that we can easily merge the newer stuff in in the future if we want to.

Steps follow.

Grab the code:

git remote add -f jquery-form https://github.com/jquery-form/form.git

Make directory for it. Note that it is going to live at "third-party/projects/jquery-form/" and not "third-party/jquery-form/"; we want to reserve the top-level inside of "third-party/" for any future tooling that we might want to share across projects, or any common READMEs or other docs:

mkdir -p third-party/projects

Create annotated tags seeing as all the tags in the project are unannotated:

for TAG in \
  3.25.0-2013.01.18 \
  3.32.0-2013.04.09 \
  3.36 \
  3.37.0 \
  3.45.0 \
  3.46.0 \
  3.49 \
  3.50 \
  3.51; do
  git tag -f -a -m jquery-form/v$TAG $TAG $TAG
done

for TAG in \
  v3.19 \
  v4.0.0 \
  v4.0.1 \
  v4.1.0 \
  v4.2.0 \
  v4.2.1 \
  v4.2.2 \
  v4.3.0; do
  git tag -f -a -m jquery-form/$TAG $TAG $TAG
done

Rewrite tags to have a prefix. First tags starting with "v" and then those without a leading "v":

support/filter-tags.sh jquery-form/master 'sed "s#^v#jquery-form/v#"'
support/filter-tags.sh jquery-form/master 'sed "s#^\([0-9]\)#jquery-form/v\1#"'

Do the actual subtree merge:

git merge -s ours --no-commit --allow-unrelated-histories jquery-form/v3.51
git read-tree --prefix=third-party/projects/jquery-form -u jquery-form/v3.51
git commit -m 'chore: merge jquery-form history into third-party/projects/'

Make sure shape of DAG is sane:

git log --oneline --decorate --graph --all

Push rewritten tags so that entire history will be reachable/explorable:

git push upstream-rw --tags --dry-run
git push upstream-rw --tags

Kill temporary remote that was added earlier. We don't want this lying around because a careless fetch could pull down all the tags that we don't want (because they aren't prefixed, or annotated, or even consistent), and it is all too easy to accidentally contaminate the upstream with these tags by a push. If we ever need to resync with upstream history again, we can just re-add the remote:

git remote remove jquery-form

Amend commit to make these notes that you're reading now:

git commit --amend

Mike and others added 30 commits January 25, 2009 22:55
- added <pre> check to json/script iframe response
- remove 'return false' from submit handler
malsup and others added 24 commits September 3, 2013 21:58
added optional CDN support for #408
version bump
whitespace/tab fixes
the CDN version directory now seems to be major.minor (without patch level .0)
In service of:

    #394

Basically, we want to pull in the code from this third-party project
(which is mostly on life-support at this point) and apply a small patch
on top. We don't anticipate having to change it much, if ever, so we are
sticking it under "third-party/projects/" and we won't cover it with our
normal linting/formatting/testing.

Note that because everything else in the repo pulls in history via
subtree merge, doing it here as well. That way if we ever need to `git
blame` in here we'll have something useful to look at.

Note also that in liferay-portal we are using v3.51 of this plugin and
have no plans to switch to the latest (v4.3.0) at this time, but I am
still pulling in and re-writing all of the tags so that we can easily
merge the newer stuff in in the future if we want to.

Steps follow.

Grab the code:

    git remote add -f jquery-form https://github.com/jquery-form/form.git

Make directory for it. Note that it is going to live at
"third-party/projects/jquery-form/" and not "third-party/jquery-form/";
we want to reserve the top-level inside of "third-party/" for any future
tooling that we might want to share across projects, or any common
READMEs or other docs:

    mkdir -p third-party/projects

Create annotated tags seeing as all the tags in the project are
unannotated:

    for TAG in \
      3.25.0-2013.01.18 \
      3.32.0-2013.04.09 \
      3.36 \
      3.37.0 \
      3.45.0 \
      3.46.0 \
      3.49 \
      3.50 \
      3.51; do
      git tag -f -a -m jquery-form/v$TAG $TAG $TAG
    done

    for TAG in \
      v3.19 \
      v4.0.0 \
      v4.0.1 \
      v4.1.0 \
      v4.2.0 \
      v4.2.1 \
      v4.2.2 \
      v4.3.0; do
      git tag -f -a -m jquery-form/$TAG $TAG $TAG
    done

Rewrite tags to have a prefix. First tags starting with "v" and then
those without a leading "v":

    support/filter-tags.sh jquery-form/master 'sed "s#^v#jquery-form/v#"'
    support/filter-tags.sh jquery-form/master 'sed "s#^\([0-9]\)#jquery-form/v\1#"'

Do the actual subtree merge:

    git merge -s ours --no-commit --allow-unrelated-histories jquery-form/v3.51
    git read-tree --prefix=third-party/projects/jquery-form -u jquery-form/v3.51
    git commit -m 'chore: merge jquery-form history into third-party/projects/'

Make sure shape of DAG is sane:

    git log --oneline --decorate --graph --all

Push rewritten tags so that entire history will be reachable/explorable:

    git push upstream-rw --tags --dry-run
    git push upstream-rw --tags

Kill temporary remote that was added earlier. We don't want this lying
around because a careless `fetch` could pull down all the tags that we
don't want (because they aren't prefixed, or annotated, or even
consistent), and it is all too easy to accidentally contaminate the
upstream with these tags by a push. If we ever need to resync with
upstream history again, we can just re-add the remote:

    git remote remove jquery-form

Amend commit to make these notes that you're reading now:

    git commit --amend
The code in "third-party/projects/jquery-form/" is dual-licensed under
the GPL v2.0 and MIT licenses. We're going to be distributing our
version with a tiny patch on top using the MIT because, but it makes
sense to at least have the license text for both licenses available in
the repo.
Stuff under third-party/projects/ is stuff that we don't plan on
touching much at all -- just minimal forks up third-party code with
small patches on top -- so we don't want to churn it all up just to make
it match our formatting and linting rules.
@wincent
Copy link
Contributor Author

wincent commented Feb 8, 2021

Semantic PR failure is expected (because of old commit messages), but all the others are green, so yay. Going to push a couple small README/doc fixes on top of this, but I think we're good. Closing this draft for now.

@wincent wincent closed this Feb 8, 2021
@wincent wincent deleted the wincent/import-jquery-form branch February 8, 2021 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.