chiark / gitweb /
git-playtree-setup: Provide to git-debpush
[dgit.git] / git-debpush
index dee358b2c43370a8fcca42b76abe85749f457642..ca737d20a97fd341dff16a10d46329b62e60dfac 100755 (executable)
@@ -38,6 +38,7 @@ set -o pipefail
 # **** Helper functions and variables ****
 
 us="$(basename $0)"
+git_playtree_create=git-playtree-create ###substituted###
 
 cleanup() {
     if [ -d "$temp" ]; then
@@ -79,6 +80,11 @@ fail_check () {
     fi
 }
 
+fail_check_upstream_nonidentical () {
+    fail_check upstream-nonidentical \
+ "the upstream source in tag $upstream_tag is not identical to the upstream source in $branch"
+}
+
 find_last_tag () {
     local prefix=$1
 
@@ -92,6 +98,23 @@ find_last_tag () {
     set -o pipefail
 }
 
+check_treesame () {
+    local first=$1
+    local second=$2
+    shift 2
+
+    set +e
+    git diff --exit-code "$first".."$second" -- . "$@"
+    git_diff_rc=$?
+    set -e
+
+    if [ $git_diff_rc -le 1 ]; then
+        return $git_diff_rc
+    else
+        fail "'git diff' exited with unexpected code $git_diff_rc"
+    fi
+}
+
 # **** Parse command line ****
 
 getopt=$(getopt -s bash -o 'nfu:' \
@@ -313,6 +336,19 @@ if ! [ "x$upstream_tag" = "x" ] \
  "upstream tag $upstream_tag is not an ancestor of $branch; probably a mistake"
 fi
 
+# ---- Upstream tag tree nonidentical
+
+case "$quilt_mode" in
+    gbp)
+        check_treesame "$upstream_tag" "$branch" ':!debian' ':!**.gitignore' \
+            || fail_check_upstream_nonidentical
+        ;;
+    unapplied)
+        check_treesame "$upstream_tag" "$branch" ':!debian' \
+            || fail_check_upstream_nonidentical
+        ;;
+esac
+
 # ---- Summary
 
 if $failed_check; then