diff: reject unknown change class given to --diff-filter
[gitweb.git] / test-chmtime.c
index d5358cbaac2022483b74366555fc9707a7d8ad97..02b42badd550a4b775aab084b38a63c2f4f561a9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This program can either change modification time of the given
  * file(s) or just print it. The program does not change atime nor
- * ctime (their values are explicitely preserved).
+ * ctime (their values are explicitly preserved).
  *
  * The mtime can be changed to an absolute value:
  *
@@ -87,6 +87,15 @@ int main(int argc, const char *argv[])
                        return -1;
                }
 
+#ifdef WIN32
+               if (!(sb.st_mode & S_IWUSR) &&
+                               chmod(argv[i], sb.st_mode | S_IWUSR)) {
+                       fprintf(stderr, "Could not make user-writable %s: %s",
+                               argv[i], strerror(errno));
+                       return -1;
+               }
+#endif
+
                utb.actime = sb.st_atime;
                utb.modtime = set_eq ? set_time : sb.st_mtime + set_time;
 
@@ -105,6 +114,6 @@ int main(int argc, const char *argv[])
        return 0;
 
 usage:
-       fprintf(stderr, "Usage: %s %s\n", argv[0], usage_str);
+       fprintf(stderr, "usage: %s %s\n", argv[0], usage_str);
        return -1;
 }