Why does Travis git ref sometimes match my craving request?

I have a Travis-CI script that checks pull commit messages . GitHub gives it a series of commits, and it uses git log --format=online "<lastref>..<firstref>" to create a SHA list for validation.

This works great most of the time, but sometimes it happens:

My transfer request (merging branch 2.2 into 2.x, several commits) gives this command on Travis:

 git log --format=oneline b5d12909dacd80d21c4e4f4ca6d5683d6e547f9e..b349be9418371c1f694dabeccbce0e946fde3a0a 

Locally, this works as expected. I get commits in PR. On Travis, however, the b5d129 commit does not appear, and therefore it unloads each commit back to the start of the project .

What's going on here?

Update: I did another PR merge, this time with the default Travo clone depth of git 50, but also not including the new commit on 2.x. In any case, the build for this new PR worked correctly . I'm still at a dead end. The clone depth should not have any effect, because the check failed if it did not have the necessary commits.

+6
source share
1 answer

The clone depth should not have any effect, because the check failed if it did not have the necessary commits.

If the problem lies in the depth of the clone, you should understand that your last commit does not depend on all the commits that came before it. Each commit is a complete snapshot of your repository and can work independently. Even if you cloned with a depth of 1, this commit will have all the information needed to verify / build / deploy / etc, if that commit is the one pointed to by the HEAD branch. The small deltas that you see in GitHub or git show just differ between the commit you are looking at the one that was in front of it (parent-commit).

If these Pull requests contain more than 50 commits, I think the behavior you see is somewhat expected. I'm not sure that Travis allows you to set the clone depth to something higher than 50 (or disable it altogether), but I have a feeling that will solve your problem.

0
source

All Articles