File tree Expand file tree Collapse file tree 4 files changed +104
-2
lines changed
Expand file tree Collapse file tree 4 files changed +104
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ INSTALL=install
2222
2323SCRIPTS =git-apply-patch-script git-merge-one-file-script git-prune-script \
2424 git-pull-script git-tag-script git-resolve-script git-whatchanged \
25- git-deltafy-script git-fetch-script
25+ git-deltafy-script git-fetch-script git-status-script git-commit-script
2626
2727PROG = git-update-cache git-diff-files git-init-db git-write-tree \
2828 git-read-tree git-commit-tree git-cat-file git-fsck-cache \
@@ -31,7 +31,7 @@ PROG= git-update-cache git-diff-files git-init-db git-write-tree \
3131 git-unpack-file git-export git-diff-cache git-convert-cache \
3232 git-http-pull git-rpush git-rpull git-rev-list git-mktag \
3333 git-diff-helper git-tar-tree git-local-pull git-write-blob \
34- git-get-tar-commit-id git-mkdelta git-apply
34+ git-get-tar-commit-id git-mkdelta git-apply git-stripspace
3535
3636all : $(PROG )
3737
@@ -112,6 +112,7 @@ git-diff-helper: diff-helper.c
112112git-tar-tree : tar-tree.c
113113git-write-blob : write-blob.c
114114git-mkdelta : mkdelta.c
115+ git-stripspace : stripspace.c
115116
116117git-http-pull : LIBS += -lcurl
117118
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ git-status-script > .editmsg
3+ if [ " $? " != " 0" ]
4+ then
5+ cat .editmsg
6+ exit 1
7+ fi
8+ ED=${VISUAL: $EDITOR }
9+ ED=${ED: vi}
10+ $ED .editmsg
11+ grep -v ' ^#' < .editmsg | git-stripspace > .cmitmsg
12+ [ -s .cmitmsg ] || exit 1
13+ tree=$( git-write-tree) || exit 1
14+ commit=$( cat .cmitmsg | git-commit-tree $tree -p HEAD) || exit 1
15+ echo $commit > .git/HEAD
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ report () {
3+ header=" #
4+ # $1 :
5+ # ($2 )
6+ #
7+ "
8+ trailer=" "
9+ while read oldmode mode oldsha sha status name newname
10+ do
11+ echo -n " $header "
12+ header=" "
13+ trailer=" #
14+ "
15+ case " $status " in
16+ M) echo " # modified: $name " ;;
17+ D) echo " # deleted: $name " ;;
18+ T) echo " # typechange: $name " ;;
19+ C) echo " # copied: $name -> $newname " ;;
20+ R) echo " # renamed: $name -> $newname " ;;
21+ N) echo " # new file: $name " ;;
22+ U) echo " # unmerged: $name " ;;
23+ esac
24+ done
25+ echo -n " $trailer "
26+ [ " $header " ]
27+ }
28+
29+ git-update-cache --refresh >& /dev/null
30+ git-diff-cache -B -C --cached HEAD | sed ' s/^://' | report " Updated but not checked in" " will commit"
31+ committable=" $? "
32+ git-diff-files | sed ' s/^://' | report " Changed but not updated" " use git-update-cache to mark for commit"
33+ if [ " $committable " == " 0" ]
34+ then
35+ echo " nothing to commit"
36+ exit 1
37+ fi
38+ exit 0
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+ #include <string.h>
3+ #include <ctype.h>
4+
5+ /*
6+ * Remove empty lines from the beginning and end.
7+ *
8+ * Turn multiple consecutive empty lines into just one
9+ * empty line.
10+ */
11+ static void cleanup (char * line )
12+ {
13+ int len = strlen (line );
14+
15+ if (len > 1 && line [len - 1 ] == '\n' ) {
16+ do {
17+ unsigned char c = line [len - 2 ];
18+ if (!isspace (c ))
19+ break ;
20+ line [len - 2 ] = '\n' ;
21+ len -- ;
22+ line [len ] = 0 ;
23+ } while (len > 1 );
24+ }
25+ }
26+
27+ int main (int argc , char * * argv )
28+ {
29+ int empties = -1 ;
30+ char line [1024 ];
31+
32+ while (fgets (line , sizeof (line ), stdin )) {
33+ cleanup (line );
34+
35+ /* Not just an empty line? */
36+ if (line [0 ] != '\n' ) {
37+ if (empties > 0 )
38+ putchar ('\n' );
39+ empties = 0 ;
40+ fputs (line , stdout );
41+ continue ;
42+ }
43+ if (empties < 0 )
44+ continue ;
45+ empties ++ ;
46+ }
47+ return 0 ;
48+ }
You can’t perform that action at this time.
0 commit comments