From 49b8b2926fdcc4322445f0a3bda459e81cd98e9a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 5 Nov 2006 17:22:15 -0500 Subject: [PATCH 1/4] Fix git-runstatus for repositories containing a file named HEAD The wt_status_print_updated() and wt_status_print_untracked() routines call setup_revisions() with 'HEAD' being the reference to the tip of the current branch. However, setup_revisions() gets confused if the branch also contains a file named 'HEAD' resulting in a fatal error. Instead, don't pass an argv to setup_revisions() at all; simply give it no arguments, and make 'HEAD' the default revision. Bug noticed by Rocco Rutte . Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- wt-status.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wt-status.c b/wt-status.c index 4b74e68584..68ecb0b921 100644 --- a/wt-status.c +++ b/wt-status.c @@ -156,10 +156,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; @@ -170,9 +168,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; @@ -227,10 +224,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); From fe732edee10f9b241c8df9b4ea081a4f33ad3968 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 4 Nov 2006 12:24:05 -0800 Subject: [PATCH 2/4] adjust_shared_perm: chmod() only when needed. When widening permission for files and directories in a 'shared' repository for a user with inappropriate umask() setting for shared work, make sure we call chmod() only when we actually need to. The primary idea owes credit to Johannes. Signed-off-by: Junio C Hamano --- path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From 9faed78f59046cb7cef7f132726bf81c5074b08d Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Mon, 6 Nov 2006 11:38:52 +0100 Subject: [PATCH 3/4] merge-recursive implicitely depends on trust_executable_bit Read the configuration in to get core.filemode value for this particular repository. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- merge-recursive.c | 1 + 1 file changed, 1 insertion(+) 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) From e52775f43857f377aa2aa69f82ac2d2f26dc6297 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 6 Nov 2006 19:12:45 +0100 Subject: [PATCH 4/4] Documentation: Transplanting branch with git-rebase --onto Added example of transplantig feature branch from one development branch (for example "next") into the other development branch (for example "master"). [jc: talking Carl's advice this contains both examples sent to the list by Jakub in his original message.] Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- Documentation/git-rebase.txt | 65 +++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 8 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 9d7bcaa38c..878eb6fe88 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