Skip to content

Instantly share code, notes, and snippets.

@nkh
Created July 26, 2023 11:46
Show Gist options
  • Save nkh/2bb96a1b1bd85c468711e7891a50e120 to your computer and use it in GitHub Desktop.
Save nkh/2bb96a1b1bd85c468711e7891a50e120 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
git_tree_status_entries=$(mktemp -p /tmp/$USER/ git_tree_status_entries_XXXXXXXX)
git_tree_status_status=$(mktemp -p /tmp/$USER/ git_tree_status_status_XXXXXXXX)
# find, output must be like git-status, IE: no . at beginning
# git ls-files -z | tr '\0' '\n'
# git status --porcelain -z | tr '\0' '\n' | cut -c4-
[[ "$1" == '--ignored' ]] && extra_options=" --ignored"
{ git status $extra_options --porcelain -z | tr '\0' '\n' | cut -c4- ; } | ./git-fullstatus "$extra_options" 3>$git_tree_status_entries 4>$git_tree_status_status
paste -d' ' <(<$git_tree_status_entries lscolors) <(<$git_tree_status_status piper '^\?\?' magenta 'MM?' green '!!' yellow) | tw -a -t git-tree-status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment