* [PATCH] Adjust t5510 to put remotes in config @ 2006-12-17 14:46 Johannes Schindelin [not found] ` <7v7iwox59i.fsf@assigned-by-dhcp.cox.net> 0 siblings, 1 reply; 8+ messages in thread From: Johannes Schindelin @ 2006-12-17 14:46 UTC (permalink / raw To: git, junkio Since .git/remotes/ is no longer created by default, t5510 failed. While at it, convert the tests to use the config way of specifying remotes instead of creating a file in .git/remotes/. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> --- t/t5510-fetch.sh | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index a11ab0a..6229433 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -23,20 +23,16 @@ test_expect_success "clone and setup child repos" ' git clone . two && cd two && git repo-config branch.master.remote one && - { - echo "URL: ../one/.git/" - echo "Pull: refs/heads/master:refs/heads/one" - } >.git/remotes/one + git repo-config remote.one.url ../one/.git/ && + git repo-config remote.one.fetch refs/heads/master:refs/heads/one && cd .. && git clone . three && cd three && git repo-config branch.master.remote two && git repo-config branch.master.merge refs/heads/one && - { - echo "URL: ../two/.git/" - echo "Pull: refs/heads/master:refs/heads/two" - echo "Pull: refs/heads/one:refs/heads/one" - } >.git/remotes/two + git repo-config remote.two.url ../two/.git/ && + git repo-config remote.two.fetch refs/heads/master:refs/heads/two && + git repo-config --add remote.two.fetch refs/heads/one:refs/heads/one ' test_expect_success "fetch test" ' -- 1.4.4.2.ga4be2-dirty ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <7v7iwox59i.fsf@assigned-by-dhcp.cox.net>]
* Re: [PATCH] Adjust t5510 to put remotes in config [not found] ` <7v7iwox59i.fsf@assigned-by-dhcp.cox.net> @ 2006-12-18 22:28 ` Johannes Schindelin 2006-12-18 22:42 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Johannes Schindelin @ 2006-12-18 22:28 UTC (permalink / raw To: Junio C Hamano; +Cc: git Hi, On Mon, 18 Dec 2006, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > Since .git/remotes/ is no longer created by default, t5510 failed. > > Does not reproduce for me. I just checked out a fresh copy of 'next'. It still fails. The culprit is 61dde8f91672ab362f3cfd3af8d6d09d448d4ffe, which removes the line mkdir -p "$GIT_DIR/remotes" && which is line 372 in the parent of that commit. > > While at it, convert the tests to use the config way of specifying > > remotes instead of creating a file in .git/remotes/. > > I think adding tests to use config is good, but I'd rather see > the test scripts to test not _only_ config but both. Okay. How about fixing the first hunk as proposed, and the second by 'mkdir .git/remotes'? Ciao, Dscho ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 22:28 ` Johannes Schindelin @ 2006-12-18 22:42 ` Junio C Hamano 2006-12-18 22:47 ` Johannes Schindelin 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2006-12-18 22:42 UTC (permalink / raw To: git Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > Hi, > > On Mon, 18 Dec 2006, Junio C Hamano wrote: > >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: >> >> > Since .git/remotes/ is no longer created by default, t5510 failed. >> >> Does not reproduce for me. > > I just checked out a fresh copy of 'next'. It still fails. The culprit is > 61dde8f91672ab362f3cfd3af8d6d09d448d4ffe, which removes the line > > mkdir -p "$GIT_DIR/remotes" && > > which is line 372 in the parent of that commit. Hmmmmm. But git-clone runs git-init-db and we ship an empty remotes directory still as part of the templates. Why would removal of that line matter? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 22:42 ` Junio C Hamano @ 2006-12-18 22:47 ` Johannes Schindelin 2006-12-18 22:49 ` Johannes Schindelin 0 siblings, 1 reply; 8+ messages in thread From: Johannes Schindelin @ 2006-12-18 22:47 UTC (permalink / raw To: Junio C Hamano; +Cc: git Hi, On Mon, 18 Dec 2006, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > Hi, > > > > On Mon, 18 Dec 2006, Junio C Hamano wrote: > > > >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > >> > >> > Since .git/remotes/ is no longer created by default, t5510 failed. > >> > >> Does not reproduce for me. > > > > I just checked out a fresh copy of 'next'. It still fails. The culprit is > > 61dde8f91672ab362f3cfd3af8d6d09d448d4ffe, which removes the line > > > > mkdir -p "$GIT_DIR/remotes" && > > > > which is line 372 in the parent of that commit. > > Hmmmmm. > > But git-clone runs git-init-db and we ship an empty remotes > directory still as part of the templates. Why would removal of > that line matter? I don't install templates. Ever. I want to be sure that nothing slips in by mistake, and so I install hooks manually. Ciao, Dscho ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 22:47 ` Johannes Schindelin @ 2006-12-18 22:49 ` Johannes Schindelin 2006-12-18 22:58 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Johannes Schindelin @ 2006-12-18 22:49 UTC (permalink / raw To: Junio C Hamano; +Cc: git Hi, On Mon, 18 Dec 2006, Johannes Schindelin wrote: > I don't install templates. Ever. I want to be sure that nothing slips in > by mistake, and so I install hooks manually. Side note: prior to installing the tests would fail anyway, no? Ciao, Dscho ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 22:49 ` Johannes Schindelin @ 2006-12-18 22:58 ` Junio C Hamano 2006-12-18 23:27 ` Junio C Hamano 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2006-12-18 22:58 UTC (permalink / raw To: Johannes Schindelin; +Cc: git Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > On Mon, 18 Dec 2006, Johannes Schindelin wrote: > >> I don't install templates. Ever. I want to be sure that nothing slips in >> by mistake, and so I install hooks manually. > > Side note: prior to installing the tests would fail anyway, no? They shouldn't. At least the intent was to make the tests read from $SRCDIR/templates/blt/ as the source of templates. But maybe you spotted a bug in t/test-lib.sh; I don't know without digging. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 22:58 ` Junio C Hamano @ 2006-12-18 23:27 ` Junio C Hamano 2006-12-19 8:18 ` Johannes Schindelin 0 siblings, 1 reply; 8+ messages in thread From: Junio C Hamano @ 2006-12-18 23:27 UTC (permalink / raw To: Johannes Schindelin; +Cc: git Junio C Hamano <junkio@cox.net> writes: > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > >> On Mon, 18 Dec 2006, Johannes Schindelin wrote: >> >>> I don't install templates. Ever. I want to be sure that nothing slips in >>> by mistake, and so I install hooks manually. >> >> Side note: prior to installing the tests would fail anyway, no? > > They shouldn't. At least the intent was to make the tests read > from $SRCDIR/templates/blt/ as the source of templates. > > But maybe you spotted a bug in t/test-lib.sh; I don't know > without digging. Indeed it appears to be the case. I am thinking about applying this patch to fix it. -- >8 -- fix testsuite: make sure they use templates freshly built from the source The initial t/trash repository for testing was created properly but over time we gained many tests that create secondary test repositories with init-db or clone and they were not careful enough. This fixes it. Signed-off-by: Junio C Hamano <junkio@cox.net> --- diff --git a/t/test-lib.sh b/t/test-lib.sh index ac7be76..7e91497 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -182,6 +182,16 @@ test_create_repo () { cd "$owd" } +# Many tests do init-db and clone but they must be told about the freshly +# built templates. +git_init_db () { + git init-db --template="$GIT_EXEC_PATH/templates/blt/" "$@" +} + +git_clone () { + git clone --template="$GIT_EXEC_PATH/templates/blt/" "$@" +} + test_done () { trap - exit case "$test_failure" in diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh index 74f5c2a..a79c77a 100755 --- a/t/t4116-apply-reverse.sh +++ b/t/t4116-apply-reverse.sh @@ -50,12 +50,12 @@ test_expect_success 'setup separate repository lacking postimage' ' git tar-tree initial initial | tar xf - && ( - cd initial && git init-db && git add . + cd initial && git_init_db && git add . ) && git tar-tree second second | tar xf - && ( - cd second && git init-db && git add . + cd second && git_init_db && git add . ) ' diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index de45ac4..8a8152b 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -44,7 +44,7 @@ test_expect_success \ 'unpack without delta' \ "GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && - git-init-db && + git_init_db && git-unpack-objects -n <test-1-${packname_1}.pack && git-unpack-objects <test-1-${packname_1}.pack" @@ -75,7 +75,7 @@ test_expect_success \ 'unpack with delta' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && - git-init-db && + git_init_db && git-unpack-objects -n <test-2-${packname_2}.pack && git-unpack-objects <test-2-${packname_2}.pack' @@ -100,7 +100,7 @@ test_expect_success \ 'use packed objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && - git-init-db && + git_init_db && cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && { git-diff-tree --root -p $commit && while read object diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 28744b3..901da8c 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -24,7 +24,7 @@ test_expect_success setup ' parent=$commit || return 1 done && git-update-ref HEAD "$commit" && - git-clone -l ./. victim && + git_clone -l ./. victim && cd victim && git-log && cd .. && diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index f7625a6..61e2a55 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -97,7 +97,7 @@ pull_to_client () { ( mkdir client && cd client && - git-init-db 2>> log2.txt + git_init_db 2>> log2.txt ) add A1 diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index a11ab0a..e2e8c89 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -15,12 +15,12 @@ test_expect_success setup ' git commit -a -m original' test_expect_success "clone and setup child repos" ' - git clone . one && + git_clone . one && cd one && echo >file updated by one && git commit -a -m "updated by one" && cd .. && - git clone . two && + git_clone . two && cd two && git repo-config branch.master.remote one && { @@ -28,7 +28,7 @@ test_expect_success "clone and setup child repos" ' echo "Pull: refs/heads/master:refs/heads/one" } >.git/remotes/one cd .. && - git clone . three && + git_clone . three && cd three && git repo-config branch.master.remote two && git repo-config branch.master.merge refs/heads/one && @@ -74,7 +74,7 @@ test_expect_success 'fetch following tags' ' mkdir four && cd four && - git init-db && + git_init_db && git fetch .. :track && git show-ref --verify refs/tags/anno && diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index f841574..66ef92f 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -17,7 +17,7 @@ test_expect_success setup ' test_expect_success 'pulling into void' ' mkdir cloned && cd cloned && - git init-db && + git_init_db && git pull .. ' diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh index 041be04..1913a12 100755 --- a/t/t5600-clone-fail-cleanup.sh +++ b/t/t5600-clone-fail-cleanup.sh @@ -13,7 +13,7 @@ remove the directory before attempting a clone again.' test_expect_failure \ 'clone of non-existent source should fail' \ - 'git-clone foo bar' + 'git_clone foo bar' test_expect_failure \ 'failed clone should not leave a directory' \ @@ -29,11 +29,11 @@ test_create_repo foo # current path not to the target dir test_expect_failure \ 'clone of non-existent (relative to $PWD) source should fail' \ - 'git-clone ../foo baz' + 'git_clone ../foo baz' test_expect_success \ 'clone should work now that source exists' \ - 'git-clone foo bar' + 'git_clone foo bar' test_expect_success \ 'successfull clone must leave the directory' \ diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index dd9caad..52dab2d 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -17,7 +17,7 @@ git commit -m initial' cd "$base_dir" test_expect_success 'preparing second repository' \ -'git clone A B && cd B && +'git_clone A B && cd B && echo second > file2 && git add file2 && git commit -m addition && @@ -27,7 +27,7 @@ git prune' cd "$base_dir" test_expect_success 'cloning with reference' \ -'git clone -l -s --reference B A C' +'git_clone -l -s --reference B A C' cd "$base_dir" diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index b9f6d96..3c43554 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -34,7 +34,7 @@ git prune' cd "$base_dir" test_expect_success 'preparing second repository' \ -'git clone -l -s A B && cd B && +'git_clone -l -s A B && cd B && echo "foo bar" > file2 && git add file2 && git commit -m "next commit" file2 && @@ -44,7 +44,7 @@ git prune' cd "$base_dir" test_expect_success 'preparing third repository' \ -'git clone -l -s B C && cd C && +'git_clone -l -s B C && cd C && echo "Goodbye, cruel world" > file3 && git add file3 && git commit -m "one more" file3 && @@ -54,11 +54,11 @@ git prune' cd "$base_dir" test_expect_failure 'creating too deep nesting' \ -'git clone -l -s C D && -git clone -l -s D E && -git clone -l -s E F && -git clone -l -s F G && -git clone -l -s G H && +'git_clone -l -s C D && +git_clone -l -s D E && +git_clone -l -s E F && +git_clone -l -s F G && +git_clone -l -s G H && cd H && test_valid_repo' diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 2f4ff82..ae597e8 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -88,7 +88,7 @@ test_expect_success \ test_expect_success "Michael Cassar's test case" ' rm -fr .git papers partA && - git init-db && + git_init_db && mkdir -p papers/unsorted papers/all-papers partA && echo a > papers/unsorted/Thesis.pdf && echo b > partA/outline.txt && @@ -109,7 +109,7 @@ rm -fr papers partA path? test_expect_success "Sergey Vlasov's test case" ' rm -fr .git && - git init-db && + git_init_db && mkdir ab && date >ab.c && date >ab/d && ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Adjust t5510 to put remotes in config 2006-12-18 23:27 ` Junio C Hamano @ 2006-12-19 8:18 ` Johannes Schindelin 0 siblings, 0 replies; 8+ messages in thread From: Johannes Schindelin @ 2006-12-19 8:18 UTC (permalink / raw To: Junio C Hamano; +Cc: git Hi, On Mon, 18 Dec 2006, Junio C Hamano wrote: > fix testsuite: make sure they use templates freshly built from the source Okay. But why not introduce the environment variable GIT_TEMPLATE_DIR, to imitate similar solutions. This would result in a smaller diff, and people would not have to remember typing "git_init_db" in tests (I admit, I did not spot the subtle difference right away, and thought they were white-space fixes...). I.e. something like this instead: -- [PATCH] Introduce GIT_TEMPLATE_DIR Instead of passing --template explicitely to init-db and clone, you can just set the environment variable GIT_TEMPLATE_DIR. Also make use of it in the tests, to make sure that the templates are copied. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> --- builtin-init-db.c | 7 +++++-- t/test-lib.sh | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/builtin-init-db.c b/builtin-init-db.c index fa70baa..85cd4d9 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -124,8 +124,11 @@ static void copy_templates(const char *git_dir, int len, const char *template_di int template_len; DIR *dir; - if (!template_dir) - template_dir = DEFAULT_GIT_TEMPLATE_DIR; + if (!template_dir) { + template_dir = getenv("GIT_TEMPLATE_DIR"); + if (!template_dir) + template_dir = DEFAULT_GIT_TEMPLATE_DIR; + } strcpy(template_path, template_dir); template_len = strlen(template_path); if (template_path[template_len-1] != '/') { diff --git a/t/test-lib.sh b/t/test-lib.sh index ac7be76..f0f9cd6 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -208,8 +208,9 @@ test_done () { # t/ subdirectory and are run in trash subdirectory. PATH=$(pwd)/..:$PATH GIT_EXEC_PATH=$(pwd)/.. +GIT_TEMPLATE_DIR=$(pwd)/../templates/blt HOME=$(pwd)/trash -export PATH GIT_EXEC_PATH HOME +export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-12-19 8:18 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-12-17 14:46 [PATCH] Adjust t5510 to put remotes in config Johannes Schindelin [not found] ` <7v7iwox59i.fsf@assigned-by-dhcp.cox.net> 2006-12-18 22:28 ` Johannes Schindelin 2006-12-18 22:42 ` Junio C Hamano 2006-12-18 22:47 ` Johannes Schindelin 2006-12-18 22:49 ` Johannes Schindelin 2006-12-18 22:58 ` Junio C Hamano 2006-12-18 23:27 ` Junio C Hamano 2006-12-19 8:18 ` Johannes Schindelin
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).