X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tests%2Ftests%2Fgdr-newupstream;h=30396691912872c8fd03cf91c9a4c942c5981379;hb=9a5b14f4294318b8f11871ab5aad6d5afd849e0a;hp=d72971a8dd6443b9655f66f34796fc671e94d3ac;hpb=27ecf86e831ab5a4908a2d0541e0e987e39da48e;p=dgit.git diff --git a/tests/tests/gdr-newupstream b/tests/tests/gdr-newupstream index d72971a8..30396691 100755 --- a/tests/tests/gdr-newupstream +++ b/tests/tests/gdr-newupstream @@ -28,19 +28,32 @@ git tag v2.1 upstream git branch before-new-upstream +clog-check-1 () { + before=$1 + date=$(git log --format=%aD -n1 debian/changelog) + date=$(date -R -d "$date") + git show $before:debian/changelog >../clog.before + m=" * Update to new upstream version ${v%-*}." + e="dgit test git user $date" +} +clog-check-2 () { + diff -u ../clog.expected debian/changelog +} + +: ----- ordinary new upstream test ----- + t-git-debrebase new-upstream ${v%-*} -date=$(git log --format=%aD -n1 debian/changelog) -cat >../clog.expected <../clog.expected example ($v) UNRELEASED; urgency=medium - * Update to new upstream version ${v%-*}. +$m - -- dgit test git user $date + -- $e END -git show before-new-upstream:debian/changelog >>../clog.expected -diff -u ../clog.expected debian/changelog +clog-check-2 t-gdr-good laundered git reflog | egrep 'debrebase new-upstream.*checkout' @@ -50,9 +63,9 @@ t-gdr-good stitched git branch ordinary -: 'with --anchor' +: ----- 'with --anchor' ----- -git reset --hard startpoint +git checkout -b with-anchor startpoint t-git-debrebase analyse >../anal.anch anchor=$(perl <../anal.anch -ne ' @@ -72,4 +85,25 @@ t-gdr-good stitched git diff --quiet ordinary +: ----- with pre-existing changes ----- + +git checkout -b with-preexisting before-new-upstream + +t-dch-commit drivel-in-changelog +git branch before-new-upstream-with-changes + +t-git-next-date + +t-git-debrebase new-upstream ${v%-*} + +clog-check-1 before-new-upstream-with-changes +perl -pe <../clog.before >../clog.expected ' + BEGIN { ($m,$e,@ARGV) = @ARGV; } + next unless 1..m/^ --/; + s/\([^()]+\)/('$v')/ if m/^example /; + $_ .= "$m\n" if m/^ \* drivel-in-changelog/; + $_ = " -- $e\n" if m/^ -- /; +' "$m" "$e" +clog-check-2 + t-ok