This file is indexed.

/usr/bin/dom-save-patches is in dh-ocaml 1.0.8.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
set -e

PATCH_BRANCH="${PATCH_BRANCH:-patch-queue}"
GBP_CONF="${GBP_CONF:-debian/gbp.conf}"

if [ -z "$MASTER_BRANCH" ]; then
    if [ -f "$GBP_CONF" ]; then
        MASTER_BRANCH=`awk -F' *= *' '/debian-branch/{print $2}' "$GBP_CONF"`
    fi
    MASTER_BRANCH="${MASTER_BRANCH:-master}"
fi

if [ -z "$UPSTREAM_BRANCH" ]; then
    if [ -f "$GBP_CONF" ]; then
        UPSTREAM_BRANCH=`awk -F' *= *' '/upstream-branch/{print $2}' "$GBP_CONF"`
    fi
    UPSTREAM_BRANCH="${UPSTREAM_BRANCH:-upstream}"
fi

echo "Debian branch is $MASTER_BRANCH"
echo "Upstream branch is $UPSTREAM_BRANCH"

error () {
    echo "E: $1"
    exit 1
}

clean_patch () {
    mv $1 $1~
    ## Assertion: There is at least one line that matches "^-- "
    head -n `grep -n '^-- $' $1~ | tail -n1 | cut -d: -f1` $1~ > $1
    rm -f $1~
}

if [ -z "`git branch | grep -e "$PATCH_BRANCH"`" ]; then
    error "There is no branch $PATCH_BRANCH…"
else
    git checkout "$MASTER_BRANCH"

    echo "Saving patches in $MASTER_BRANCH:debian/patches/"
    mkdir -p debian/patches/
    rm -f debian/patches/*
    git format-patch -k -N -o debian/patches "$UPSTREAM_BRANCH"..."$PATCH_BRANCH" | \
        sed -e 's%debian/patches/%%' > debian/patches/series

    git branch -D "$PATCH_BRANCH"

    echo "Cleaning patches…"
    sed -i 1d debian/patches/*.patch 2>/dev/null
    ## Hackish: Remove 2 last lines
    # sed -i -n -e :a -e '1,2!{P;N;D;};N;ba' debian/patches/*.patch
    for patch in `ls -1 debian/patches/*.patch 2>/dev/null`; do
	clean_patch $patch
    done
fi