]> asedeno.scripts.mit.edu Git - git.git/blobdiff - diff.c
diff-delta: use realloc instead of xrealloc
[git.git] / diff.c
diff --git a/diff.c b/diff.c
index 33297aa8a7fd8f1c7f4711a9807b0b497d3de2ae..508bc51ed59998be463fd429ee074654baaad76a 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -186,13 +186,11 @@ static const char *external_diff(void)
        return external_diff_cmd;
 }
 
-#define TEMPFILE_PATH_LEN              50
-
 static struct diff_tempfile {
        const char *name; /* filename external diff should read from */
        char hex[41];
        char mode[10];
-       char tmp_path[TEMPFILE_PATH_LEN];
+       char tmp_path[PATH_MAX];
 } diff_temp[2];
 
 static int count_lines(const char *data, int size)
@@ -1351,7 +1349,7 @@ void fill_filespec(struct diff_filespec *spec, const unsigned char *sha1,
 }
 
 /*
- * Given a name and sha1 pair, if the dircache tells us the file in
+ * Given a name and sha1 pair, if the index tells us the file in
  * the work tree has that object contents, return true, so that
  * prepare_temp_file() does not have to inflate and extract.
  */
@@ -1467,7 +1465,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
        if (size_only && 0 < s->size)
                return 0;
 
-       if (S_ISDIRLNK(s->mode))
+       if (S_ISGITLINK(s->mode))
                return diff_populate_gitlink(s, size_only);
 
        if (!s->sha1_valid ||
@@ -1561,7 +1559,7 @@ static void prep_temp_blob(struct diff_tempfile *temp,
 {
        int fd;
 
-       fd = git_mkstemp(temp->tmp_path, TEMPFILE_PATH_LEN, ".diff_XXXXXX");
+       fd = git_mkstemp(temp->tmp_path, PATH_MAX, ".diff_XXXXXX");
        if (fd < 0)
                die("unable to create temp-file");
        if (write_in_full(fd, blob, size) != size)