tj / tj/git-extras

effort and summary complain if you `| head` them

Open
#464 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
18.1k
Forks
1.2k
Avg merge
5d 17h
Merged PRs (30d)
1

Description

If you do a git-effort or git-summary and pipe it to head, the programs complain about dying and maybe trigger other errors.

[~/.oh-my-zsh on ⇄ master]
$ git effort | head -4

  file                                          commits    active days

  .gitignore................................... 19         16
/usr/local/bin/git-effort: line 165: test: : integer expression expected
error: git-effort died of signal 13
[~/.oh-my-zsh on ⇄ master]
$ git summary | head -4

 project  : oh-my-zsh
 repo age : 6 years
 active   : 1415 days
error: git-summary died of signal 13
[~/.oh-my-zsh on ⇄ master]
$

Also, it seems like it leaves the cursor invisible when that happens.

I think they should play well with head/tail/other stream filters: not emitting errors, cleaning up terminal settings, and maybe turning off the colorization when they're going to a stream and not a tty, so you can get clean plain text output if you want to.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with git-effort | head -4 and git-summary | head -4, then inspect the git-effort and git-summary command entry points. Confirm how SIGPIPE, terminal settings, and color output behave when stdout is not a TTY. Done means stream filters produce no spurious errors, terminal state including cursor visibility is restored, and piped output is clean.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.