git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add basic test-script for git-submodule

From
LHLars Hjemli <hjemli@gmail.com>
Date
May 30, 2007, 06:48 UTC
Message-ID
<8c5c35580705292348q74281f7eu15b3b61f45b2c6f5@mail.gmail.com>
In-Reply-To
<7v7iqs6r6p.fsf@assigned-by-dhcp.cox.net>
On 5/29/07, Junio C Hamano <junkio@cox.net> wrote:
Show 19 quoted lines
> Lars Hjemli <hjemli@gmail.com> writes:
>
> > +# create a submodule repository
> > +mkdir lib && cd lib
> > +git-init >/dev/null
> > +echo a >a && git-add a && git-commit -q -m "submodule commit 1"
> > +git-tag -a -m "rev-1" rev-1
> > +rev1=$(git-rev-parse HEAD)
> > +cd ..
> > +
> > +# add submodule and other files to super repo
> > +echo a >a && echo z >z
> > +git-add a lib z && git-commit -q -m "super commit 1"
> > +
> > +# move submodule to another location, register repo url in .gitmodules
> > +mv lib .subrepo
> > +GIT_CONFIG=.gitmodules git-config module.lib.url ./.subrepo
>
> We typically try to catch malfunction even while setting up the test case.
Ok
Show 16 quoted lines
>
> > +test_expect_success 'status is "missing"' \
> > +     'git-submodule status | grep "^-$rev1"'
> > +
> > +# make sure 'init' will not overwrite a regular file
> > +touch lib
> > +test_expect_failure 'init fails when path is used by a file' \
> > +     'git-submodule init'
>
> I am guilty for introducing "expect-failure", but it is usually
> a mistake to use it unless you are testing something very trivial.
>
> For example, for this case, you would want to make sure the
> command "git-submodule init" exits with non-zero status, but
> also you would want to make sure that it does not disturb the
> existing file "lib".

Would you prefer a patch on top of this version of the test-script or on top of the later patch which uses .git/config to store submodule url?

-- larsh

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 9 in “Add basic test-script for git-submodule”
  1. Add basic test-script for git-submoduleLars Hjemli, May 27, 2007
  2. Junio C HamanoMay 29, 2007
  3. Lars HjemliMay 30, 2007
  4. Junio C HamanoJun 1, 2007
  5. Lars HjemliJun 1, 2007
  6. Johannes SixtJun 1, 2007
  7. Lars HjemliJun 1, 2007
  8. Junio C HamanoJun 1, 2007
  9. Add basic test-script for git-submoduleLars Hjemli, Jun 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.