Clean up commit insertion in git-rev-list
[gitweb.git] / send-pack.c
index 57e88a7637eb9a0976aaef2664c9d2cc06dc07e6..7287c3df828f89a4fa90ceb84b5e0df6bf23d901 100644 (file)
@@ -4,27 +4,6 @@
 static const char send_pack_usage[] = "git-send-pack [--exec=other] destination [heads]*";
 static const char *exec = "git-receive-pack";
 
-static int path_match(const char *path, int nr, char **match)
-{
-       int i;
-       int pathlen = strlen(path);
-
-       for (i = 0; i < nr; i++) {
-               char *s = match[i];
-               int len = strlen(s);
-
-               if (!len || len > pathlen)
-                       continue;
-               if (memcmp(path + pathlen - len, s, len))
-                       continue;
-               if (pathlen > len && path[pathlen - len - 1] != '/')
-                       continue;
-               *s = 0;
-               return 1;
-       }
-       return 0;
-}
-
 struct ref {
        struct ref *next;
        unsigned char old_sha1[20];
@@ -113,12 +92,9 @@ static int pack_objects(int fd, struct ref *refs)
 static int read_ref(const char *ref, unsigned char *sha1)
 {
        int fd, ret;
-       static char pathname[PATH_MAX];
        char buffer[60];
-       const char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
 
-       snprintf(pathname, sizeof(pathname), "%s/%s", git_dir, ref);
-       fd = open(pathname, O_RDONLY);
+       fd = open(git_path("%s", ref), O_RDONLY);
        if (fd < 0)
                return -1;
        ret = -1;