# Flag -N to set the base report does not work

**URL:** <https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973>\
**Category:** Bug Fixes\
**Created:** [February 5, 2020, 2:17pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973 "2020-02-05T14:17:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolgalan](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/rolgalan/32/527_2.png) [@rolgalan](https://community.codecov.com/u/rolgalan)\
**Post date:** [February 5, 2020, 2:17pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/1 "2020-02-05T14:17:10Z")

</div>

### Description

We have several issues with codecov trying to guess the base commit to compare against, so we decided to use the `-N` flag to tell it ourselves.

I’ve seen several other people having the base report problem ([one](https://community.codecov.com/t/false-coverage-reports/381), [two](https://community.codecov.com/t/codecov-showing-impossible-drops-in-coverage/932), [three](https://community.codecov.com/t/comparing-report-to-a-wrong-commit-causes-no-report-found-to-compare-against-error/936)). All suggestions to fix this are using the `-N` flag… but we cannot make it work.

We first had an issue with codecov identifying the head commit, [but we solved it](https://github.com/codecov/codecov-bash/issues/137) by using the `-C` flag. This one works fine. We tried doing the same with `-N`, but unsuccessfully.

Codecov bash script is properly setting the parent parameter when uploading the reports to codecov… but the report I see is wrongly using the incorrect parent, and not the one provided.

### Repository

Private repo

### Steps to Reproduce

1. Create a branch `feature` from a base branch `develop`
2. Commit anything into base branch `develop`
3. Open a pull request from “delayed” branch `feature`
4. Configure your CI to do a virtual merge on the `feature` with recent `develop` changes
5. Run your tests on this virtual merge (I call it virtual, because is not pushed)
6. Since codecov is not picking correctly the base commit to compare, find it yourself and provide it with `-N`

**Expected behavior:** Get the report comparing against the commit passed with `-N`

**Actual behavior:** The report is comparing about whatever codecov script picks without the parameter

**Flakiness?** Always

### Versions

Github and jenkins. Using the bash uploader.  
We allow outdated PRs, but have the `Merging the pull request with the current target branch revision` enabled.

### Additional Information

Let me show a git tree to visualize better the problem.

```auto
* 5555 Virtual Merge commit develop into feature branch
|\  
| * 0022 Latest develop commit  
| * 0011 Another develop commit
* | 1122 Second commit on feature branch
* | 1111 First commit on feature branch
|/   
* 0000 First develop commit

```

We have a base commit 0000 in develop branch.  
We create a branch feature from there and push two commits, 1111 and 1122. The head of the branch is 1122 and this is the commit we want to bind the report. We use -C to tell this to the bash codecov script.  
While we open our PR, other developer pushes two more commits to develop: 0011 and 0022. The head of develop is 0022.

Now, we would like to compare our test report with develop. If we do nothing, codecov picks 0000, which is outdated, producing a fake and useless report.

If we tell bash codecov script to use 0022 with `-N` flag to have the most updated develop version… codecov ignores us ☹

#### Console output

> curl -s `codecov.io/bash` | bash -s – -t token -C 1122 -N 0022  
> [… ignoring …]  
> ==\> Gzipping contents  
> ==\> Uploading reports  
> url: `codecov.io`
> 
> query: parent=0022&branch=PR-1206&commit=1122&build=24&build\_url=ignore&name=&tag=&slug=ignore&service=jenkins&flags=&pr=1206&job=
> 
> → Pinging Codecov
> 
> `codecov.io/upload/v4?package=ignore&token=secret&parent=0022&branch=PR-1206&commit=1122&build=24&build_url=ignore&name=&tag=&slug=ignore&service=jenkins&flags=&pr=1206&job=`
> 
> → Uploading
> 
> → View reports at `codecov.io/github/company/commit/1122`

Up to here it looks ok… but when I open the report, it’s comparing with the wrong commit 000 instead!

### Appreciation

Thanks!

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [February 5, 2020, 7:25pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/2 "2020-02-05T19:25:36Z")

</div>

Hi @rolgalan

I apologize, there was some confusion about how `-N` works, including myself, so I’ve given out some bad information.

The `-N` flag allows you to set the `parent` commit, not the `base` commit, as I believed. This means it’s not helpful in overriding our automatic PR `base` picking system.

I believe the alibity to override this is a feature request at this point, I am double-checking with product and engineering to see if there is a current way about this.

---

<div class="post-metadata">

**Author:** ![rolgalan](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/rolgalan/32/527_2.png) [@rolgalan](https://community.codecov.com/u/rolgalan)\
**Post date:** [February 5, 2020, 8:25pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/3 "2020-02-05T20:25:09Z")

</div>

Hi @drazisil!

But the parent of what? What would be the purpose of setting a parent commit if is not to be used as the base report? 🤔

I understood exactly the same thing when read the documentation of the bash script.

> <https://github.com/codecov/codecov-bash/blob/e06ebeaf72bab0bb22ab46215e6fa7cae85c7fc8/codecov#L129>

Thanks for your answer, really curious to know if there is other way to provide this.

---

<div class="post-metadata">

**Author:** ![drazisil](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/drazisil/32/496_2.png) [@drazisil](https://community.codecov.com/u/drazisil)\
**Post date:** [February 5, 2020, 8:29pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/4 "2020-02-05T20:29:55Z")

</div>

The parent of the commit being uploaded. I’m very fuzzy on the use case of this, myself, It’s apparently helpful in very large and complex high-speed pipelines where the commits may change faster then GitHub can keep up.

I totally thought it was PR base picking ☹

Will let you know if I find a solution.

---

<div class="post-metadata">

**Author:** ![scott](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/scott/32/523_2.png) [@scott](https://community.codecov.com/u/scott)\
**Post date:** [February 14, 2020, 10:28pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/5 "2020-02-14T22:28:29Z")

</div>

I also need this functionality and added it to the feature request section. [Set base commit](https://community.codecov.com/t/set-base-commit/1014)

---

<div class="post-metadata">

**Author:** ![jerrod](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/jerrod/32/41_2.png) [@jerrod](https://community.codecov.com/u/jerrod)\
**Post date:** [May 19, 2020, 5:48pm UTC](https://community.codecov.com/t/flag-n-to-set-the-base-report-does-not-work/973/6 "2020-05-19T17:48:37Z")

</div>

Hey y’all, just clarifying a couple things for this thread and all future readers.

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/1X/0120c4f829ff753440a04278b79a57d962d313a7.jpeg)

1.) We have a feature to manually pick parents of commits [(docs)](https://docs.codecov.io/changelog/release-notes-for-codecov-v4410#manual-parent-picking-override)

2.) We do _not_ have a feature to manually pick base of a PR.

3.) Codecov will always pick the base of the PR as where the branch happened (or prior). If you want to have the _head_ of master as a comparison:

At that point, the only way to get this to work would be merge master into the feature branch so the head commit of master becomes the base commit of the feature branch.

Codecov should correctly show the diff of the feature branch with master merged into it.

Let me know any questions!

Jerrod
