- if (!is_fast_fwd $upstream, $old_head) {
- snag 'upstream-not-ancestor',
- "upstream ($upstream) is not an ancestor of HEAD";
- } else {
- my $wrong = cmdoutput
- (@git, qw(rev-list --ancestry-path), "$upstream..HEAD",
- qw(-- :/ :!/debian));
- if (length $wrong) {
- snag 'unexpected-upstream-changes',
- "history between upstream ($upstream) and HEAD contains direct changes to upstream files - are you sure this is a gbp (patches-unapplied) branch?";
- print STDERR "list expected changes with: git log --stat --ancestry-path $upstream_spec..HEAD -- :/ ':!/debian'\n";
+ if (!$bare) {
+ my $upsdiff = get_differs $upstream, $old_head;
+ if ($upsdiff & D_UPS) {
+ runcmd @git, qw(--no-pager diff --stat),
+ $upstream, $old_head,
+ qw( -- :!/debian :/);
+ fail f_ <<END, $upstream_spec, $upstream_spec;
+upstream (%s) and HEAD are not
+identical in upstream files. See diffstat above, or run
+ git diff %s HEAD -- :!/debian :/
+END
+ }
+
+ if (!is_fast_fwd $upstream, $old_head) {
+ snag 'upstream-not-ancestor',
+ f_ "upstream (%s) is not an ancestor of HEAD", $upstream;
+ } else {
+ my $wrong = cmdoutput
+ (@git, qw(rev-list --ancestry-path), "$upstream..HEAD",
+ qw(-- :/ :!/debian));
+ if (length $wrong) {
+ snag 'unexpected-upstream-changes', f_
+ "history between upstream (%s) and HEAD contains direct changes to upstream files - are you sure this is a gbp (patches-unapplied) branch?",
+ $upstream;
+ print STDERR f_ "list expected changes with: %s\n",
+ "git log --stat --ancestry-path $upstream_spec..HEAD -- :/ ':!/debian'";
+ }