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

Submodules to subtrees #16

Merged
merged 10,000 commits into from
Apr 22, 2024
Merged

Submodules to subtrees #16

merged 10,000 commits into from
Apr 22, 2024

Conversation

maxhbr
Copy link
Owner

@maxhbr maxhbr commented Apr 21, 2024

This automatically converts all submodules in ./data to subtrees to have the commits in this history and not to depend on third parties.

The script:

see also:

#!/usr/bin/env bash
# This script will convert all your git submodules into git subtrees.
# This script ensures that your new subtrees point to the same commits as the
# old submodules did, unlike most other scripts that do this.
# THIS SCRIPT MUST BE PLACED OUTSIDE OF YOUR REPOSITORY!!!!!!!!!!
# Otherwise, the script will interfere with the git commits (unless you add it to .gitignore).
# Save the script in your home directory as `~/subtrees.sh`
# `cd` into your repository
# Run `~/subtrees.sh`
# Enjoy!
#
# see:
# - https://gist.github.com/Nikita240/0c98cea8f53a15e69699cd8bc40657c4
# - https://stackoverflow.com/questions/28215244/convert-git-submodule-to-subtree

set -euo pipefail

# set -x

# extract the list of submodules from .gitmodule
cat .gitmodules |while read i; do
    if [[ $i == \[submodule* ]]; then

      read i
      # extract the module's prefix
      mpath=$(echo $i | grep -E "(\S+)$" -o)
      read i
      # extract the url of the submodule
      murl=$(echo $i|cut -d\= -f2|xargs)
      if [[ "$mpath" != "data/"* ]] then
        continue
      fi
      if [[ "$mpath" == "data/"*"/"* ]] then
        continue
      fi
      if [[ ! -d "$mpath" ]]; then
        continue
      fi
      echo converting $i
      echo path: $mpath
      echo url: $murl

      branch=main
      case "$mpath" in
        "data/wking-fsf-api")
          branch=gh-pages
          ;;
        "data/finos-OSLC-handbook")
          branch=master
          ;;
        "data/openSUSE-cavil")
          branch=master
          ;;
        "data/librariesio-license-compatibility")
          branch=master
          ;;
        "data/HansHammel-license-compatibility-checker")
          branch=master
          ;;
        "data/okfn-licenses")
          branch=master
          ;;
        "data/oslic")
          branch=master
          ;;
        "data/telekom-oslic")
          branch=master
          ;;
        "data/warpr-licensedb")
          branch=master
          ;;
        "data/Hitachi-open-license")
          branch=master
          ;;
        "data/ifrOSS-ifrOSS")
          branch=master
          ;;
        "data/github-choosealicense.com")
          branch=gh-pages
          ;;
        "data/ErikMcClure-bad-licenses")
          branch=master
          ;;
        "data/AmadeusITGroup-oscad2")
          branch=master
          ;;
        "data/OpenSourceOrg-licenses")
          branch=master
          ;;
        "data/fedora-modularity-check_modulemd")
          branch=master
          ;;
      esac

      # extract the module name
      mname=$(basename $mpath)
      # extract the referenced commit
      mcommit=$(git submodule status $mpath | grep -E "\S+" -o | head -1)
      if [[ "$mcommit" == "-"* ]]; then
        mcommit="${mcommit//-}"
      fi
      echo name: $mname
      echo commit: $mcommit

      set -x
      git submodule deinit -f $mpath # deinit the module
      git rm -r --cached $mpath # remove the module from git
      rm -rf $mpath # remove the module from the filesystem
      git commit -m "Removed $mpath submodule at commit $mcommit" # commit the change


      ./data/add_subtree.sh "$mname" "$murl" "$mcommit" "$branch"
      git commit --allow-empty -a -m "$mname update script and cleaned up" # commit any left over uncommited changes
      set +x

      echo
    fi
  done

Richard Fontana and others added 30 commits April 4, 2024 01:51
add LicenseRef-Catharon license

See merge request fedora/legal/fedora-license-data!550
public domain dedication for minicom

Closes #478

See merge request fedora/legal/fedora-license-data!548
ORT nowadays reports stand-alone exceptions as license expressions of
the form `'NOASSERTION WITH *'`.  Reflect that in `isException()`.

Signed-off-by: Frank Viernau <[email protected]>
The function is supposed to return true if and only if the single
license expression contains an exception identifier but no license
identifier, e.g. the exception is semantically stand-alone.

Signed-off-by: Frank Viernau <[email protected]>
feat(obligation_import): Add functionality to import obligations via …

Reviewed-by: [email protected]
Tested-by: [email protected]
Signed-off-by: Camille Moulin <[email protected]>
fix: various small improvements in product diplays

See merge request hermine-project/hermine!478
maxhbr added 25 commits April 22, 2024 17:57
…645b458ea8'

git-subtree-dir: data/telekom-oslic
git-subtree-mainline: 18b4e2e
git-subtree-split: a962ab6
…f79d9b1fc95a7d3ca6a64'

git-subtree-dir: data/vinland-technology-flict
git-subtree-mainline: 4a75450
git-subtree-split: 6369b65
…50b75f76ced25a9'

git-subtree-dir: data/hesa-foss-licenses
git-subtree-mainline: 153ba8f
git-subtree-split: 08d51e9
…53bfcd15b23471a13d81882edf7bd7aaf1ce'

git-subtree-dir: data/doubleopen-project-policy-configuration
git-subtree-mainline: d90c946
git-subtree-split: fe2453b
…89180758eb9e64ff7cf579aa2a'

git-subtree-dir: data/oss-review-toolkit-ort-config
git-subtree-mainline: afa72e7
git-subtree-split: 2d82f4f
…eaab0aa92954c9fd0c5e6a47b'

git-subtree-dir: data/hermine-project-hermine-data
git-subtree-mainline: 2137742
git-subtree-split: 43b8fba
…3b36f46369edbfaf'

git-subtree-dir: data/fossology-LicenseDb
git-subtree-mainline: 2747e28
git-subtree-split: c5a1a8c
…20c6a917e06133ccf530e9868bce82'

git-subtree-dir: data/McCoySmith-OSI-License-Categories
git-subtree-mainline: f0a0d71
git-subtree-split: 8b253af
Signed-off-by: Maximilian Huber <[email protected]>
@maxhbr maxhbr force-pushed the submodules_to_subtree branch from cb07631 to 97af637 Compare April 22, 2024 16:10
maxhbr added 3 commits April 22, 2024 18:23
Signed-off-by: Maximilian Huber <[email protected]>
Signed-off-by: Maximilian Huber <[email protected]>
@maxhbr maxhbr merged commit 076e4a9 into main Apr 22, 2024
2 checks passed
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.