mkdir /var/tmp/build_neovim-nightly

cd /var/tmp/build_neovim-nightly || exit
GIT_VERSION="release-0.9"

git clone --depth 1 -b ${GIT_VERSION} https://github.com/neovim/neovim neovim-0.9
cd neovim-0.9 || exit

mkdir -p debian

cat >debian/gbp.conf <<EOF
[DEFAULT]
pristine-tar = True
debian-branch = master
debian-tag = v%(version)s

[dch]
full = True
git-author = True

[pq]
patch-num-format = PATCH-%04d-

[import-orig]
merge-mode = replace
EOF

cat >debian/watch <<EOF
version=3
#opts=filenamemangle=s/.*v([0-9.]+)\.tar\.gz/neovim-$1.tar.gz/ \
#http://github.com/neovim/neovim/releases/download/nightly/ (?:.*/)?v([0-9.]+)\.tar\.gz
http://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
EOF

# gbp import-dsc --git-debian-branch=debian/master \
#         --git-upstream-branch=upstream/latest /path/to/dsc

# gbp import-orig --git-debian-branch=debian/master \
#         --git-upstream-branch=upstream/latest /path/to/upstream/tarball

gbp import-orig --uscan
