diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-12-21 14:55:03 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-21 14:55:03 -0800 |
commit | 49d45de1e717df76481feedcdd189b64cea1fabb (patch) | |
tree | e9b6c15c6744a9240ced758bfd1ccc083ef117b6 /t/test-lib-functions.sh | |
parent | 47021efd6feb5939b89e54c8352204d3ace5f673 (diff) | |
parent | 29401e15754518a0e63e00d6cabc5a5f2f9b0973 (diff) | |
download | git-49d45de1e717df76481feedcdd189b64cea1fabb.tar.gz |
Merge branch 'jk/index-pack-wo-repo-from-stdin'
"git index-pack --stdin" needs an access to an existing repository,
but "git index-pack file.pack" to generate an .idx file that
corresponds to a packfile does not.
* jk/index-pack-wo-repo-from-stdin:
index-pack: skip collision check when not in repository
t: use nongit() function where applicable
index-pack: complain when --stdin is used outside of a repo
t5000: extract nongit function to test-lib-functions.sh
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r-- | t/test-lib-functions.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index fdaeb3a96b..adab7f51f4 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -994,3 +994,17 @@ test_copy_bytes () { } ' - "$1" } + +# run "$@" inside a non-git directory +nongit () { + test -d non-repo || + mkdir non-repo || + return 1 + + ( + GIT_CEILING_DIRECTORIES=$(pwd) && + export GIT_CEILING_DIRECTORIES && + cd non-repo && + "$@" + ) +} |