question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We shouldn't parse output of git-status

See original GitHub issue

Currently in globalvars.py, we parse the output of git status and check for HEAD detached, to determine whether we’re on a branch or not.

This is a bad practice because the output of git status is meant to be human-readable, not to be parsed by programs. We should probably use a program-friendly interface to determine whether HEAD is detached from branch.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
iBugcommented, Sep 9, 2018

Yep I know there’s a --porcelain option. But git status is meant for working tree/staging area, etc., not whether HEAD is detached. The use of git status is intrinsically wrong. If that option worked it would have been suggested in that SO question. @j-f1 @angussidney

1reaction
j-f1commented, Sep 8, 2018

I think there’s some sort of option that can be passed to git status that allows you to specify the output format.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bash function to parse git status
As a rule of thumb, standard error contains out-of-band error messages that aren't really part of the output, and therefore aren't worth parsing...
Read more >
Why shouldn't I use this porcelain Git command to tell if my ...
git status --porcelain is not a porcelain command. The name of the option is misleading, but it actually means "give an easy to...
Read more >
parse output of `git status --porcelain` command
parse output of `git status --porcelain` command. GitHub Gist: instantly share code, notes, and snippets.
Read more >
git-rev-parse - man pages section 1: User Commands
git-rev-parse - Pick out and massage parameters. ... If you want to make sure that the output actually names an object in your...
Read more >
Chapter 6 Using Git at the Command Line
import argparse import pandas as pd def main(args): """Run the command line ... The output of git status tells us that we can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found