summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-03-23 16:14:27 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-03-23 16:32:54 -0700
commitce2e10580d3282d47670d52a924ccb6cd1e9ba9e (patch)
tree5b0f3fbcb9d599f89c7475abf54a3cc03bba5903 /lib
parent5a33bc49c9770be7246fc170ce5691d93353724b (diff)
downloaddotfiles-ce2e10580d3282d47670d52a924ccb6cd1e9ba9e.tar.gz
pass -p to dgit fetch
Ensures it will work if currently checked out branch does not control d/control.
Diffstat (limited to 'lib')
-rw-r--r--lib/mr/dgit20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/mr/dgit b/lib/mr/dgit
index 72a31c43..6a26d065 100644
--- a/lib/mr/dgit
+++ b/lib/mr/dgit
@@ -1,6 +1,6 @@
# A module for working with dgit(1) repositories
#
-# Copyright (C) 2017 Sean Whitton
+# Copyright (C) 2017, 2020 Sean Whitton
#
# Maintainer: Sean Whitton <spwhitton@spwhitton.name>
@@ -45,6 +45,18 @@
# Instead, we extend git_update and git_register to obtain updates
# from dgit-repos.
+# we obtain the source package name from git and pass it to dgit with
+# the latter's -p option, because the currently checked out branch may
+# not contain debian/control, which would cause dgit fetch without -p
+# to fail
+lib =
+ set_source () {
+ if [ -z "$source" ]; then
+ source=$(git cat-file blob dgit/dgit/$1:debian/control \
+ | awk -F': ' '$1 ~ /Source/ { print $2 }')
+ fi
+ }
+
# We can't use git_update_append because mr's built-in default `git
# pull` will often fail on a `dgit/SUITE` branch. After a `dgit
# clone`, (i) `dgit/SUITE` has no upstream tracking branch, and (ii)
@@ -63,15 +75,17 @@ git_update =
for suite in $(git show-ref | grep refs/remotes/dgit/dgit | cut -d/ -f5 ); do
# skip if we just called `dgit pull` on this suite
if ! [ "$current_branch" = "dgit/$suite" ]; then
- dgit fetch $suite
+ set_source $suite
+ dgit -p$source fetch $suite
fi
done
git_register_append =
lines="cd '$MR_REPO'"
for suite in $(git show-ref | grep refs/remotes/dgit/dgit | cut -d/ -f5 ); do
+ set_source $suite
echo "Registering dgit suite: $suite in $MR_CONFIG"
- lines="$lines; dgit fetch $suite"
+ lines="$lines; dgit -p$source fetch $suite"
done
if ! [ "$lines" = "cd '$MR_REPO'" ]; then
mr -c "$MR_CONFIG" config "`pwd`" post_checkout="$lines"