test-parse-options: update to handle negative ints
[gitweb.git] / submodule.c
index d491e6a7717ef0e1b9f7efd91becb024b98e0161..15e90d1c10ebc9ecb0825f731b33d81cf3d9b4d5 100644 (file)
@@ -422,7 +422,8 @@ void set_config_fetch_recurse_submodules(int value)
        config_fetch_recurse_submodules = value;
 }
 
-static int has_remote(const char *refname, const unsigned char *sha1, int flags, void *cb_data)
+static int has_remote(const char *refname, const struct object_id *oid,
+                     int flags, void *cb_data)
 {
        return 1;
 }
@@ -616,10 +617,10 @@ static void submodule_collect_changed_cb(struct diff_queue_struct *q,
        }
 }
 
-static int add_sha1_to_array(const char *ref, const unsigned char *sha1,
+static int add_sha1_to_array(const char *ref, const struct object_id *oid,
                             int flags, void *data)
 {
-       sha1_array_append(data, sha1);
+       sha1_array_append(data, oid->hash);
        return 0;
 }
 
@@ -891,7 +892,6 @@ int submodule_uses_gitfile(const char *path)
 
 int ok_to_remove_submodule(const char *path)
 {
-       struct stat st;
        ssize_t len;
        struct child_process cp = CHILD_PROCESS_INIT;
        const char *argv[] = {
@@ -904,7 +904,7 @@ int ok_to_remove_submodule(const char *path)
        struct strbuf buf = STRBUF_INIT;
        int ok_to_remove = 1;
 
-       if ((lstat(path, &st) < 0) || is_empty_dir(path))
+       if (!file_exists(path) || is_empty_dir(path))
                return 1;
 
        if (!submodule_uses_gitfile(path))