]> git.proxmox.com Git - libgit2.git/commitdiff
submodule: add an ignore option to status
authorCarlos Martín Nieto <cmn@dwim.me>
Mon, 4 May 2015 15:29:12 +0000 (17:29 +0200)
committerCarlos Martín Nieto <cmn@dwim.me>
Mon, 22 Jun 2015 15:02:55 +0000 (17:02 +0200)
This lets us specify in the status call which ignore rules we want to
use (optionally falling back to whatever the submodule has in its
configuration).

This removes one of the reasons for having `_set_ignore()` set the value
in-memory. We re-use the `IGNORE_RESET` value for this as it is no
longer relevant but has a similar purpose to `IGNORE_FALLBACK`.

Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of
initializers and move that to fall back to the configuration as well.

include/git2/diff.h
include/git2/submodule.h
include/git2/types.h
src/checkout.c
src/diff_file.c
src/submodule.c
tests/diff/tree.c
tests/submodule/status.c
tests/submodule/submodule_helpers.c
tests/submodule/update.c

index 0ecdc1bed8729d3dfc892dd59e6bca34b3f89a63..90e2e1b22d04c3b9a46227084efb1aa7f76c9239 100644 (file)
@@ -399,7 +399,7 @@ typedef struct {
  * `git_diff_options_init` programmatic initialization.
  */
 #define GIT_DIFF_OPTIONS_INIT \
-       {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_DEFAULT, {NULL,0}, NULL, NULL, 3}
+       {GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_FALLBACK, {NULL,0}, NULL, NULL, 3}
 
 /**
  * Initializes a `git_diff_options` with default values. Equivalent to
index 737570844449792a362c78bd3f3351176543a2d9..31218cc949622741fbc677203a3e66dda8eb1fcd 100644 (file)
@@ -631,12 +631,14 @@ GIT_EXTERN(int) git_submodule_reload_all(git_repository *repo, int force);
  * @param status Combination of `GIT_SUBMODULE_STATUS` flags
  * @param repo the repository in which to look
  * @param name name of the submodule
+ * @param ignore the ignore rules to follow
  * @return 0 on success, <0 on error
  */
 GIT_EXTERN(int) git_submodule_status(
        unsigned int *status,
        git_repository *repo,
-       const char *name);
+       const char *name,
+       git_submodule_ignore_t ignore);
 
 /**
  * Get the locations of submodule information.
index d1e7cd92c67f68f7f8942208dbf4f24f64e8f732..aa0f31a9af8867f92907fd055f92471de12a204c 100644 (file)
@@ -374,7 +374,7 @@ typedef enum {
  *
  * The values are:
  *
- * - GIT_SUBMODULE_IGNORE_RESET: reset to the on-disk value.
+ * - GIT_SUBMODULE_IGNORE_FALLBACK: use the submodule's configuration
  * - GIT_SUBMODULE_IGNORE_NONE: don't ignore any change - i.e. even an
  *   untracked file, will mark the submodule as dirty.  Ignored files are
  *   still ignored, of course.
@@ -388,14 +388,12 @@ typedef enum {
  *   when we don't want any particular ignore rule to be specified.
  */
 typedef enum {
-       GIT_SUBMODULE_IGNORE_RESET     = -1, /**< reset to on-disk value */
+       GIT_SUBMODULE_IGNORE_FALLBACK  = -1, /**< use the submodule's configuration */
 
        GIT_SUBMODULE_IGNORE_NONE      = 1,  /**< any change or untracked == dirty */
        GIT_SUBMODULE_IGNORE_UNTRACKED = 2,  /**< dirty if tracked files change */
        GIT_SUBMODULE_IGNORE_DIRTY     = 3,  /**< only dirty if HEAD moved */
        GIT_SUBMODULE_IGNORE_ALL       = 4,  /**< never dirty */
-
-       GIT_SUBMODULE_IGNORE_DEFAULT   = 0
 } git_submodule_ignore_t;
 
 /**
index d95244a691c4cce065fff8fde2156c657581c6c3..351e8b0ef3a8ceb6a270bb271f51a9c2b83325af 100644 (file)
@@ -180,7 +180,7 @@ static bool checkout_is_workdir_modified(
                        return true;
                }
 
-               if (git_submodule_status(&sm_status, data->repo, wditem->path) < 0 ||
+               if (git_submodule_status(&sm_status, data->repo, wditem->path, GIT_SUBMODULE_IGNORE_FALLBACK) < 0 ||
                        GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
                        rval = true;
                else if ((sm_oid = git_submodule_wd_id(sm)) == NULL)
index 4d9ecc8d8576f47c8cfcae8a81db9908be20e739..28edcd4c12a9ad4448b09fe4b90de4e9e611d839 100644 (file)
@@ -186,7 +186,7 @@ static int diff_file_content_commit_to_str(
                        return error;
                }
 
-               if ((error = git_submodule_status(&sm_status, fc->repo, fc->file->path)) < 0) {
+               if ((error = git_submodule_status(&sm_status, fc->repo, fc->file->path, GIT_SUBMODULE_IGNORE_FALLBACK)) < 0) {
                        git_submodule_free(sm);
                        return error;
                }
index 2faaa734d43c2f8f16c5d406990e3cf946a61ca0..c6effdef8f9c44e386dab47b5316c2023a8bb392 100644 (file)
@@ -1067,7 +1067,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
        memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
 
        /* Get the status of the submodule to determine if it is already initialized  */
