# Two repositories are required - how do I tell Travis?

**URL:** <https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [June 8, 2021, 1:03pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692 "2021-06-08T13:03:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdpoor](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/rdpoor/32/6696_2.png) [@rdpoor](https://travis-ci.community/u/rdpoor)\
**Post date:** [June 8, 2021, 1:03pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692/1 "2021-06-08T13:03:45Z")

</div>

For unit testing, I have two repositories:

- `mulib-support` contains the unit test files
- `mulib` contains the core source files, and is its own repo inside a subdirectory of mulib-support

When I’m manually running the unit tests, I do something along these lines:

```auto
% cd mulib-support
% git fetch && git pull
% cd mulib
% git fetch && git pull
% cd ..
% make test

```

How do I tell travis that it needs to fetch and pull `mulib` before running the tests?

## addenda

I tried writing my .travis.yml as follows:

```auto
language: c
script: (cd mulib && git fetch && git pull) && (cd mulib-test/tools && make test)

```

but that (somewhat predictably) failed with:

```auto
$ (cd mulib && git fetch && git pull) && (cd mulib-test/tools && make test)
/home/travis/.travis/functions: line 109: cd: mulib: No such file or directory
The command "(cd mulib && git fetch && git pull) && (cd mulib-test/tools && make test)" exited with 1.

```

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 8, 2021, 2:20pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692/2 "2021-06-08T14:20:44Z")

</div>

> [@How to trigger a build in the test project upon a commit to dev project with Travis CI API](https://travis-ci.community/t/how-to-trigger-a-build-in-the-test-project-upon-a-commit-to-dev-project-with-travis-ci-api/11523/2):
>
> It’ll probably be easier to make the test repo a [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) of the dev repo, or check it out manually in the build logic in the dev repo. (The practical difference is: for a submodule, the SHA of the test repo commit to check out is held statically in Git metadata in the dev repo, while if you check it out manually, you can check out whichever commit you want. On the other hand, Travis checks out submodules automatically by default and if you don’t hold the test commit info in Git metadata, you…

---

<div class="post-metadata">

**Author:** ![rdpoor](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/rdpoor/32/6696_2.png) [@rdpoor](https://travis-ci.community/u/rdpoor)\
**Post date:** [June 8, 2021, 3:39pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692/3 "2021-06-08T15:39:58Z")

</div>

@native-api: Thanks for the link. It appears that I’ll need to get comfortable with submodules.

But you can help me with one question before I go charging down the wrong path: To facilitate usage, `mulib` library is minimal by design and does not contain the unit tests. Rather, I chose to do it the other way around: `mulib-support` contains the unit tests, and conceptually owns `mulib` as a submodule (although at present it’s just a subdirectory, not a submodule).

Given that: can I assume that all the instructions you gave in [How to trigger a build in the test project upon a commit to dev project with Travis CI API - #2 by native-api](https://travis-ci.community/t/how-to-trigger-a-build-in-the-test-project-upon-a-commit-to-dev-project-with-travis-ci-api/11523/2) still apply as long as I flip the meanings of `test repo` and `dev repo`?

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 8, 2021, 4:30pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692/4 "2021-06-08T16:30:49Z")

</div>

Builds are triggered upon a commit. So to keep things simple, you want the repo whose commits you want to trigger builds to be the main repo.

---

<div class="post-metadata">

**Author:** ![rdpoor](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/rdpoor/32/6696_2.png) [@rdpoor](https://travis-ci.community/u/rdpoor)\
**Post date:** [June 8, 2021, 4:56pm UTC](https://travis-ci.community/t/two-repositories-are-required-how-do-i-tell-travis/11692/5 "2021-06-08T16:56:54Z")

</div>

Here’s how I ended up solving this (and I’m open to suggestions if it’s not stylistically appropriate):

```auto
#file: .travis.yml

language: c
script:
- git clone --depth=50 --branch=main https://github.com/you_can_guess/mulib.git mulib
- (cd mulib-test/tools && make test)

```

It seems to do all the right things: it grabs the latest `mulib` (which is very small and quick to clone) before building and running the test suite. Best of all, it finally passes! 🙂
