mlarhrouch / azure-pipeline-gpt-pr-review

Azure DevOps extension adding tools to review Pull Requets using Azure Pipelines
MIT License
52 stars 48 forks source link

Task fails with error "--local can only be used inside a git repository" #25

Open fabian-schwarz opened 11 months ago

fabian-schwarz commented 11 months ago

The tasks errors out in my pipeline with the error message :

##[error]fatal: --local can only be used inside a git repository

Maybe due to the pipeline checking out more than one repository:

- checkout: self
  persistCredentials: true
- checkout: Scripts

Probably fixed by making the following line configurable: https://github.com/mlarhrouch/azure-pipeline-gpt-pr-review/blob/1db7cfa7a1d56f0a58aa4580caace063610b158a/GPTPullRequestReview/src/git.ts#L7

mlarhrouch commented 11 months ago

@fabian-schwarz i don't see the reason for configuring the base directory for git, it should be always "System.DefaultWorkingDirectory"

fabian-schwarz commented 11 months ago

@mlarhrouch you can checkout multiple repositories in Azure Pipelines, thus it is not always "System.DefaultWorkingDirectory"

mlarhrouch commented 11 months ago

@fabian-schwarz in this case maybe using "Build.Repository.LocalPath" instead of "System.DefaultWorkingDirectory" is the best solution ?

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

fabian-schwarz commented 11 months ago

@mlarhrouch think this would only do half the job, it would only help if the repo we want to use is the "self" repo, another we can't reach with this variable. Still would love to have the option to define my custom working dir to target any checked out repo, which can default to either "System.DefaultWorkingDirectory" or "Build.Repository.LocalPath".

snaquekiller commented 1 month ago

we need this fix, i always pull multiple git repos in my pipelines, for multiple reason. i don't want to do a job just for that... i need the fix of that he can use the multiple directory path