Skip to content

Commit d8e1e3e

Browse files
committed
QL: Implement import-repositories.sh
1 parent ce3a531 commit d8e1e3e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

repo-tests/import-repositories.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
# commits relevant files from the selected repositories and stores the used commit sha in $repo.txt
7+
repos="codeql-ruby codeql codeql-go"
8+
for repo in $repos; do
9+
echo "importing $repo"
10+
rm -rf "$repo";
11+
git clone --depth 1 git@github.com:github/"$repo".git;
12+
git -C "$repo" rev-parse HEAD > "$repo.txt";
13+
# remove upgrades and tests (heuristic)
14+
find "$repo" -depth -type d \( -path "*/upgrades" -o -path "*/ql/test" \) -exec rm -rf {} \; ;
15+
# only preserve files mentioned in tools/autobuild.sh
16+
find "$repo" -type f -not \( -name "*.qll" -o -name "*.ql" -o -name "*.dbscheme" -o -name qlpack.yml \) -exec rm -f {} \; ;
17+
# remove empty directories (git does not care though)
18+
find "$repo" -type d -empty -delete;
19+
git add "$repo" "$repo.txt";
20+
git commit -m "Add $repo sources ($(tr -d '\n' < $repo.txt))";
21+
echo "done"
22+
done

0 commit comments

Comments
 (0)