Circle thinks master == HEAD on a branch

git
2.0

#1

We’re using a monorepo setup and I’m trying to list all the top level directories that have changed.

There is a recommendation online to compare git diffs and get the dirs from that, but it only checks the last commit. We need to check all commits since the branch diverged from master.

I have git diff --name-only HEAD..master | grep '/' | cut -d'/' -f1 | sed '/^\.circleci$/d' | uniq which works on my local machine. But on circle they are seen as the same thing and therefore there is no diff.

Why is this and is there a way to get around it?


#2

As a Circle build starts up, I think checkout gets converted to a long Git command, which you can see in build output. I suspect you need to drop that command and use your own.


#3

@halfer Thanks!

That was correct, seems to be circle masking the branch somehow - not sure how.

I just did a simple git clone and checkout instead and we’re fine.


#4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.