Check for IO errors after running a command
[gitweb.git] / Documentation / cmd-list.perl
index b54382b2bfdfc7926af8c4b0552f82235619f1c6..fcea1d74d597c84eeb535935fd5d881d7788f931 100755 (executable)
@@ -1,8 +1,11 @@
-#
+#!/usr/bin/perl -w
+
+use File::Compare qw(compare);
 
 sub format_one {
        my ($out, $name) = @_;
        my ($state, $description);
+       $state = 0;
        open I, '<', "$name.txt" or die "No such file $name.txt";
        while (<I>) {
                if (/^NAME$/) {
@@ -55,15 +58,20 @@ sub format_one {
                format_one(\*O, $_);
        }
        close O;
-       rename "$out+", "$out";
+
+       if (-f "$out" && compare("$out", "$out+") == 0) {
+               unlink "$out+";
+       }
+       else {
+               print STDERR "$out\n";
+               rename "$out+", "$out";
+       }
 }
 
 __DATA__
 git-add                                 mainporcelain
 git-am                                  mainporcelain
 git-annotate                            ancillaryinterrogators
-git-applymbox                           ancillaryinterrogators
-git-applypatch                          purehelpers
 git-apply                               plumbingmanipulators
 git-archimport                          foreignscminterface
 git-archive                             mainporcelain
@@ -74,9 +82,11 @@ sub format_one {
 git-cat-file                            plumbinginterrogators
 git-checkout-index                      plumbingmanipulators
 git-checkout                            mainporcelain
+git-check-attr                          purehelpers
 git-check-ref-format                    purehelpers
 git-cherry                              ancillaryinterrogators
 git-cherry-pick                         mainporcelain
+git-citool                              mainporcelain
 git-clean                               mainporcelain
 git-clone                               mainporcelain
 git-commit                              mainporcelain
@@ -102,6 +112,7 @@ sub format_one {
 git-gc                                  mainporcelain
 git-get-tar-commit-id                   ancillaryinterrogators
 git-grep                                mainporcelain
+git-gui                                 mainporcelain
 git-hash-object                         plumbingmanipulators
 git-http-fetch                          synchelpers
 git-http-push                           synchelpers
@@ -169,6 +180,7 @@ sub format_one {
 git-ssh-upload                          synchingrepositories
 git-status                              mainporcelain
 git-stripspace                          purehelpers
+git-submodule                           mainporcelain
 git-svn                                 foreignscminterface
 git-svnimport                           foreignscminterface
 git-symbolic-ref                        plumbingmanipulators