Merge branch 'js/test-ln-s-add'
authorJunio C Hamano <gitster@pobox.com>
Thu, 20 Jun 2013 23:02:18 +0000 (16:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jun 2013 23:02:18 +0000 (16:02 -0700)
Many tests that check the behaviour of symbolic links stored in the
index or the tree objects do not have to be skipped on a filesystem
that lack symbolic link support.

* js/test-ln-s-add:
t4011: remove SYMLINKS prerequisite
t6035: use test_ln_s_add to remove SYMLINKS prerequisite
t3509, t4023, t4114: use test_ln_s_add to remove SYMLINKS prerequisite
t3100: use test_ln_s_add to remove SYMLINKS prerequisite
t3030: use test_ln_s_add to remove SYMLINKS prerequisite
t0000: use test_ln_s_add to remove SYMLINKS prerequisite
tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)
tests: introduce test_ln_s_add
t3010: modernize style
test-chmtime: Fix exit code on Windows

1  2 
t/README
test-chmtime.c
diff --combined t/README
index 35b3c5c2faec0ed543dde460a30de63c48e5f1e7,bbe25c31b438b9a4de8b289bc8608e12940e8478..ec5246886132f919ec4b6b05bfedd65eb2011690
+++ b/t/README
@@@ -324,9 -324,6 +324,9 @@@ Don't
     use 'test_must_fail git cmd'.  This will signal a failure if git
     dies in an unexpected way (e.g. segfault).
  
 +   On the other hand, don't use test_must_fail for running regular
 +   platform commands; just use '! cmd'.
 +
   - use perl without spelling it as "$PERL_PATH". This is to help our
     friends on Windows where the platform Perl often adds CR before
     the end of line, and they bundle Git with a version of Perl that
@@@ -595,6 -592,20 +595,20 @@@ library for your script to use
                test_cmp expected actual
        '
  
+  - test_ln_s_add <path1> <path2>
+    This function helps systems whose filesystem does not support symbolic
+    links. Use it to add a symbolic link entry to the index when it is not
+    important that the file system entry is a symbolic link, i.e., instead
+    of the sequence
+       ln -s foo bar &&
+       git add bar
+    Sometimes it is possible to split a test in a part that does not need
+    the symbolic link in the file system and a part that does; then only
+    the latter part need be protected by a SYMLINKS prerequisite (see below).
  Prerequisites
  -------------
  
diff --combined test-chmtime.c
index 923bf327f8ac8243c59292879a60e1f7364b6070,2e601a80384688cc5b0efe5bf066b86bcbf2798e..0df748784bb7f6b6f286dd37ada293df17cffeee
@@@ -56,7 -56,7 +56,7 @@@ static int timespec_arg(const char *arg
        return 1;
  }
  
 -int main(int argc, const char *argv[])
 +int main(int argc, char *argv[])
  {
        static int verbose;
  
                if (stat(argv[i], &sb) < 0) {
                        fprintf(stderr, "Failed to stat %s: %s\n",
                                argv[i], strerror(errno));
-                       return -1;
+                       return 1;
                }
  
 -#ifdef WIN32
 +#ifdef GIT_WINDOWS_NATIVE
                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;
+                       return 1;
                }
  #endif
  
                if (utb.modtime != sb.st_mtime && utime(argv[i], &utb) < 0) {
                        fprintf(stderr, "Failed to modify time on %s: %s\n",
                                argv[i], strerror(errno));
-                       return -1;
+                       return 1;
                }
        }
  
  
  usage:
        fprintf(stderr, "usage: %s %s\n", argv[0], usage_str);
-       return -1;
+       return 1;
  }