Commit Briefs

Thomas Adam

replace "(cd path && git cmd)" with "git -C path cmd"

This matches the existing use of "got -r path cmd" and "git_commit path args".


Thomas Adam

regress: nix 'set -A' kshism from tests

As reported by naddy, this is a non-portable Korn shell construct. Instead, use the one argument array then make faux space-delimited string "arrays" for the other ids; they can still be indexed with pop_idx. improved by + ok naddy@


Thomas Adam

implement support for keywords as got <commit> arguments

This begins enabling the use of keywords in got wherever commit ids or references are used, with more work intended to expand support across all such instances (e.g., branch, checkout, etc.), and add more keywords. The keywords ":base" and ":head" can be passed to 'got {diff,log,update} -c' commands as a substitute for the corresponding commit hash id. Keywords and references can also be modified by appending a ':+' or ':-' and an optional integer N to specify by first parent traversal the Nth generation descendant or antecedent, respectively. If N is omitted, a '1' is implicitly appended. tweaks + ok op and stsp


Thomas Adam

consistently use ten Xs in mkstemp(3) templates

patch from Josiah Frentsos, thanks!


Thomas Adam

make diffing files which changed into dirs and vice-versa possible

Problem marked with a TODO comment by me ages ago and rediscovered by naddy@ ok op@


Thomas Adam

portable: regress: remove sed wrapper

Now that the use of sed(1) in tests has been replaced with ed(1), the sed wrapper can be retired. There are existing tests which use sed, but they're modifying a stream, rather than using -i, so there's no portability concerns.


Thomas Adam

portable: regress: improve date wrapper

When looking for a suitable date wrapper, don't use the platform name, and rather use date(1)'s own parsing to choose BSD date, or gdate (GNU). Additionally, only declare the date() wrapper once. From Christian "naddy" Weisgerber


Thomas Adam

regress: override locale settings

ok stsp


Thomas Adam

portable: regress: drop GNU date on *BSDs

Check if date(1) supports -r and fallback to gdate if that fails, via a shell-wrapper. From Christian "naddy" Weisgerber.


Thomas Adam

portable: remove ln(1) wrapper

GNU Coreutils is wrapped for some commands which don't offer a portable means to run those commands on non-BSD systems. ln(1) was being used with a non-portable option (-h) which has now been replaced upstream. Therefore, we can remove this wrapper. Patch from Christian "naddy" Weisgerber.


Thomas Adam

regress: run gotadmin pack -D if $GOT_TEST_PACK=ref-delta

ok stsp


Thomas Adam

regress: allow to run only a subset of the test cases

This allows to run only the test cases named on the command line.



Thomas Adam

regress: strip trailing / from GOT_TEST_ROOT

otherwise most test fails because of double "/" ending in paths and tricking some check into thinking that's failed. ok jamsek stsp


Thomas Adam

use GOT_IGNORE_GITCONFIG in regress

fixes test_rebase_no_author_info when a valid ~/.gitconfig is found. ok stsp@


Thomas Adam

portable: regress: fix sed parsing

When making sed's command-line flags portable, don't split on $@ before parsing it, as this won't preserve the original string which needs passing to sed unmodified if it's never had to be changed.


Thomas Adam

portable: regress: improve sed handling

When massaging sed command strings, to handle the differences between "-i ''" not meaning the same thing on non-BSD systems, this previously used a bashism to determine the positional arguments. Instead, defer to using a loop which doesn't rely on bashisms.


Thomas Adam

portable: regress: remove backticks from string

Remove erroneously-placed backticks when describing a lack of GNU coreutils.


Thomas Adam

portable: regress: make OS-detection sh-compatible

Don't rely on $OSTYPE being available, which it isn't in strict POSIX mode. Ubuntu's sh is often alised to dash, and hence this fails. Instead, default to using the output from 'uname'.


Thomas Adam

portable: regress: harden coreutils check

When running tests on non-Linux systems, it was just assumed that GNU coreutils had been installed. This meant that the wrapper commands for date/ln on those systems always had gdate and gln installed. Rather than assume that, check to see if the GNU coreutils versions as present, and if not echo a warning.


Thomas Adam

portable: regress: set PLATFORM when running direct

PLATFORM is populated when running via `./configure && make` but this isn't guaranteed if an individual test is run directly, such as `regress/cmdline/tag.sh`. In such cases, PLATFORM will be empty, but we still want to use it. Since we test for non-linux values, only set PLATFORM if we're running on Linu so that the correct commands are used.


Thomas Adam

use test(1) -eq and -ne to compare integers, and reduce quoting

This brings the rest of the regression test scripts in line with patch.sh.


Thomas Adam

portable: regress: improve sed "-i ''" on linux

GNU sed doesn't like "-i ''" which on BSD means to not keep backups around. Scan for "-i ''" and replace with just "-i" which will use the filename given to sed just fine.



Thomas Adam

portable: running tests when shell is dash

Ubuntu's default shell is dash, when using /bin/sh. The portable nature of got is such that "$OSTYPE" to determine the host type (linux, bsd, etc.) is bash-specific and is not part of POSIX. autotools already provide a mechanism for determining the underlying platform type, and PLATFORM is already a subst value. Therefore, let the -portable parts of the regress test-suite use $PLATFORM to look at the underlying OS type. The tests themselves already expect /bin/sh to be POSIX-compliant in all other areas, so there should be no need to change the #! lines.