Browse Source

Merge branch 'maint'

* 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
maint
Junio C Hamano 18 years ago
parent
commit
bd45fec839
  1. 65
      Documentation/git-rebase.txt
  2. 1
      merge-recursive.c
  3. 2
      path.c
  4. 11
      wt-status.c

65
Documentation/git-rebase.txt

@ -51,20 +51,69 @@ would be: @@ -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

1
merge-recursive.c

@ -1308,6 +1308,7 @@ int main(int argc, char *argv[]) @@ -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)

2
path.c

@ -279,7 +279,7 @@ int adjust_shared_perm(const char *path) @@ -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
wt-status.c

@ -154,10 +154,8 @@ void wt_status_print_initial(struct wt_status *s) @@ -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) @@ -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) @@ -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);

Loading…
Cancel
Save