-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working on Azure Git Pipeline #13
Comments
This package looks for the It also looks like Azure Pipelines allows configuring checkout paths, which might affect the current working directory. I'm not familiar with how Azure Pipelines runs your code, so I don't know which directory it will start in, without more information. |
I switch to another utility current-git-branch which work locally and on Azure, it indicate me Azure create a detached HEAD for the pipeline, I think detached HEAD are the problem here. |
git branch | grep '\*' which actually means that
which is not diff --git a/test/test.js b/test/test.js
index bf04550..6996af4 100644
--- a/test/test.js
+++ b/test/test.js
@@ -38,4 +38,8 @@ describe('git-branch', function() {
});
});
it('should work with a git worktree', () => assert.strictEqual(branch.sync(worktreeFixtures), 'some-branch'));
+ it('should work with a detached HEAD', async () => {
+ await exec(['git', 'checkout', '--detach'].join(' '), { cwd: fixtures });
+ assert.strictEqual(branch.sync(fixtures), null)
+ });
}); |
Azure Pipelines check out detached commits, not branches, because the branch can change between pipeline runs. You can get the actual branch name with |
Hi,
git-branch return null when executed from a Azure Git Pipeline, I dont think it come from the git as there is no problem with another utility : git-last-commit
The text was updated successfully, but these errors were encountered: