author | Junio C Hamano <gitster@pobox.com> | |
Mon, 4 Apr 2011 22:02:01 +0000 (15:02 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 4 Apr 2011 22:02:01 +0000 (15:02 -0700) |
* jl/submodule-fetch-on-demand:
fetch/pull: Describe --recurse-submodule restrictions in the BUGS section
submodule update: Don't fetch when the submodule commit is already present
fetch/pull: Don't recurse into a submodule when commits are already present
Submodules: Add 'on-demand' value for the 'fetchRecurseSubmodule' option
config: teach the fetch.recurseSubmodules option the 'on-demand' value
fetch/pull: Add the 'on-demand' value to the --recurse-submodules option
fetch/pull: recurse into submodules when necessary
Conflicts:
builtin/fetch.c
submodule.c
fetch/pull: Describe --recurse-submodule restrictions in the BUGS section
submodule update: Don't fetch when the submodule commit is already present
fetch/pull: Don't recurse into a submodule when commits are already present
Submodules: Add 'on-demand' value for the 'fetchRecurseSubmodule' option
config: teach the fetch.recurseSubmodules option the 'on-demand' value
fetch/pull: Add the 'on-demand' value to the --recurse-submodules option
fetch/pull: recurse into submodules when necessary
Conflicts:
builtin/fetch.c
submodule.c
1 | 2 | |||
---|---|---|---|---|
Documentation/config.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/git-fetch.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/git-pull.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/gitmodules.txt | patch | | diff1 | | diff2 | | blob | history |
builtin/fetch.c | patch | | diff1 | | diff2 | | blob | history |
git-pull.sh | patch | | diff1 | | diff2 | | blob | history |
git-submodule.sh | patch | | diff1 | | diff2 | | blob | history |
submodule.c | patch | | diff1 | | diff2 | | blob | history |
t/t5526-fetch-submodules.sh | patch | | diff1 | | diff2 | | blob | history |
t/t7406-submodule-update.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/config.txt
Simple merge
diff --cc Documentation/git-fetch.txt
Simple merge
diff --cc Documentation/git-pull.txt
Simple merge
diff --cc Documentation/gitmodules.txt
Simple merge
diff --cc builtin/fetch.c
index 6cbb5f69ecf0946f4028b88563347332d54f65bc,f60393607691957fa3978bcc4e1f0b5676a74609..f9c41da475289b84fe849f7641406ebc94059630
--- 1/builtin/fetch.c
--- 2/builtin/fetch.c
+++ b/builtin/fetch.c
OPT_BOOLEAN('u', "update-head-ok", &update_head_ok,
"allow updating of HEAD ref"),
OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
- OPT_STRING(0, "depth", &depth, "DEPTH",
+ OPT_STRING(0, "depth", &depth, "depth",
"deepen history of shallow clone"),
- { OPTION_STRING, 0, "submodule-prefix", &submodule_prefix, "DIR",
+ { OPTION_STRING, 0, "submodule-prefix", &submodule_prefix, "dir",
"prepend this to submodule path output", PARSE_OPT_HIDDEN },
+ { OPTION_STRING, 0, "recurse-submodules-default",
+ &recurse_submodules_default, NULL,
+ "default mode for recursion", PARSE_OPT_HIDDEN },
OPT_END()
};
}
else {
msg = "storing head";
- what = "[new branch]";
+ what = _("[new branch]");
+ if ((recurse_submodules != RECURSE_SUBMODULES_OFF) &&
+ (recurse_submodules != RECURSE_SUBMODULES_ON))
+ check_for_new_submodule_commits(ref->new_sha1);
}
r = s_update_ref(msg, ref, 0);
diff --cc git-pull.sh
Simple merge
diff --cc git-submodule.sh
Simple merge
diff --cc submodule.c
index 0cb6d1829944b8a6d0f1a7ed1c228b61c31c7e0d,88c7488a63bf2a3280cdc536609a1d2b15541d0c..5294cef641ef74ec525d8d747c82faf0bef7352a
--- 1/submodule.c
--- 2/submodule.c
+++ b/submodule.c
#include "refs.h"
#include "string-list.h"
-struct string_list config_name_for_path;
-struct string_list config_fetch_recurse_submodules_for_name;
-struct string_list config_ignore_for_name;
+static struct string_list config_name_for_path;
+static struct string_list config_fetch_recurse_submodules_for_name;
+static struct string_list config_ignore_for_name;
- static int config_fetch_recurse_submodules;
+ static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
-struct string_list changed_submodule_paths;
++static struct string_list changed_submodule_paths;
static int add_submodule_odb(const char *path)
{
die("bad --ignore-submodules argument: %s", arg);
}
+static int prepare_submodule_summary(struct rev_info *rev, const char *path,
+ struct commit *left, struct commit *right,
+ int *fast_forward, int *fast_backward)
+{
+ struct commit_list *merge_bases, *list;
+
+ init_revisions(rev, NULL);
+ setup_revisions(0, NULL, rev, NULL);
+ rev->left_right = 1;
+ rev->first_parent_only = 1;
+ left->object.flags |= SYMMETRIC_LEFT;
+ add_pending_object(rev, &left->object, path);
+ add_pending_object(rev, &right->object, path);
+ merge_bases = get_merge_bases(left, right, 1);
+ if (merge_bases) {
+ if (merge_bases->item == left)
+ *fast_forward = 1;
+ else if (merge_bases->item == right)
+ *fast_backward = 1;
+ }
+ for (list = merge_bases; list; list = list->next) {
+ list->item->object.flags |= UNINTERESTING;
+ add_pending_object(rev, &list->item->object,
+ sha1_to_hex(list->item->object.sha1));
+ }
+ return prepare_revision_walk(rev);
+}
+
+static void print_submodule_summary(struct rev_info *rev, FILE *f,
+ const char *del, const char *add, const char *reset)
+{
+ static const char format[] = " %m %s";
+ struct strbuf sb = STRBUF_INIT;
+ struct commit *commit;
+
+ while ((commit = get_revision(rev))) {
+ struct pretty_print_context ctx = {0};
+ ctx.date_mode = rev->date_mode;
+ strbuf_setlen(&sb, 0);
+ if (commit->object.flags & SYMMETRIC_LEFT) {
+ if (del)
+ strbuf_addstr(&sb, del);
+ }
+ else if (add)
+ strbuf_addstr(&sb, add);
+ format_commit_message(commit, format, &sb, &ctx);
+ if (reset)
+ strbuf_addstr(&sb, reset);
+ strbuf_addch(&sb, '\n');
+ fprintf(f, "%s", sb.buf);
+ }
+ strbuf_release(&sb);
+}
+
+ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)
+ {
+ switch (git_config_maybe_bool(opt, arg)) {
+ case 1:
+ return RECURSE_SUBMODULES_ON;
+ case 0:
+ return RECURSE_SUBMODULES_OFF;
+ default:
+ if (!strcmp(arg, "on-demand"))
+ return RECURSE_SUBMODULES_ON_DEMAND;
+ die("bad %s argument: %s", opt, arg);
+ }
+ }
+
void show_submodule_summary(FILE *f, const char *path,
unsigned char one[20], unsigned char two[20],
unsigned dirty_submodule,
diff --cc t/t5526-fetch-submodules.sh
Simple merge
diff --cc t/t7406-submodule-update.sh
Simple merge