@@ -489,7 +489,7 @@ do_changelog_block () {
489489 tagged_entry=" "
490490 prevtagged_entry=" "
491491
492- tagged_entry=" $( git log --pretty=" %s%n%b " --no-walk $prev_valid_tag | grep_entry | dash_trim) "
492+ tagged_entry=" $( git log --pretty=" %B " --no-walk $prev_valid_tag | grep_entry | dash_trim) "
493493 tagmsg=" $( get_tagmsg $prev_valid_tag | grep_entry | dash_trim) "
494494
495495 test -z " $tagged_entry " || ENTRIES=" $tagged_entry " ' \n' " $ENTRIES "
@@ -545,8 +545,10 @@ generate_changes () {
545545 done
546546
547547 # handle the first tag, initial point for the ref range is the parent (root) commit
548- tag=" $( git rev-list --parents --max-parents=0 $prev_valid_tag ) "
549- do_changelog_block
548+ if test -n " $prev_valid_tag " ; then
549+ tag=" $( git rev-list --parents --max-parents=0 $prev_valid_tag ) "
550+ do_changelog_block
551+ fi
550552
551553 if test -z " $CHANGESFILE " ; then
552554 CHANGESFILE=../$PACKAGE_NAME .changes
@@ -649,10 +651,10 @@ changes_to_debian () {
649651git_ls_files () {
650652
651653 # generate list of files to include in tarball
652- git ls-files -- with-tree=$SEMI_TAG | sed -e ' /^rpm\//d'
654+ git ls-files -z -- with-tree=$SEMI_TAG | sed -z -e ' /^rpm\//d'
653655
654656 # include submodules in the list
655- git submodule --quiet foreach --recursive ' git ls-files -- with-tree=$sha1 | sed s#^#$toplevel/$path/#' | sed s#^$PWD /# #
657+ git submodule --quiet foreach --recursive ' git ls-files -z -- with-tree=$sha1 | sed -z -e " s#^#$toplevel/$path/#" ' | sed -z -e " s#^$PWD /##"
656658
657659 [ -f .tarball-version ] && echo .tarball-version
658660
@@ -821,31 +823,34 @@ rpm_pkg () {
821823 if [ " x$version_fulltag_sha1sum " = " x$sha1sum " ]; then
822824 SHA=" "
823825 else
824- nbranch=" $( echo $BRANCH | sed -e ' s/-/\./g' ) "
825- count=" .$( git rev-list --abbrev-commit $TAG_NAME | wc -l) "
826- SHA=" +$nbranch$count$sha1sum "
826+ nbranch=" $( echo $BRANCH | sed -e ' s/-/\./g' ) "
827+ # count=".$(git rev-list --abbrev-commit $TAG_NAME | wc -l)"
828+ # https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Snapshot_packages
829+ # Use YYYYMMDDHHMMSS timestamps which work better in cases or rebasing
830+ ts=" .$( date --date=@$( git log --max-count=1 --pretty=%ct) +%Y%m%d%H%M%S) "
831+ SHA=" +$nbranch$ts$sha1sum "
827832 fi
828833 else
829834 # use the unique abbreviation part as it is usually incremental
830835 # in something like foobar-3-g54ab00b replace - with dot to make a legal rpm version
831836 sha1sum=$( echo $TAG_NAME | sed -e " s#$CLOSEST_TAG ##" -e " s/-/\./g" -e ' s#/#.#g' -e ' s#^#\.#' -e ' s#^\.\.#.#' )
832837 nbranch=$( echo $BRANCH | sed -e ' s/-/\./g' -e ' s#/#.#g' )
833- count=" .$( git rev-list --abbrev-commit $BRANCH | wc -l) "
838+ # count=".$(git rev-list --abbrev-commit $BRANCH | wc -l)"
839+ ts=" .$( date --date=@$( git log --max-count=1 --pretty=%ct) +%Y%m%d%H%M%S) "
834840 # get and append the short revision of the this most recent tag
835- SHA=" +$nbranch$count $sha1sum "
841+ SHA=" +$nbranch$ts $sha1sum "
836842 fi
837843
838844 fi
839845
840846 # concat version and sha
841847 VERSHA=" $VERSION$SHA "
842-
843848 # add tarball version file for some packages that use auto foo
844849 if [ -f git-version-gen ] || [ -f build-aux/git-version-gen ]; then
845850 echo -n $VERSHA > .tarball-version
846851 fi
847852
848- git_ls_files | tar --no-recursion -c --transform " s#^#$PACKAGE_NAME -$VERSHA /#S" -T - | $COMPRESS_COMMAND > $MYOUTDIR /$PACKAGE_NAME -$VERSHA .$COMPRESS_EXT
853+ git_ls_files | tar --null -- no-recursion -c --transform " s#^#$PACKAGE_NAME -$VERSHA /#S" -T - | $COMPRESS_COMMAND > $MYOUTDIR /$PACKAGE_NAME -$VERSHA .$COMPRESS_EXT
849854
850855 # add matching version to the spec file
851856 sed -i -e " s/^Version:.*$/Version: $VERSHA /g" ../$( basename $SPECFILE )
@@ -971,7 +976,7 @@ try_debian_packaging() {
971976 find_deb_package_name
972977
973978 # generate "upstream" tarball for dpkg-source to diff against
974- git_ls_files | tar --no-recursion -c --transform " s#^#${DEB_PACKAGE_NAME} -$VERSHA /#S" -T - | gzip -1 > $MYOUTDIR /${DEB_PACKAGE_NAME} _$VERSHA .orig.tar.gz
979+ git_ls_files | tar --null -- no-recursion -c --transform " s#^#${DEB_PACKAGE_NAME} -$VERSHA /#S" -T - | gzip -1 > $MYOUTDIR /${DEB_PACKAGE_NAME} _$VERSHA .orig.tar.gz
975980
976981 # update debian/changelog from git log
977982 changes_to_debian " $CHANGESFILE " > debian/changelog.git
0 commit comments