Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Tue, 7 Nov 2006 06:56:07 +0000 (22:56 -0800)
committerJunio C Hamano <junkio@cox.net>
Tue, 7 Nov 2006 06:56:07 +0000 (22:56 -0800)
* 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

1  2 
Documentation/git-rebase.txt
wt-status.c
index 10f2924f4df1eb29c1baf4484d2837377b6cfcb3,878eb6fe888b63573b5f1c9e2a8c62cfc9319708..03e867a403a034e49e63fc0123970b44a199e8b5
@@@ -7,7 -7,7 +7,7 @@@ git-rebase - Rebase local commits to a 
  
  SYNOPSIS
  --------
 -'git-rebase' [--merge] [--onto <newbase>] <upstream> [<branch>]
 +'git-rebase' [-v] [--merge] [--onto <newbase>] <upstream> [<branch>]
  
  'git-rebase' --continue | --skip | --abort
  
@@@ -51,20 -51,69 +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
@@@ -121,9 -170,6 +170,9 @@@ OPTION
        is used instead (`git-merge-recursive` when merging a single
        head, `git-merge-octopus` otherwise).  This implies --merge.
  
 +-v, \--verbose::
 +      Display a diffstat of what changed upstream since the last rebase.
 +
  include::merge-strategies.txt[]
  
  NOTES
diff --combined wt-status.c
index 7dd68575d1909d1a48246814c83d407f8225ea9d,68ecb0b921d7fbe597b2a74f80d465ba034dea4d..9692dfa325b6153571c83d0f25dd0281d8795b43
@@@ -41,8 -41,10 +41,8 @@@ void wt_status_prepare(struct wt_statu
  
        s->is_initial = get_sha1("HEAD", sha1) ? 1 : 0;
  
 -      head = resolve_ref(git_path("HEAD"), sha1, 0);
 -      s->branch = head ?
 -                  strdup(head + strlen(get_git_dir()) + 1) :
 -                  NULL;
 +      head = resolve_ref("HEAD", sha1, 0, NULL);
 +      s->branch = head ? xstrdup(head) : NULL;
  
        s->reference = "HEAD";
        s->amend = 0;
@@@ -70,25 -72,25 +70,25 @@@ static void wt_status_print_filepair(in
        color_printf(color(WT_STATUS_HEADER), "#\t");
        switch (p->status) {
        case DIFF_STATUS_ADDED:
 -              color_printf(c, "new file: %s", p->one->path); break;
 +              color_printf(c, "new file:   %s", p->one->path); break;
        case DIFF_STATUS_COPIED:
 -              color_printf(c, "copied: %s -> %s",
 +              color_printf(c, "copied:     %s -> %s",
                                p->one->path, p->two->path);
                break;
        case DIFF_STATUS_DELETED:
 -              color_printf(c, "deleted: %s", p->one->path); break;
 +              color_printf(c, "deleted:    %s", p->one->path); break;
        case DIFF_STATUS_MODIFIED:
 -              color_printf(c, "modified: %s", p->one->path); break;
 +              color_printf(c, "modified:   %s", p->one->path); break;
        case DIFF_STATUS_RENAMED:
 -              color_printf(c, "renamed: %s -> %s",
 +              color_printf(c, "renamed:    %s -> %s",
                                p->one->path, p->two->path);
                break;
        case DIFF_STATUS_TYPE_CHANGED:
                color_printf(c, "typechange: %s", p->one->path); break;
        case DIFF_STATUS_UNKNOWN:
 -              color_printf(c, "unknown: %s", p->one->path); break;
 +              color_printf(c, "unknown:    %s", p->one->path); break;
        case DIFF_STATUS_UNMERGED:
 -              color_printf(c, "unmerged: %s", p->one->path); break;
 +              color_printf(c, "unmerged:   %s", p->one->path); break;
        default:
                die("bug: unhandled diff status %c", p->status);
        }
@@@ -154,10 -156,8 +154,8 @@@ void wt_status_print_initial(struct wt_
  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;
  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 -224,8 +222,8 @@@ static void wt_status_print_untracked(c
  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);