Giter VIP home page Giter VIP logo

Comments (8)

mayerwin avatar mayerwin commented on August 16, 2024

@mmatrosov The resolver for this simply calls git symbolic-ref --short -q HEAD. What does it return in your case? I'd just need to know what is the condition to check for to show detached HEAD (which indeed seems appropriate).

from vs-customize-window-title.

mmatrosov avatar mmatrosov commented on August 16, 2024

What does it return in your case?

Empty string.

I'd just need to know what is the condition to check for to show detached HEAD

From the docs:

-q
--quiet
Do not issue an error message if the is not a symbolic ref but a detached HEAD; instead exit with non-zero status silently.

Thus it seems like you can either remove -q and parse the error message, or check for the return status.

from vs-customize-window-title.

mayerwin avatar mayerwin commented on August 16, 2024

How can we reliably determine that it is a detached HEAD (and not another error)?

from vs-customize-window-title.

mayerwin avatar mayerwin commented on August 16, 2024

In your case, what does the command return when you remove -q?

from vs-customize-window-title.

mmatrosov avatar mmatrosov commented on August 16, 2024

How can we reliably determine that it is a detached HEAD (and not another error)?

I'm not sure. Need to investigate.

In your case, what does the command return when you remove -q?

$ git symbolic-ref --short HEAD
fatal: ref HEAD is not a symbolic ref

from vs-customize-window-title.

mayerwin avatar mayerwin commented on August 16, 2024

Is there a separate command we can run to easily check if we're on a detached HEAD (if so, I could run it when the branchName is blank)?

from vs-customize-window-title.

mmatrosov avatar mmatrosov commented on August 16, 2024

I was not able to find a dedicated command line for this.

It seems ok to rely on the fact that symbolic-ref return non-zero status if and only if we are in the detached head state. That's what is written in the docs after all.

from vs-customize-window-title.

mayerwin avatar mayerwin commented on August 16, 2024

Implementing this with today's release. Let me know if it doesn't work as expected!

Thanks for your help.

from vs-customize-window-title.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.