diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 09:39:24 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-25 09:39:24 -0700 |
commit | 1ad6d46235d135582d5cbb91ec0186b485c7b5c1 (patch) | |
tree | e4a98d08b88862305d9f13ccef82180de33e8bcc /abspath.c | |
parent | 6ef1daf77202aee71056771d91dd12121c6061fd (diff) | |
parent | d79796bcf05b89774671a75b3285000c43129823 (diff) | |
download | git-1ad6d46235d135582d5cbb91ec0186b485c7b5c1.tar.gz |
Merge branch 'jc/alternate-push'
* jc/alternate-push:
push: receiver end advertises refs from alternate repositories
push: prepare sender to receive extended ref information from the receiver
receive-pack: make it a builtin
is_directory(): a generic helper function
Diffstat (limited to 'abspath.c')
-rw-r--r-- | abspath.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,16 @@ #include "cache.h" +/* + * Do not use this for inspecting *tracked* content. When path is a + * symlink to a directory, we do not want to say it is a directory when + * dealing with tracked content in the working tree. + */ +int is_directory(const char *path) +{ + struct stat st; + return (!stat(path, &st) && S_ISDIR(st.st_mode)); +} + /* We allow "recursive" symbolic links. Only within reason, though. */ #define MAXDEPTH 5 @@ -17,7 +28,7 @@ const char *make_absolute_path(const char *path) die ("Too long path: %.*s", 60, path); while (depth--) { - if (stat(buf, &st) || !S_ISDIR(st.st_mode)) { + if (!is_directory(buf)) { char *last_slash = strrchr(buf, '/'); if (last_slash) { *last_slash = '\0'; |