From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Heiko Voigt <hvoigt@hvoigt.net>,
Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 02/14] submodules: Add the lib-submodule-update.sh test library
Date: Tue, 17 Jun 2014 22:46:50 +0200 [thread overview]
Message-ID: <53A0A93A.9050305@web.de> (raw)
In-Reply-To: <xmqqwqcfl6jh.fsf@gitster.dls.corp.google.com>
Am 17.06.2014 20:44, schrieb Junio C Hamano:
> Jens Lehmann <Jens.Lehmann@web.de> writes:
>
>> Am 17.06.2014 00:49, schrieb Junio C Hamano:
>>> Jens Lehmann <Jens.Lehmann@web.de> writes:
>>>> + GIT_WORK_TREE=. git config --unset core.worktree
>>>
>>> Hmph. What does GIT_WORK_TREE=. alone without GIT_DIR=<somewhere>
>>> do? It's not like it is a workaround for "git config" that complains
>>> when you do not have a working tree, right? Puzzled...
>>
>> It is, it overrides the core.worktree config that would stop us
>> from unsetting the core.worktree config with this error message:
>>
>> fatal: Could not chdir to '../../../sub1': No such file or directory
>>
>> (We use the same pattern in git-submodule.sh and some other tests)
>
> Is this a work-around for a bug in "git config"? Or is this an
> expected failure and it is unusual and not realistic outside of test
> setup to want to unset core.worktree? I am inclined to think it is
> the latter, but I dunno.
I didn't think deeply about that, but when I first encountered
this behavior it felt a bit strange that config does a chdir into
the work tree. I somehow expected it only to access the config
file in GIT_DIR and not the work tree, but I didn't care enough
to investigate further after I found this solution.
>>>> + sha1=$(git ls-tree HEAD "sub1" 2>/dev/null | grep 160000 | tr '\t' ' ' | cut -d ' ' -f3) &&
>>>
>>> Why discard the standard error stream?
>>
>> Because we sometimes reset to commits where "sub1" isn't present:
>>
>> fatal: Path 'sub1' does not exist in 'HEAD'
>
> Huh? We shouldn't.
>
> $ git ls-tree HEAD no-such; echo $?
> 0
You are correct, it looks like I used rev-parse instead of
ls-files when producing that error.
> It discards errors that may happen in other situations, too---is
> that something we do not have to worry about?
I'll look deeper into that tomorrow. After all in some tests
"sub1" will be a file and not a submodule, and then we should
not try to populate it ...
>>>> +# Test that the given submodule at path "$1" contains the content according
>>>> +# to the submodule commit recorded in the superproject's commit "$2"
>>>> +test_submodule_content () {
>>>> + if test $# != 2
>>>> + then
>>>> + echo "test_submodule_content needs two arguments"
>>>> + return 1
>>>> + fi &&
>>>> + submodule="$1" &&
>>>> + commit="$2" &&
>>>> + test -d "$submodule"/ &&
>>>> + if ! test -f "$submodule"/.git && ! test -d "$submodule"/.git
>>>
>>> I wonder if we can get away with a single "test -e" (we do not
>>> expect us to be creating device nodes or fifos there, do we?).
>>
>> But a symbolic link maybe?
>
> Symlinks should pose no problems, ...
Oh, I forgot to add a smiley there, I haven't been serious about
that statement. I don't care too deeply about it but feel a bit
more confident with the two explicit tests. Do you want me to
change them to a single "test -e"?
next prev parent reply other threads:[~2014-06-17 20:47 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-15 16:56 [PATCH 00/14] Add submodule test harness Jens Lehmann
2014-06-15 16:57 ` [PATCH 01/14] test-lib: add test_dir_is_empty() Jens Lehmann
2014-06-16 22:05 ` Junio C Hamano
2014-06-17 16:47 ` Jens Lehmann
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-06-15 16:58 ` [PATCH 02/14] submodules: Add the lib-submodule-update.sh test library Jens Lehmann
2014-06-16 22:49 ` Junio C Hamano
2014-06-17 17:33 ` Jens Lehmann
2014-06-17 18:44 ` Junio C Hamano
2014-06-17 20:46 ` Jens Lehmann [this message]
2014-06-17 21:05 ` Junio C Hamano
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-06-20 17:31 ` Junio C Hamano
2014-07-01 21:24 ` [PATCH v3 " Jens Lehmann
2014-06-15 16:58 ` [PATCH 03/14] checkout: call the new submodule update test framework Jens Lehmann
2014-06-15 16:59 ` [PATCH 04/14] apply: add t4137 for submodule updates Jens Lehmann
2014-06-15 16:59 ` [PATCH 05/14] read-tree: add t1013 " Jens Lehmann
2014-06-15 17:00 ` [PATCH 06/14] reset: add t7112 " Jens Lehmann
2014-06-15 17:01 ` [PATCH 07/14] bisect: add t6041 " Jens Lehmann
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-06-15 17:01 ` [PATCH 08/14] merge: add t7613 " Jens Lehmann
2014-06-15 17:02 ` [PATCH 09/14] rebase: add t3426 " Jens Lehmann
2014-06-16 9:57 ` Eric Sunshine
2014-06-17 17:41 ` Jens Lehmann
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-06-15 17:02 ` [PATCH 10/14] pull: add t5572 " Jens Lehmann
2014-06-15 17:03 ` [PATCH 11/14] cherry-pick: add t3512 " Jens Lehmann
2014-06-15 17:03 ` [PATCH 12/14] am: add t4255 " Jens Lehmann
2014-06-15 17:04 ` [PATCH 13/14] stash: add t3906 " Jens Lehmann
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-06-15 17:04 ` [PATCH 14/14] revert: add t3513 " Jens Lehmann
2014-06-19 20:12 ` [PATCH v2 " Jens Lehmann
2014-07-02 14:54 ` [PATCH 00/14] Add submodule test harness Torsten Bögershausen
2014-07-02 19:57 ` Jens Lehmann
2014-07-03 5:56 ` Torsten Bögershausen
2014-07-03 21:14 ` Jens Lehmann
2014-07-07 17:05 ` Junio C Hamano
2014-07-07 19:40 ` Torsten Bögershausen
2014-07-08 19:34 ` Jens Lehmann
2014-07-08 20:25 ` Ramsay Jones
2014-07-08 21:03 ` Ramsay Jones
2014-07-09 6:39 ` No fchmod() under msygit - Was: " Torsten Bögershausen
2014-07-09 20:00 ` Eric Wong
2014-07-14 11:31 ` Erik Faye-Lund
2014-07-14 13:55 ` Nico Williams
2014-07-14 14:02 ` Nico Williams
2014-07-14 19:30 ` Karsten Blees
2014-07-14 21:18 ` Junio C Hamano
2014-07-09 6:14 ` Torsten Bögershausen
2014-07-09 15:20 ` Junio C Hamano
2014-07-09 18:19 ` Jens Lehmann
2014-07-09 19:31 ` Junio C Hamano
2014-07-10 20:52 ` Junio C Hamano
2014-07-12 18:23 ` Jens Lehmann
2014-07-14 1:01 ` Junio C Hamano
2014-07-14 18:22 ` Jens Lehmann
2014-07-14 21:18 ` Junio C Hamano
2014-07-09 17:21 ` Johannes Sixt
2014-07-09 19:22 ` Junio C Hamano
2014-07-09 19:56 ` Eric Wong
2014-07-09 21:57 ` Junio C Hamano
2014-07-10 6:22 ` No fchmd. was: " Torsten Bögershausen
2014-07-10 19:49 ` Junio C Hamano
2014-07-10 20:55 ` Torsten Bögershausen
2014-07-10 21:43 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A0A93A.9050305@web.de \
--to=jens.lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.