-       if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name)) < 0)
+       if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_FALLBACK)) < 0)
                goto done;
 
        /*
@@ -1462,7 +1462,7 @@ int git_submodule__status(
        unsigned int status;
        git_repository *smrepo = NULL;
 
-       if (ign < GIT_SUBMODULE_IGNORE_NONE)
+       if (ign == GIT_SUBMODULE_IGNORE_FALLBACK)
                ign = sm->ignore;
 
        /* only return location info if ignore == all */
@@ -1511,7 +1511,7 @@ int git_submodule__status(
        return 0;
 }
 
-int git_submodule_status(unsigned int *status, git_repository *repo, const char *name)
+int git_submodule_status(unsigned int *status, git_repository *repo, const char *name, git_submodule_ignore_t ignore)
 {
        git_submodule *sm;
        int error;
@@ -1521,7 +1521,7 @@ int git_submodule_status(unsigned int *status, git_repository *repo, const char
        if ((error = git_submodule_lookup(&sm, repo, name)) < 0)
                return error;
 
-       error = git_submodule__status(status, NULL, NULL, NULL, sm, 0);
+       error = git_submodule__status(status, NULL, NULL, NULL, sm, ignore);
        git_submodule_free(sm);
 
        return error;
index 6dd17203d105a071f5aa5d9398b06c45b02b67f8..977e21f5bd939251bda7517060a0d9f31d3c1c66 100644 (file)
@@ -89,7 +89,7 @@ void test_diff_tree__0(void)
 }
 
 #define DIFF_OPTS(FLAGS, CTXT) \
-       {GIT_DIFF_OPTIONS_VERSION, (FLAGS), GIT_SUBMODULE_IGNORE_DEFAULT, \
+       {GIT_DIFF_OPTIONS_VERSION, (FLAGS), GIT_SUBMODULE_IGNORE_FALLBACK, \
        {NULL,0}, NULL, NULL, (CTXT), 1}
 
 void test_diff_tree__options(void)
index 4d51d8dc018c53feb2e974b077009135d0d0c528..6721ee92a91e56d222864047bb67dffdb11267f1 100644 (file)
@@ -107,56 +107,47 @@ void test_submodule_status__ignore_none(void)
        cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_DELETED) != 0);
 }
 
-static int set_sm_ignore(git_submodule *sm, const char *name, void *payload)
-{
-       git_submodule_ignore_t ignore = *(git_submodule_ignore_t *)payload;
-       GIT_UNUSED(name);
-       git_submodule_set_ignore(g_repo, git_submodule_name(sm), ignore);
-       return 0;
-}
-
 void test_submodule_status__ignore_untracked(void)
 {
        unsigned int status;
        git_submodule_ignore_t ign = GIT_SUBMODULE_IGNORE_UNTRACKED;
 
        rm_submodule("sm_unchanged");
-       cl_git_pass(git_submodule_foreach(g_repo, set_sm_ignore, &ign));
 
        refute_submodule_exists(g_repo, "just_a_dir", GIT_ENOTFOUND);
        refute_submodule_exists(g_repo, "not-submodule", GIT_EEXISTS);
        refute_submodule_exists(g_repo, "not", GIT_EEXISTS);
 
-       status = get_submodule_status(g_repo, "sm_changed_index");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_index", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_changed_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_file", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_WD_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_changed_untracked_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_untracked_file", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_missing_commits");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_missing_commits", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_added_and_uncommited");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_added_and_uncommited", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_ADDED) != 0);
 
        /* removed sm_unchanged for deleted workdir */
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);
 
        /* now mkdir sm_unchanged to test uninitialized */
        cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);
 
        /* update sm_changed_head in index */
        add_submodule_to_index("sm_changed_head");
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_MODIFIED) != 0);
 }
 
@@ -166,42 +157,41 @@ void test_submodule_status__ignore_dirty(void)
        git_submodule_ignore_t ign = GIT_SUBMODULE_IGNORE_DIRTY;
 
        rm_submodule("sm_unchanged");
