With no arguments, shows the status of existing submodules. Several
subcommands are available to perform operations on the submodules.
-add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]::
+add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--ref-format <format>] [--depth <depth>] [--] <repository> [<path>]::
Add the given repository as a submodule at the given path
to the changeset to be committed next to the current
project: the current project is termed the "superproject".
location, and only the superproject's URL needs to be provided.
git-submodule will correctly locate the submodule using the relative
URL in `.gitmodules`.
++
+If `--ref-format <format>` is specified, the ref storage format of newly
+cloned submodules will be set accordingly.
status [--cached] [--recursive] [--] [<path>...]::
Show the status of the submodules. This will print the SHA-1 of the
const char *sm_name;
const char *repo;
const char *realrepo;
+ enum ref_storage_format ref_storage_format;
int depth;
unsigned int force: 1;
unsigned int quiet: 1;
unsigned int progress: 1;
unsigned int dissociate: 1;
};
-#define ADD_DATA_INIT { .depth = -1 }
+#define ADD_DATA_INIT { \
+ .depth = -1, \
+ .ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN, \
+}
static void append_fetch_remotes(struct strbuf *msg, const char *git_dir_path)
{
string_list_append(&reference, p)->util = p;
}
+ clone_data.ref_storage_format = add_data->ref_storage_format;
clone_data.dissociate = add_data->dissociate;
if (add_data->depth >= 0)
clone_data.depth = xstrfmt("%d", add_data->depth);
{
int force = 0, quiet = 0, progress = 0, dissociate = 0;
struct add_data add_data = ADD_DATA_INIT;
+ const char *ref_storage_format = NULL;
char *to_free = NULL;
struct option options[] = {
OPT_STRING('b', "branch", &add_data.branch, N_("branch"),
OPT_BOOL(0, "progress", &progress, N_("force cloning progress")),
OPT_STRING(0, "reference", &add_data.reference_path, N_("repository"),
N_("reference repository")),
+ OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"),
+ N_("specify the reference format to use")),
OPT_BOOL(0, "dissociate", &dissociate, N_("borrow the objects from reference repositories")),
OPT_STRING(0, "name", &add_data.sm_name, N_("name"),
N_("sets the submodule's name to the given string "
if (argc == 0 || argc > 2)
usage_with_options(usage, options);
+ if (ref_storage_format) {
+ add_data.ref_storage_format = ref_storage_format_by_name(ref_storage_format);
+ if (add_data.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN)
+ die(_("unknown ref storage format '%s'"), ref_storage_format);
+ }
+
add_data.repo = argv[0];
if (argc == 1)
add_data.sm_path = git_url_basename(add_data.repo, 0, 0);
--reference=*)
reference_path="${1#--reference=}"
;;
+ --ref-format)
+ case "$2" in '') usage ;; esac
+ ref_format="--ref-format=$2"
+ shift
+ ;;
+ --ref-format=*)
+ ref_format="$1"
+ ;;
--dissociate)
dissociate=1
;;
${progress:+"--progress"} \
${branch:+--branch "$branch"} \
${reference_path:+--reference "$reference_path"} \
+ ${ref_format:+"$ref_format"} \
${dissociate:+--dissociate} \
${custom_name:+--name "$custom_name"} \
${depth:+"$depth"} \