History

Tweaks to git/walk, git/commit, delete git/checkout

Ori Bernstein committed 7 years ago

Commit 0fa9fa71 parent a7602ec6 files · +47 −51Browse files

Showing the changes to commit (1 of 6 files). Show all

Unified · Split

commit+18−4
@@ -2,6 +2,9 @@ · 1 unmodified line
2 2
3rfork ne3rfork ne
4 4
5nl='
6'
7
5fn whoami{8fn whoami{
6 name=`{git/conf user.name}9 name=`{git/conf user.name}
7 email=`{git/conf user.email}10 email=`{git/conf user.email}
@@ -36,14 +39,14 @@ fn findbranch{ · 28 unmodified lines
36 echo invalid branch $branch >[1=2]39 echo invalid branch $branch >[1=2]
37 exit badbranch40 exit badbranch
38 }41 }
39 42
40}43}
41 44
42fn editmsg{45fn editmsg{
43 echo '' > $msgfile.tmp46 echo '' > $msgfile.tmp
44 echo '# Commit message goes here.' >> $msgfile.tmp47 echo '# Commit message goes here.' >> $msgfile.tmp
45 echo '# Author: '$name' <'$email'>' >> $msgfile.tmp48 echo '# Author: '$name' <'$email'>' >> $msgfile.tmp
46 git/walk | grep -v '^T' | sed 's/^/# /g' >> $msgfile.tmp49 echo '#' $nl'# ' ^ `$nl{git/walk -fADR} >> $msgfile.tmp
47 sam $msgfile.tmp50 sam $msgfile.tmp
48 if(! test -s $msgfile.tmp || ~ `{wc -l <{grep -v '^[ ]*[\n#]' $msgfile.tmp}} 0){51 if(! test -s $msgfile.tmp || ~ `{wc -l <{grep -v '^[ ]*[\n#]' $msgfile.tmp}} 0){
49 echo 'cancelling commit: empty message' >[1=2]52 echo 'cancelling commit: empty message' >[1=2]
@@ -68,12 +71,21 @@ fn commit{ · 18 unmodified lines
68 hash=`{git/save -n $"name -e $"email -m $"msg $pflags}71 hash=`{git/save -n $"name -e $"email -m $"msg $pflags}
69 st=$status72 st=$status
70 if(~ $hash '')73 if(~ $hash '')
71 exit $st74 exit nocommit
72}75}
73 76
74fn update{77fn update{
75 mkdir -p `{basename -d $refpath}78 mkdir -p `{basename -d $refpath}
76 echo $hash > $refpath79 echo $hash > $refpath
80 for(f in `$nl{git/walk -cfAD}){
81 mkdir -p `{basename -d $f}
82 walk -eq $f > .git/index9/tracked/$f
83 }
84 for(f in `$nl{git/walk -cfR}){
85 rm -f .git/index9/tracked/$f
86 rm -f .git/index9/removed/$f
87 }
88
77}89}
78 90
79fn cleanup{91fn cleanup{
@@ -92,6 +104,8 @@ if(git/walk -q){ · 12 unmodified lines
92 exit clean104 exit clean
93}105}
94@{106@{
107 flag e +
108 flag x +
95 whoami109 whoami
96 findbranch110 findbranch
97 parents111 parents
@@ -101,7 +115,7 @@ if(git/walk -q){ · 3 unmodified lines
101 cleanup115 cleanup
102}116}
103st=$status117st=$status
104if not{118if(! ~ $status ''){
105 echo 'could not commit:' $st >[1=2]119 echo 'could not commit:' $st >[1=2]
106 exit $st120 exit $st
107}121}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t