Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/lint-manpages.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / lint-manpages.sh` 108 lines ยท 1792 bytes Raw Blame History 1 #!/bin/sh 2 3 extract_variable () { 4 ( 5 cat ../Makefile 6 cat </dev/null | 12 sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p' 13 } 14 15 check_missing_docs () ( 16 ret=0 17 18 for v in $ALL_COMMANDS 19 do 20 case "$v" in 21 git-merge-octopus) continue;; 22 git-merge-ours) continue;; 23 git-merge-recursive) continue;; 24 git-merge-resolve) continue;; 25 git-merge-subtree) continue;; 26 git-fsck-objects) continue;; 27 git-init-db) continue;; 28 git-remote-*) continue;; 29 git-stage) continue;; 30 git-legacy-*) continue;; 31 git-?*--?* ) continue ;; 32 esac 33 34 if ! test -f "$v.adoc" 35 then 36 echo "no doc: $v" 37 ret=1 38 fi 39 40 if ! sed -e '1,/^### command list/d' -e '/^#/d' ../command-list.txt | 41 grep -q "^$v[ ]" 42 then 43 case "$v" in 44 git) 45 ;; 46 *) 47 echo "no link: $v" 48 ret=1 49 ;; 50 esac 51 fi 52 done 53 54 exit $ret 55 ) 56 57 check_extraneous_docs () { 58 ( 59 sed -e '1,/^### command list/d' \ 60 -e '/^#/d' \ 61 -e '/guide$/d' \ 62 -e '/interfaces$/d' \ 63 -e 's/[ ].*//' \ 64 -e 's/^/listed /' ../command-list.txt 65 make print-man1 | 66 grep '\.adoc$' | 67 sed -e 's|^|documented |' \ 68 -e 's/\.adoc//' 69 ) | ( 70 all_commands="$(printf "%s " "$ALL_COMMANDS" "$BUILT_INS" "$EXCLUDED_PROGRAMS" | tr '\n' ' ')" 71 ret=0 72 73 while read how cmd 74 do 75 case " $all_commands " in 76 *" $cmd "*) ;; 77 *) 78 echo "removed but $how: $cmd" 79 ret=1;; 80 esac 81 done 82 83 exit $ret 84 ) 85 } 86 87 BUILT_INS="$(extract_variable BUILT_INS)" 88 ALL_COMMANDS="$(extract_variable ALL_COMMANDS)" 89 EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)" 90 91 findings=$( 92 if ! check_missing_docs 93 then 94 ret=1 95 fi 96 97 if ! check_extraneous_docs 98 then 99 ret=1 100 fi 101 102 exit $ret 103 ) 104 ret=$? 105 106 printf "%s" "$findings" | sort 107 108 exit $ret