Closed JenniferHem closed 5 months ago
That's expected because exp run
runs in a detached head, so there is no active branch.
You can try getting last commit using:
import pygit2
repo = pygit2.Repository(".")
print(repo.head.raw_target)
Thanks and sorry for that. Is there any detailed Information where I can read up on that to understand DVC better?
Bug Report
Description
I have a custom script to compare loads of differences between HEAD and the last commit. To to this I am using pygit2 to get the repo, branch and then the last commit. This works as expected when I use dvc repro, however fails with dvc exp run.
Reproduce
1) create new git repo and use dvc init 2) create python script as test.py:
3) commit the script 4) create dvc yaml:
5) run
dvc repro
--> there is no error6) run
dvc exp run
--> the script fails withAttributeError: 'NoneType' object has no attribute 'target'
Expected
I would expect that also with dvc exp run I am able to get the full information about git in the current repository (i.e. Branch, comits etc)
Environment information
WSL2 with Ubuntu 22.04 LTS git version 2.34.1 VSCode (but happens in Terminal and VSCode Terminal)
Output of
dvc doctor
: