Merge branch 'js/symlink'
authorJunio C Hamano <junkio@cox.net>
Mon, 5 Mar 2007 01:31:09 +0000 (17:31 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 5 Mar 2007 01:31:09 +0000 (17:31 -0800)
* js/symlink:
Tell multi-parent diff about core.symlinks.
Handle core.symlinks=false case in merge-recursive.
Add core.symlinks to mark filesystems that do not support symbolic links.

1  2 
Documentation/config.txt
diff-lib.c
diff --combined Documentation/config.txt
index d20902bc33226fbb7395fe4d003e9c8408eefdb2,b809772b866c74ed28b170a1284b6bc59646ecda..5408dd67d316ce3334f2843267a604f5a4ea044b
@@@ -117,6 -117,13 +117,13 @@@ core.fileMode:
        the working copy are ignored; useful on broken filesystems like FAT.
        See gitlink:git-update-index[1]. True by default.
  
+ core.symlinks::
+       If false, symbolic links are checked out as small plain files that
+       contain the link text. gitlink:git-update-index[1] and
+       gitlink:git-add[1] will not change the recorded type to regular
+       file. Useful on filesystems like FAT that do not support
+       symbolic links. True by default.
  core.gitProxy::
        A "proxy command" to execute (as 'command host port') instead
        of establishing direct connection to the remote server when
@@@ -340,11 -347,6 +347,11 @@@ fetch.unpackLimit:
  format.headers::
        Additional email headers to include in a patch to be submitted
        by mail.  See gitlink:git-format-patch[1].
 +
 +format.suffix::
 +      The default for format-patch is to output files with the suffix
 +      `.patch`. Use this variable to change that suffix (make sure to
 +      include the dot if you want it).
  
  gc.packrefs::
        `git gc` does not run `git pack-refs` in a bare repository by
diff --combined diff-lib.c
index 88e59b5794236e8ca3162c8dd823ea1a64b4683b,f70888f8af57b3b7a695ecdbc19a3b8bc04c13b2..778cf58244d64b1e1b14ead43c2fdf5735bd717f
@@@ -200,72 -200,6 +200,72 @@@ static int handle_diff_files_args(struc
        return 0;
  }
  
 +static int is_outside_repo(const char *path, int nongit, const char *prefix)
 +{
 +      int i;
 +      if (nongit || !strcmp(path, "-") || path[0] == '/')
 +              return 1;
 +      if (prefixcmp(path, "../"))
 +              return 0;
 +      if (!prefix)
 +              return 1;
 +      for (i = strlen(prefix); !prefixcmp(path, "../"); ) {
 +              while (i > 0 && prefix[i - 1] != '/')
 +                      i--;
 +              if (--i < 0)
 +                      return 1;
 +              path += 3;
 +      }
 +      return 0;
 +}
 +
 +int setup_diff_no_index(struct rev_info *revs,
 +              int argc, const char ** argv, int nongit, const char *prefix)
 +{
 +      int i;
 +      for (i = 1; i < argc; i++)
 +              if (argv[i][0] != '-')
 +                      break;
 +              else if (!strcmp(argv[i], "--")) {
 +                      i++;
 +                      break;
 +              } else if (i < argc - 3 && !strcmp(argv[i], "--no-index")) {
 +                      i = argc - 3;
 +                      break;
 +              }
 +      if (argc != i + 2 || (!is_outside_repo(argv[i + 1], nongit, prefix) &&
 +                              !is_outside_repo(argv[i], nongit, prefix)))
 +              return -1;
 +
 +      diff_setup(&revs->diffopt);
 +      for (i = 1; i < argc - 2; )
 +              if (!strcmp(argv[i], "--no-index"))
 +                      i++;
 +              else {
 +                      int j = diff_opt_parse(&revs->diffopt,
 +                                      argv + i, argc - i);
 +                      if (!j)
 +                              die("invalid diff option/value: %s", argv[i]);
 +                      i += j;
 +              }
 +
 +      if (prefix) {
 +              int len = strlen(prefix);
 +
 +              revs->diffopt.paths = xcalloc(2, sizeof(char*));
 +              for (i = 0; i < 2; i++) {
 +                      const char *p;
 +                      p = prefix_filename(prefix, len, argv[argc - 2 + i]);
 +                      revs->diffopt.paths[i] = xstrdup(p);
 +              }
 +      }
 +      else
 +              revs->diffopt.paths = argv + argc - 2;
 +      revs->diffopt.nr_paths = 2;
 +      revs->max_count = -2;
 +      return 0;
 +}
 +
  int run_diff_files_cmd(struct rev_info *revs, int argc, const char **argv)
  {
        int silent_on_removed;
@@@ -412,6 -346,9 +412,9 @@@ int run_diff_files(struct rev_info *rev
                    S_ISREG(newmode) && S_ISREG(oldmode) &&
                    ((newmode ^ oldmode) == 0111))
                        newmode = oldmode;
+               else if (!has_symlinks &&
+                   S_ISREG(newmode) && S_ISLNK(oldmode))
+                       newmode = oldmode;
                diff_change(&revs->diffopt, oldmode, newmode,
                            ce->sha1, (changed ? null_sha1 : ce->sha1),
                            ce->name, NULL);