diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 10f2924f4d..03e867a403 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -51,20 +51,69 @@ would be: D---E---F---G master ------------ -While, starting from the same point, the result of either of the following -commands: +The latter form is just a short-hand of `git checkout topic` +followed by `git rebase master`. - git-rebase --onto master~1 master - git-rebase --onto master~1 master topic +Here is how you would transplant a topic branch based on one +branch to another, to pretend that you forked the topic branch +from the latter branch, using `rebase --onto`. -would be: +First let's assume your 'topic' is based on branch 'next'. +For example feature developed in 'topic' depends on some +functionality which is found in 'next'. ------------ - A'--B'--C' topic - / - D---E---F---G master + o---o---o---o---o master + \ + o---o---o---o---o next + \ + o---o---o topic ------------ +We would want to make 'topic' forked from branch 'master', +for example because the functionality 'topic' branch depend on +got merged into more stable 'master' branch, like this: + +------------ + o---o---o---o---o master + | \ + | o'--o'--o' topic + \ + o---o---o---o---o next +------------ + +We can get this using the following command: + + git-rebase --onto master next topic + + +Another example of --onto option is to rebase part of a +branch. If we have the following situation: + +------------ + H---I---J topicB + / + E---F---G topicA + / + A---B---C---D master +------------ + +then the command + + git-rebase --onto master topicA topicB + +would result in: + +------------ + H'--I'--J' topicB + / + | E---F---G topicA + |/ + A---B---C---D master +------------ + +This is useful when topicB does not depend on topicA. + In case of conflict, git-rebase will stop at the first problematic commit and leave conflict markers in the tree. You can use git diff to locate the markers (<<<<<<) and make edits to resolve the conflict. For each diff --git a/merge-recursive.c b/merge-recursive.c index 2ba43ae84b..c81048d7a7 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1308,6 +1308,7 @@ int main(int argc, char *argv[]) const char *branch1, *branch2; struct commit *result, *h1, *h2; + git_config(git_default_config); /* core.filemode */ original_index_file = getenv("GIT_INDEX_FILE"); if (!original_index_file) diff --git a/path.c b/path.c index bb89fb02dc..d2c076d7cb 100644 --- a/path.c +++ b/path.c @@ -279,7 +279,7 @@ int adjust_shared_perm(const char *path) : 0)); if (S_ISDIR(mode)) mode |= S_ISGID; - if (chmod(path, mode) < 0) + if ((mode & st.st_mode) != mode && chmod(path, mode) < 0) return -2; return 0; } diff --git a/wt-status.c b/wt-status.c index 7dd68575d1..9692dfa325 100644 --- a/wt-status.c +++ b/wt-status.c @@ -154,10 +154,8 @@ void wt_status_print_initial(struct wt_status *s) static void wt_status_print_updated(struct wt_status *s) { struct rev_info rev; - const char *argv[] = { NULL, NULL, NULL }; - argv[1] = s->reference; init_revisions(&rev, NULL); - setup_revisions(2, argv, &rev, NULL); + setup_revisions(0, NULL, &rev, s->reference); rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = wt_status_print_updated_cb; rev.diffopt.format_callback_data = s; @@ -168,9 +166,8 @@ static void wt_status_print_updated(struct wt_status *s) static void wt_status_print_changed(struct wt_status *s) { struct rev_info rev; - const char *argv[] = { NULL, NULL }; init_revisions(&rev, ""); - setup_revisions(1, argv, &rev, NULL); + setup_revisions(0, NULL, &rev, NULL); rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK; rev.diffopt.format_callback = wt_status_print_changed_cb; rev.diffopt.format_callback_data = s; @@ -225,10 +222,8 @@ static void wt_status_print_untracked(const struct wt_status *s) static void wt_status_print_verbose(struct wt_status *s) { struct rev_info rev; - const char *argv[] = { NULL, NULL, NULL }; - argv[1] = s->reference; init_revisions(&rev, NULL); - setup_revisions(2, argv, &rev, NULL); + setup_revisions(0, NULL, &rev, s->reference); rev.diffopt.output_format |= DIFF_FORMAT_PATCH; rev.diffopt.detect_rename = 1; run_diff_index(&rev, 1);