Hello community, here is the log from the commit of package git-test for openSUSE:Factory checked in at 2020-08-29 20:35:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/git-test (Old) and /work/SRC/openSUSE:Factory/.git-test.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "git-test" Sat Aug 29 20:35:26 2020 rev:2 rq:829695 version:1.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/git-test/git-test.changes 2016-07-14 09:44:37.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.git-test.new.3399/git-test.changes 2020-08-29 20:35:34.929294394 +0200 @@ -1,0 +2,6 @@ +Wed Aug 26 07:29:02 UTC 2020 - Dirk Mueller <dmuel...@suse.com> + +- update to 1.0.4: + * no upstream changelog available + +------------------------------------------------------------------- Old: ---- git-test-1.0.2.tar.gz New: ---- git-test-1.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ git-test.spec ++++++ --- /var/tmp/diff_new_pack.lQsa9Q/_old 2020-08-29 20:35:36.373295002 +0200 +++ /var/tmp/diff_new_pack.lQsa9Q/_new 2020-08-29 20:35:36.377295004 +0200 @@ -1,7 +1,7 @@ # # spec file for package git-test # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # Copyright (c) 2016 Michael Moese <michael.mo...@gmail.com> # # All modifications and additions to the file contributed by third parties @@ -13,20 +13,19 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: git-test -Version: 1.0.2 +Version: 1.0.4 Release: 0 Summary: Git extension to conveniently test all distinct versions License: Apache-2.0 Group: Development/Tools/Version Control -Url: https://github.com/spotify/git-test +URL: https://github.com/spotify/git-test Source: https://github.com/spotify/git-test/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Requires: git-core -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %description @@ -43,9 +42,9 @@ install -D -p -m 0644 git-test.1 %{buildroot}%{_mandir}/man1/git-test.1 %files -%defattr(-,root,root) -%doc LICENSE README.md +%license LICENSE +%doc README.md %{_bindir}/git-test -%{_mandir}/man1/git-test.1%{ext_man} +%{_mandir}/man1/git-test.1%{?ext_man} %changelog ++++++ git-test-1.0.2.tar.gz -> git-test-1.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/PKGBUILD new/git-test-1.0.4/PKGBUILD --- old/git-test-1.0.2/PKGBUILD 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/PKGBUILD 2016-08-17 16:55:07.000000000 +0200 @@ -4,9 +4,9 @@ pkgver=r48.2324a42 pkgdesc=Git extension to conveniently test all distinct versions arch=(any) -url=https://ghe.spotify.net/tools/git-test +url=https://github.com/spotify/git-test depends=(git) -source=('git-test-git::git+ssh://g...@ghe.spotify.net/tools/git-test.git') +source=('git-test-git::git+ssh://g...@github.com/spotify/git-test.git') md5sums=(SKIP) pkgver() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/README.md new/git-test-1.0.4/README.md --- old/git-test-1.0.2/README.md 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/README.md 2016-08-17 16:55:07.000000000 +0200 @@ -9,43 +9,59 @@ By default it uses heuristics to try to determine what "local commits" to test, but you can supply another ref spec. `git-test` looks at each commit and -checks the hash of the directory tree against the cache. +checks the hash of the directory tree against the cache. You can also configure +a ref (usually a branch) to test against, per repo or or per branch. -From the point of view of git-test, a test can be any shell command and a test -is considered successful if that shell command returns with a zero exit -status. This means git-test can be used both for specialised tests of a single -feature or failure mode or for running a comprehensive set of automated tests. -The cache is keyed on both directory tree and test, so it won't confuse the -unit tests with the integration tests, or a specific regression test. +From the point of view of `git-test`, a test can be any shell command and a +test is considered successful if that shell command returns with a `0` exit +status. This means `git-test` can be used both for specialised tests of a +single feature or failure mode or for running a comprehensive set of automated +tests. The cache is keyed on both directory tree and test, so it won't confuse +the unit tests with the integration tests, or a specific regression test. ## Motivation -An important design goal for git-test has been to make it convenient to use. +An important design goal for `git-test` has been to make it convenient to use. Ideally, you should have a work flow where you run your unit tests whenever you save and run unit tests on all your local commits whenever you've done something with version control. -For ease, git-test offers a few advantages over a simple for loop over a "git -rev-list": +For ease, `git-test` offers a few advantages over a simple for loop over a +`git rev-list`: - By default it spends some effort on working out which commits to test. -- Caching of results, keyed on tree contents, rather than commit. This means - that commits can be amended or reordered, but only content trees that have - never been tested before will be tested. -- Separate pre and post actions, the results of which don't actually factor - into the test result. (Useful if cleaning fails if there is nothing to - clean, for instance.) +- Cached results, which are keyed to tree contents, rather than commit. This + means that commits can be amended or reordered, but only content trees that + have never been tested before will be tested. +- Separate pre- and post-action hooks, the results of which don't actually + factor into the test result. (Useful if cleaning fails if there is nothing + to clean, for instance.) - Configuration of housekeeping and verification steps using - - git config, + - `git config`, - environment variables or - command line arguments -- Selective redo, where you trust failures but not successes, vice versa, or - trust nothing. -- Save output, both stdout and stderr from cleaning and verifying to +- Selective redo, for where you trust failures but not successes, vice versa, + or trust nothing. +- Save output (both `STDOUT` and `STDERR`) from cleaning and verifying to an easily referenced symlink farm. +## Configure + +Mostly just this: + + git config test.verify "test command that returns nonzero on fail" + +to default to testing against origin/master: + + git config test.branch origin/master + +to do the same, but for a single branch: + + git config branch.mybranch.test parentbranch + + ## Self-Test To try the test script with different shells: @@ -55,17 +71,17 @@ sh test.sh -s $sh done -Note that since version 1.0.2 the shebang is set to ```/bin/bash```. Other -shells are now supported on a "patches welcome" basis. (This is largely -because I couldn't find a shell I could run in my GNU/Linux environment that -behaves like the OSX (FreeBSD?) `sh` shell, which has very different behaviour -from all the others.) +Note that since version 1.0.2, the shebang is set to `/bin/bash`. Other shells +are now supported on a "patches welcome" basis. (This is largely because I +couldn't find a shell I could run in my GNU/Linux environment that behaves +like the OS X (FreeBSD?) `sh` shell, which has very different behaviour from +all the others.) To regression test properly: rev=$(git rev-parse --short HEAD) - cp test.sh regressions_${rev}.sh - GIT_TEST_VERIFY="sh regressions_${rev}.sh" git test -v + cp test.sh regressions_${rev}.sh + GIT_TEST_VERIFY="sh regressions_${rev}.sh" git test -v (The reason for copying the script is to test each commit against the new tests, and the reason for naming it based on the current commit is to key the @@ -74,19 +90,29 @@ ## Installation +You can just have the `git-test` script in your `PATH`, but there are other +options: + +### Homebrew (on OS X) + +If you have [Homebrew](http://brew.sh) installed, you can install +`git-test` with: + + $ brew install git-test + ### From source Aside from the packaging, you can also install from source. It's a single POSIX shell script that uses core git, so all that's required for plain `git -test` to work, besides git, of course, is that git-test needs to be somewhere -in the PATH or GIT_EXEC_PATH. +test` to work (besides git, of course) is that `git-test` needs to be +somewhere in your `PATH` (or `GIT_EXEC_PATH`). You can install from source by doing the following: $ install git-test /usr/local/bin $ install git-test.1 /usr/local/share/man1 -Or just add this directory to your PATH environment variable. +Or just add this directory to your `PATH` environment variable. ### Debian GNU/Linux @@ -94,7 +120,7 @@ $ fakeroot debian/rules binary -Should give you a Debian package +Should give you a Debian package. ### Arch Linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/all_shells.sh new/git-test-1.0.4/all_shells.sh --- old/git-test-1.0.2/all_shells.sh 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/all_shells.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -#!/bin/sh - -for sh in /bin/dash /bin/bash /bin/ksh /bin/mksh /bin/pdksh; do - echo Using $sh - $sh "$@" || exit $? -done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/debian/changelog new/git-test-1.0.4/debian/changelog --- old/git-test-1.0.2/debian/changelog 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/debian/changelog 2016-08-17 16:55:07.000000000 +0200 @@ -1,3 +1,23 @@ +git-test (1.0.4) unstable; urgency=medium + + * Fix #10: gettext compatibility issue + * Fix #13: Lock directory misbehaviours + * Fix #14: Use require_clean_work_tree + * Make verbose the default + * Fix #9: test root branch + * Explain test root feature + + -- Anders Eurenius <anders.euren...@klarna.com> Wed, 17 Aug 2016 16:20:16 +0200 + +git-test (1.0.3) unstable; urgency=medium + + * Add homebrew to install instructions + * Remove internal Spotify URLs from Arch PKGBUILD + * Fix #5: Allow file/s and branch/es with same name + * Shellcheck cleanliness + + -- Anders Eurenius <anders.euren...@klarna.com> Wed, 17 Aug 2016 16:52:00 +0200 + git-test (1.0.2) unstable; urgency=low * Set shebang to /bin/bash and explain why diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/git-test new/git-test-1.0.4/git-test --- old/git-test-1.0.2/git-test 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/git-test 2016-08-17 16:55:07.000000000 +0200 @@ -16,13 +16,13 @@ # set -e -VERSION=1.0.2 +VERSION=1.0.4 -NONGIT_OK=Yes -SUBDIRECTORY_OK=Yes -OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG=t -OPTIONS_SPEC="\ +export NONGIT_OK=Yes +export SUBDIRECTORY_OK=Yes +export OPTIONS_KEEPDASHDASH= +export OPTIONS_STUCKLONG=t +export OPTIONS_SPEC="\ git test [options] [refs...] git test --clear [refs...] @@ -72,10 +72,10 @@ mkdir -p "$cache" msg="There's a lock dir, as if there is a git-test already in progress." if ! mkdir "$cache"/testing >/dev/null 2>&1 ; then - gettext "$msg" 1>& $ERR - eval_gettext "(lock: \${cache}/testing)" 1>& $ERR + echo "$(eval_gettext "$msg")" 1>& $ERR + echo "$(eval_gettext "(lock: \${cache}/testing)")" 1>& $ERR rc=5 - exit + exit 5 fi } @@ -88,16 +88,14 @@ progress () { if [ "$1" = err ] ; then - if [ -n "$verbose" ] ; then + if [ -z "$GIT_QUIET" ] ; then printf "$CR%04d | %s | %s | " \ "$iteration" "$short" "$small" 1>& $ERR gettext "$2" 1>& $ERR fi else if [ -z "$GIT_QUIET" ]; then - if [ -n "$verbose" ] ; then - printf "$CR" 1>& $ERR - fi + printf "%s" "$CR" 1>& $ERR printf "%04d | %s | %s | " \ "$iteration" "$short" "$small" 1>& $OUT gettext "$2" 1>& $OUT @@ -107,12 +105,9 @@ } -second_word() { - echo $2 -} - tree_of_commit() { - second_word $(git cat-file -p "$1" | grep tree) + words=( $(git cat-file -p "$1" | grep tree) ) + printf "%s" "${words[1]}" } make_output_dirs() { @@ -132,13 +127,17 @@ return fi + local args="" + local branch branch="$(git symbolic-ref --short -q HEAD || true)" - if git rev-parse --symbolic-full-name '@{u}' >/dev/null 2>&1 ; then + if git config "branch.${branch}.test" >/dev/null 2>&1 ; then + args="^$(git config "branch.${branch}.test")" + elif git config "test.branch" >/dev/null 2>&1 ; then + args="^$(git config test.branch)" + elif git rev-parse --symbolic-full-name '@{u}' >/dev/null 2>&1 ; then upstream="$(git rev-parse --symbolic-full-name '@{u}')" args="^${upstream#refs/*/}" - else - args=""; fi for remote in $(git remote) ; do @@ -262,10 +261,10 @@ verification="$(echo "$verify" | git hash-object --stdin)" ver="$(git rev-parse --short "$verification")" - if [ -n "$verbose" ]; then - gettext -- "iter | commit | tree | result" + if [ -z "$GIT_QUIET" ]; then + gettext "iter | commit | tree | result" echo - gettext -- "-----|---------|---------|--------------" + gettext " ----|---------|---------|--------------" echo fi @@ -279,14 +278,14 @@ result=$(redo_check "$cache_key") if test -n "$result"; then - if test -n "$verbose"; then + if test -z "$GIT_QUIET"; then progress err "cached" progress out "$result (cached)" fi else result=$(run_test) - if test -n "$verbose"; then + if test -z "$GIT_QUIET"; then overall=$(recheck_cache "$cache_key") if [ "$result" != "$overall" ]; then @@ -303,7 +302,7 @@ link_result - iteration=$(expr $iteration + 1) + iteration=$((iteration + 1)) done } @@ -345,7 +344,6 @@ do case $1 in -v|--verbose) - verbose=true GIT_QUIET= ;; -q|--quiet) @@ -418,6 +416,7 @@ else set_reflog_action test require_work_tree_exists + require_clean_work_tree test cd_to_toplevel # Current state @@ -429,8 +428,8 @@ if test -z "$*" ; then rm -f "$cache"/*_fail "$cache"/*_pass else - refs="$(decide_refs "$@")" - commits="$(git rev-list --reverse $refs | tr "$NL" " ")" + refs=( $(decide_refs "$@") ) + commits="$(git rev-list --reverse "${refs[@]}" -- | tr "$NL" " ")" count="$(echo "$commits" | wc -w)" if test 1 -gt "$count" ; then @@ -467,25 +466,23 @@ exit 5 fi -refs="$(decide_refs "$@")" -refs="${refs% }" -commits="$(git rev-list --reverse $refs | tr "$NL" " ")" -count="$(echo "$commits" | wc -w)" +lock + +trap "atexit_cleanup" INT TERM EXIT + +refs=( $(decide_refs "$@") ) +commits=( $(git rev-list --reverse "${refs[@]}" -- | tr "$NL" " ") ) +count="$(echo "${commits[@]}" | wc -w)" if test 1 -gt "$count" ; then gettext 'List of commits to test is empty' 1>&2 exit elif test -z "$GIT_QUIET" ; then - eval_gettext "\$refs will test \$count commits -" + printf "$(eval_gettext "%s will test %d commits\n")" "${refs[*]}" "$count" fi -trap "atexit_cleanup" INT TERM EXIT - -lock - make_output_dirs -run_tests $commits +run_tests "${commits[@]}" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/git-test.1 new/git-test-1.0.4/git-test.1 --- old/git-test-1.0.2/git-test.1 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/git-test.1 2016-08-17 16:55:07.000000000 +0200 @@ -1,6 +1,6 @@ -.TH GIT-TEST "1" "September 2015" "git-test version 1.0.2" "User Commands" +.TH GIT-TEST "1" "August 2016" "git-test version 1.0.4" "User Commands" .SH "NAME" -git-test \- manual page for git-test version 1.0.2 +git-test \- manual page for git-test version 1.0.4 .SH "SYNOPSIS" git test [options] [refs...] @@ -12,7 +12,7 @@ The 99% example is simply: .IP -git test -v +git test .PP If no refs are specified, the default operation is to test the commits on the @@ -25,7 +25,7 @@ This is currently not configurable, but if you want any other ref, you can just supply it: .IP -git test -v HEAD ^jeff/development +git test HEAD ^jeff/development .PP Note that ref exclusions are almost always necessary since not having them @@ -44,7 +44,7 @@ Running with the verbose option shows progress as it happens: .IP .nf -$ git test -v +$ git test the-branch ^origin/the-branch ^origin/master will test 2 commits iter commit tree result 0000 83d611b 718c490 ... pass @@ -54,7 +54,7 @@ Immediately re-running the tests will just take the results from the cache: .IP .nf -$ git test -v +$ git test the-branch ^origin/the-branch ^origin/master will test 2 commits iter commit tree result 0000 83d611b 718c490 ... pass (cached) @@ -80,8 +80,16 @@ Alternatively, these can be set through environment variables \fBGIT_TEST_PRE\fR, \fBGIT_TEST_POST\fR and \fBGIT_TEST_VERIFY\fR respectively. + +A default ref (usually a branch) to test against can be configured: +.IP +git config test.branch origin/release +.PP +A default ref can also be set for a specific branch: +.IP +git config branch.myfeature.test origin/staging .PP -.SS "OPTIONS" +.SH "OPTIONS" Available options are .TP \fB\-v\fR, \fB\-\-verbose\fR @@ -106,7 +114,7 @@ \fB\-\-verify\fR ... the command to run as test. Overrides the environment variable GIT_TEST_VERIFY and the git-config option test.verify -.SS "ACTIONS" +.SH "ACTIONS" .TP \fB\-\-clear\fR clear the results cache @@ -158,9 +166,10 @@ commits. It is what was requested and doing anything else would likely be prohibitively expensive and very confusing. .SH "AUTHORS" -Anders Eurenius <a...@spotify.com> +Anders Eurenius <a...@eurenius.eu> .SH "COPYRIGHT" Copyright (C) 2015 Spotify AB +Copyright (C) 2016 Anders Eurenius .SH "LICENSE" Apache License 2.0 .SH "SEE ALSO" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-test-1.0.2/test.sh new/git-test-1.0.4/test.sh --- old/git-test-1.0.2/test.sh 2015-09-04 15:32:14.000000000 +0200 +++ new/git-test-1.0.4/test.sh 2016-08-17 16:55:07.000000000 +0200 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright 2014-2015 Spotify AB. All rights reserved. # @@ -15,7 +15,7 @@ # the License. # export OPTIONS_SPEC="\ -sh $0 [options] +bash $0 [options] Run tests @@ -45,7 +45,7 @@ pass=0 fail=0 -shshell=${shshell:-/bin/sh} +shshell=${shshell:-/bin/bash} total_argc=$# while [ $# != 0 ] @@ -98,16 +98,16 @@ if [ $quit -gt 0 ] && ! [ -n "$1" ]; then if [ $verb -lt 2 ]; then - echo "\n$last" + printf "\n%s\n" "$last" fi exit 5 fi } info() { - last="$@" + last="$*" if [ $verb -ge 2 ]; then - echo "$@" + printf "%s\n" "$@" fi } @@ -144,7 +144,7 @@ } setup_for_redo() { - rm -f .git/test-cache/* + rm -rf .git/test-cache/* touch .git/test-cache/${tree_a}_${ver}_pass touch .git/test-cache/${tree_b}_${ver}_pass # flappy! touch .git/test-cache/${tree_b}_${ver}_fail # @@ -357,6 +357,11 @@ grep "git-test already in progress" err >/dev/null 2>&1 ; check grep "(lock: .*.git/test-cache/testing)" err >/dev/null 2>&1 ; check +info "Re-running git-test should not remove lock dir" +$PROJECT -v -ra master >out 2>err ; check_fail +grep "git-test already in progress" err >/dev/null 2>&1 ; check +grep "(lock: .*.git/test-cache/testing)" err >/dev/null 2>&1 ; check + info "Check that selective --clear removes correct cache entries" git reset --hard long-history >out 2>err ; check git config test.verify "$verify" @@ -381,6 +386,19 @@ GIT_DIR=.git/refs $PROJECT --version >out 2>err ; check grep "Not a git repo" out err >/dev/null 2>&1 ; check_fail +info "Should not confuse files and branches" +$PROJECT --clear >/dev/null 2>&1 ; check +git checkout -b subject >/dev/null 2>&1 ; check +add_commit "x" "differentiate branches" >/dev/null 2>&1 ; check +$PROJECT -v --verify=true subject ^master >out 2>err ; check +grep "^iter.*commit.*tree.*result$" out err >/dev/null 2>&1 ; check + +info "Should refuse to run if work tree is dirty" +echo "y" > subject +$PROJECT -v -ra master >out 2>err ; check_fail +grep "Cannot test: You have unstaged changes." err >/dev/null ; check +git checkout -- subject >/dev/null 2>&1 ; check + info "TODO: check output report feature/s" if [ $verb -ge 1 ]; then