summaryrefslogtreecommitdiff
path: root/tools/linux-checkout
blob: 7097ad39d51b769fcb57465ffa4871b0cbbdbd5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash

set -eu

if [ $# -ne 1 ]; then
    echo "Usage: $0 output-directory" 1>&2
    echo
    echo "Check out a Linux development tree and populates it with typical remotes."
    exit 1
fi

OUTDIR=$1

if [ -e "$OUTDIR" ]; then
    echo "$OUTDIR already exists. Bailing out." 1>&2
    exit 1
fi

mkdir -p "$OUTDIR"

pushd "$OUTDIR"

git init --initial-branch=torvalds

git remote add torvalds https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
git remote add rust-for-linux https://github.com/Rust-for-Linux/linux.git
git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git
# Add new remotes here.

echo "Fetching all remotes. This will take a while."
git fetch --all

git merge --ff-only torvalds/master

# Reduces the size of the repo a lot.
git gc --aggressive --prune=now

popd