Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Documentation: Transplanting branch with git-rebase --onto
  merge-recursive implicitely depends on trust_executable_bit
  adjust_shared_perm: chmod() only when needed.
  Fix git-runstatus for repositories containing a file named HEAD
  • Loading branch information
Junio C Hamano committed Nov 7, 2006
2 parents d28f7cb + e52775f commit bd45fec
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 17 deletions.
65 changes: 57 additions & 8 deletions Documentation/git-rebase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
11 changes: 3 additions & 8 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bd45fec

Please sign in to comment.