-       cl_git_pass(git_submodule_foreach(g_repo, set_sm_ignore, &ign));
 
        refute_submodule_exists(g_repo, "just_a_dir", GIT_ENOTFOUND);
        refute_submodule_exists(g_repo, "not-submodule", GIT_EEXISTS);
        refute_submodule_exists(g_repo, "not", GIT_EEXISTS);
 
-       status = get_submodule_status(g_repo, "sm_changed_index");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_index", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_changed_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_file", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_changed_untracked_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_untracked_file", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_missing_commits");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_missing_commits", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_MODIFIED) != 0);
 
-       status = get_submodule_status(g_repo, "sm_added_and_uncommited");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_added_and_uncommited", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_ADDED) != 0);
 
        /* removed sm_unchanged for deleted workdir */
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_DELETED) != 0);
 
        /* now mkdir sm_unchanged to test uninitialized */
        cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_WD_UNINITIALIZED) != 0);
 
        /* update sm_changed_head in index */
        add_submodule_to_index("sm_changed_head");
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert((status & GIT_SUBMODULE_STATUS_INDEX_MODIFIED) != 0);
 }
 
@@ -211,42 +201,41 @@ void test_submodule_status__ignore_all(void)
        git_submodule_ignore_t ign = GIT_SUBMODULE_IGNORE_ALL;
 
        rm_submodule("sm_unchanged");
-       cl_git_pass(git_submodule_foreach(g_repo, set_sm_ignore, &ign));
 
        refute_submodule_exists(g_repo, "just_a_dir", GIT_ENOTFOUND);
        refute_submodule_exists(g_repo, "not-submodule", GIT_EEXISTS);
        refute_submodule_exists(g_repo, "not", GIT_EEXISTS);
 
-       status = get_submodule_status(g_repo, "sm_changed_index");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_index", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_changed_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_file", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_changed_untracked_file");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_untracked_file", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_missing_commits");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_missing_commits", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
-       status = get_submodule_status(g_repo, "sm_added_and_uncommited");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_added_and_uncommited", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
        /* removed sm_unchanged for deleted workdir */
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
        /* now mkdir sm_unchanged to test uninitialized */
        cl_git_pass(git_futils_mkdir("sm_unchanged", "submod2", 0755, 0));
-       status = get_submodule_status(g_repo, "sm_unchanged");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_unchanged", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 
        /* update sm_changed_head in index */
        add_submodule_to_index("sm_changed_head");
-       status = get_submodule_status(g_repo, "sm_changed_head");
+       cl_git_pass(git_submodule_status(&status, g_repo,"sm_changed_head", ign));
        cl_assert(GIT_SUBMODULE_STATUS_IS_UNMODIFIED(status));
 }
 
index 36838228fcc3164cb59a7a67dd334421ad1521fb..d5e02360ad515efa1bacfd0cc29d73588bf9cfa7 100644 (file)
@@ -168,7 +168,7 @@ unsigned int get_submodule_status(git_repository *repo, const char *name)
 
        assert(repo && name);
 
-       cl_git_pass(git_submodule_status(&status, repo, name));
+       cl_git_pass(git_submodule_status(&status, repo, name, GIT_SUBMODULE_IGNORE_FALLBACK));
 
        return status;
 }
index 85870434edd09611ae724d2121533fbc26cdd152..fed6d38b3bbde1921a5f6143c54a88a8ac1afa41 100644 (file)
@@ -103,7 +103,7 @@ void test_submodule_update__update_submodule(void)
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
        /* verify the initial state of the submodule */
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -114,7 +114,7 @@ void test_submodule_update__update_submodule(void)
        cl_git_pass(git_submodule_update(sm, 0, &update_options));
 
        /* verify state */
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -142,7 +142,7 @@ void test_submodule_update__update_and_init_submodule(void)
        /* get the submodule */
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -177,7 +177,7 @@ void test_submodule_update__update_already_checked_out_submodule(void)
        /* Initialize and update the sub repository */
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -203,7 +203,7 @@ void test_submodule_update__update_already_checked_out_submodule(void)
         * HEAD commit and index should be updated, but not the workdir.
         */
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
 
        git_submodule_free(sm);
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
@@ -255,7 +255,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void)
        /* Initialize and update the sub repository */
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -281,7 +281,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void)
         * HEAD commit and index should be updated, but not the workdir.
         */
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
 
        git_submodule_free(sm);
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
@@ -332,7 +332,7 @@ void test_submodule_update__can_force_update(void)
        /* Initialize and update the sub repository */
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
        cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
                GIT_SUBMODULE_STATUS_IN_INDEX |
                GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -357,7 +357,7 @@ void test_submodule_update__can_force_update(void)
         * Verify state after checkout of parent repository. The submodule ID in the
         * HEAD commit and index should be updated, but not the workdir.
         */
-       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo"));
+       cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
 
        git_submodule_free(sm);
        cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));