Skip to content
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

Only enumerate local Azure Repos user bindings when inside a repository #417

Merged
merged 2 commits into from
Aug 19, 2021

Conversation

mjcheetham
Copy link
Collaborator

Only attempt to enumerate Azure Repos user bindings in the local Git configuration, when inside a Git repository.
Also print any exception stack traces to standard error if application tracing is enabled to aid in debugging such issues "in the wild".

Fixes #416

Only attempt to enumerate Azure Repos user bindings in the local Git
configuration, when inside a Git repository.
If application tracing is enabled, also print any exception stack traces
to standard error.
@mjcheetham mjcheetham requested a review from vdye August 17, 2021 09:13
Comment on lines +133 to +137
// If tracing is enabled then also print the stack trace to stderr
bool printStack = Context.Settings.GetTracingEnabled(out _);
if (printStack)
Context.Streams.Error.WriteLine(ex.StackTrace);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hyper-nit: the variable printStack is not necessary as it is not re-used.

Copy link
Collaborator Author

@mjcheetham mjcheetham Aug 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm explicitly putting this intermediate variable there to make it very clear the reason for using GetTracingEnabled(..) in "normal" exception logging code. I guess the comment above also explains this explicit decision.

I'd imagine (hope) the CLR JIT would be smart enough to elide the local variable in this case, but also if we're at the point of having to print an exception and die, perf is not a concern(!)

@mjcheetham mjcheetham merged commit f77b766 into git-ecosystem:main Aug 19, 2021
@mjcheetham mjcheetham deleted the azr-binding-fix branch August 19, 2021 10:29
@mjcheetham mjcheetham mentioned this pull request Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Repos binding command doesn't work outside of a repository
3 participants