upload-pack: optionally allow fetching reachable sha1
[gitweb.git] / submodule.c
index d37d400b2227c58f352795b9f6ede20a9cd54631..c0e6c81fc4656342fedeb4b5b68d9b938cb44b84 100644 (file)
@@ -576,12 +576,10 @@ static int is_submodule_commit_present(const char *path, unsigned char sha1[20])
                cp.env = local_repo_env;
                cp.git_cmd = 1;
                cp.no_stdin = 1;
-               cp.out = -1;
                cp.dir = path;
-               if (!run_command(&cp) && !strbuf_read(&buf, cp.out, 1024))
+               if (!capture_command(&cp, &buf, 1024) && !buf.len)
                        is_present = 1;
 
-               close(cp.out);
                strbuf_release(&buf);
        }
        return is_present;