We shouldn't parse output of git-status
See original GitHub issueCurrently 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:
- Created 5 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep I know there’s a
--porcelain
option. Butgit status
is meant for working tree/staging area, etc., not whether HEAD is detached. The use ofgit status
is intrinsically wrong. If that option worked it would have been suggested in that SO question. @j-f1 @angussidneyI think there’s some sort of option that can be passed to
git status
that allows you to specify the output format.