Commit afb6ced9 authored by Cyril Brulebois's avatar Cyril Brulebois

Add xsf-remote-add-upstream script.

parents
#!/bin/sh
set -e
if [ ! -d debian ]; then
echo "E: Missing debian/ directory."
exit 1
fi
for i in debian/watch*; do
echo "I: Processing $i"
case "$i" in
debian/watch)
remote_name=upstream
;;
debian/watch.*)
remote_name=upstream-${i##debian/watch.}
;;
*)
echo "E: Unexpected watch file name: $i"
continue
esac
echo "I: Remote name: $remote_name"
if git remote|grep -qs "\<$remote_name\>"; then
echo "I: Skipped (already exists)"
echo
continue
fi
remote_url=$(perl -ne 'print $1 if /^\s*#\s*git\s*=\s*(.*)$i/' < $i)
if [ -z "$remote_url" ]; then
echo "I: No remote URL detected"
continue
fi
echo "I: Remote URL : $remote_url"
git remote add $remote_name $remote_url
echo "I: Added"
echo
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment