-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit
82 lines (74 loc) · 2.95 KB
/
git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
nm="01"
vs="r1"
vcsversion="""
\e[1;42m $nm \e[0m\e[100m version $vs \e[0m
\e[100m Created in 07-28-2019 (a day where my Internet has been attacked and neighboors injuried me) as GITorrent and rebranded as Gitty in 11-13-2019 (a day my Windows partition were corrupted) and reworked as '01' in 11-09-2021 by Daniella Mesquita \e[0m
"""
#should get from config file in common with 01
#cd /usr/lib/floflis/browser/firedoge
#./firefox
# Only run normal git at commands unknown to 01's git wrapper
if [[ "$1" != "init" ]];then
if [[ "$2" != "-r" ]];then
if [[ "$1" != "unstage" ]];then
if [[ "$1" != "ass" ]];then
if [[ "$1" != "vommit" ]];then
/usr/bin/./gitoriginal "$@"
fi
fi
fi
fi
fi
# Use gix instead of git for initialize; thankfully gix always respect the "main" branch
if [[ "$1" = "init" ]];then
gix init
echo "Initialized empty Git repository in $(pwd)/.git/ (using 01 VCS+git wrapper+gix)"
gitoriginal config --global init.defaultBranch main
#git wrapper: on every git init: git branch -m main
echo "Initializing git-meta for this brand new repository..."
bash /usr/lib/01/git-meta/init.sh
fi
# add files/extensions recursively!
if [[ "$1" = "add" ]];then
if [[ "$2" = "-r" ]];then
if [[ "$3" != "" ]]
then
gitoriginal ls-files -co --exclude-standard | grep '\'"$3"'$' | xargs gitoriginal add
#https://stackoverflow.com/questions/2855140/recursively-add-files-by-pattern#comment2909387_2857909
else
echo "Please tell what filename or extension (without \"*\") you want to add. Only one file per once."
fi
fi
fi
# git need intuitive commands when users like me finds themselves in trouble, such as accidentaly adding files they shouldn't
if [[ "$1" = "unstage" ]];then
if [[ "$2" != "" ]]
then
gitoriginal rm --cached "$@"
else
echo "Please tell what files you want to unstage/not to include in the next commit."
fi
fi
# traps for misspells
if [[ "$1" = "ass" ]];then
echo "Did you mean \"git add\"? If that's not what you mean, it may be the time to take a break of git..."
fi
if [[ "$1" = "vommit" ]];then
echo "Did you mean \"git commit\"? If that's not what you mean 🤢 it may be the time to take a break of git..."
fi
# displays help message with a list of commands:
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo " git wrapper - \e[1;42m $nm $vs \e[0m"
# echo "Information:"
# echo " --help, -h Shows all available commands"
echo "Manage repo:"
echo " add -r <file/extension> Add files/extensions recursively! Only one file per once."
echo " unstage Tell what files you want to unstage/not to include in the next commit."
echo "------------------------------"
fi
#if [ "$3" != "file:///usr/lib/floflis/browser/firedoge/defaults/firstpage/creatingprofile.html" ] || [ "$1" != "--flofirstuse" ];then
#if /usr/lib/floflis/browser/firedoge/./powers.sh; then /usr/lib/floflis/browser/firedoge/./firefox $@; else exit 1; fi
#else
# /usr/lib/floflis/browser/firedoge/./firefox $@
#fi