2021-02-11 02:45:36 +03:00
|
|
|
# RUN: %fish %s
|
|
|
|
|
|
|
|
function _git
|
2021-02-11 05:05:32 +03:00
|
|
|
git $argv >/dev/null 2>&1
|
|
|
|
end
|
|
|
|
|
|
|
|
function _git_item
|
2021-02-11 02:45:36 +03:00
|
|
|
_tide_decolor (_tide_item_git)
|
|
|
|
end
|
|
|
|
|
2021-02-11 03:13:16 +03:00
|
|
|
# Create directory
|
2021-02-11 02:58:28 +03:00
|
|
|
set -l dir ~/gitItemTest
|
|
|
|
rm -rf $dir
|
|
|
|
mkdir -p $dir
|
|
|
|
cd $dir
|
2021-02-11 03:13:16 +03:00
|
|
|
|
|
|
|
# Not in git repo
|
2021-02-11 05:05:32 +03:00
|
|
|
_git_item # CHECK:
|
2021-02-11 03:13:16 +03:00
|
|
|
|
|
|
|
# Create git repo and main branch
|
2021-02-11 05:05:32 +03:00
|
|
|
_git init
|
|
|
|
_git checkout -b main
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# Branch
|
2021-02-11 05:05:32 +03:00
|
|
|
_git_item # CHECK: main
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# Untracked
|
|
|
|
touch foo
|
2021-02-11 05:05:32 +03:00
|
|
|
_git_item # CHECK: main ?1
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# Staged
|
2021-02-11 05:05:32 +03:00
|
|
|
_git add foo
|
|
|
|
_git_item # CHECK: main +1
|
2021-02-11 02:45:36 +03:00
|
|
|
|
2021-02-11 05:07:24 +03:00
|
|
|
git config --local user.email "you@example.com"
|
|
|
|
git config --local user.name "Your Name"
|
2021-02-11 05:05:32 +03:00
|
|
|
_git commit -am 'Add foo'
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# Dirty
|
2021-02-11 05:05:32 +03:00
|
|
|
echo hello >foo
|
|
|
|
_git_item # CHECK: main !1
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# Stash
|
2021-02-11 05:05:32 +03:00
|
|
|
_git stash
|
|
|
|
_git_item # CHECK: main *1
|
2021-02-11 02:45:36 +03:00
|
|
|
|
2021-02-11 05:05:32 +03:00
|
|
|
_git stash pop
|
|
|
|
_git commit -am 'Append hello to foo'
|
2021-02-11 02:45:36 +03:00
|
|
|
|
|
|
|
# SHA
|
2021-02-11 05:05:32 +03:00
|
|
|
_git checkout HEAD~
|
2021-03-26 02:59:13 +03:00
|
|
|
_git_item # CHECK: {{\w*}}
|