From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
Hi,
These are improvements to 'git rebase' by using a much improved 'git
cherry-pick'. I already sent some of these, but they have been revamped.
These changes require reorganization of the code in order to have a
builtin/lib.a library.
A new builtin/rewrite.c helper is added, and builtin/commit updated to use
that.
A new git-rebase--cherypick mode is added, and it replaces git-rebase--am and
git-rebase--merge.
I also added the new rebase tests by Martin von Zweigbergk to make sure
everything works, and in fact, it works better than before, since now all the
rebase modes are consistent with each other.
I don't have any hopes of these getting merged, because people have no interest
in fixing the ./*.o ./builin/*.o divide problem, only interested in arguing
that libgit.a is not a real library, and it should never be. So my obviously
cleanup is rejected.
Felipe Contreras (38):
build: generate and clean test scripts
build: do not install git-remote-testgit
build: trivial cleanup
build: add builtin lib
log-tree: remove dependency from sequencer
Move sequencer to builtin
unpack-trees: plug a memory leak
read-cache: plug a few leaks
sequencer: remove useless indentation
sequencer: trivial fix
cherry-pick: don't barf when there's nothing to do
cherry-pick: add --skip-empty option
revert/cherry-pick: add --quiet option
revert/cherry-pick: add --skip option
builtin: add rewrite helper
cherry-pick: store rewritten commits
cherry-pick: don't store skipped commit
builtin: move run_rewrite_hook() to rewrite.c
builtin: add copy_rewrite_notes()
cherry-pick: copy notes and run hooks
cherry-pick: add --action-name option
cherry-pick: remember rerere-autoupdate
rebase: split the cherry-pick stuff
rebase: cherry-pick: fix mode storage
rebase: cherry-pick: fix sequence continuation
rebase: cherry-pick: fix abort of cherry mode
rebase: cherry-pick: fix command invocations
rebase: cherry-pick: fix status messages
rebase: cherry-pick: automatically commit stage
rebase: cherry-pick: set correct action-name
rebase: trivial cleanup
rebase: use 'cherrypick' mode instead of 'am'
rebase: cherry-pick: fix for shell prompt
rebase: cherry-pick: add merge options
rebase: remove merge mode
rebase: cherry-pick: add copyright
tests: fix autostash
tests: update topology tests
Martin von Zweigbergk (7):
add simple tests of consistency across rebase types
add tests for rebasing with patch-equivalence present
add tests for rebasing of empty commits
add tests for rebasing root
add tests for rebasing merged history
t3406: modernize style
tests: move test for rebase messages from t3400 to t3406
.gitignore | 1 +
Documentation/git-cherry-pick.txt | 10 +-
Documentation/git-revert.txt | 7 +-
Documentation/sequencer.txt | 3 +
Makefile | 31 +--
builtin/commit.c | 46 +----
builtin/revert.c | 17 ++
builtin/rewrite.c | 124 ++++++++++++
builtin/rewrite.h | 20 ++
sequencer.c => builtin/sequencer.c | 263 ++++++++++---------------
sequencer.h => builtin/sequencer.h | 12 +-
contrib/completion/git-prompt.sh | 4 +-
git-rebase--am.sh | 12 +-
git-rebase--cherrypick.sh | 72 +++++++
git-rebase--interactive.sh | 4 +-
git-rebase--merge.sh | 151 --------------
git-rebase.sh | 16 +-
log-tree.c | 161 ++++++++++++++-
log-tree.h | 3 +
read-cache.c | 4 +
t/lib-rebase.sh | 33 ++++
t/t3400-rebase.sh | 53 +----
t/t3401-rebase-partial.sh | 69 -------
t/t3404-rebase-interactive.sh | 10 +-
t/t3406-rebase-message.sh | 56 +++---
t/t3407-rebase-abort.sh | 2 +-
t/t3409-rebase-preserve-merges.sh | 53 -----
t/t3420-rebase-autostash.sh | 5 +-
t/t3421-rebase-topology-linear.sh | 350 +++++++++++++++++++++++++++++++++
t/t3425-rebase-topology-merges.sh | 255 ++++++++++++++++++++++++
t/t3508-cherry-pick-many-commits.sh | 13 ++
t/t3510-cherry-pick-sequence.sh | 14 +-
t/t5520-pull.sh | 2 +-
t/t9106-git-svn-commit-diff-clobber.sh | 2 +-
t/t9903-bash-prompt.sh | 2 +-
unpack-trees.c | 4 +-
36 files changed, 1268 insertions(+), 616 deletions(-)
create mode 100644 builtin/rewrite.c
create mode 100644 builtin/rewrite.h
rename sequencer.c => builtin/sequencer.c (86%)
rename sequencer.h => builtin/sequencer.h (86%)
create mode 100644 git-rebase--cherrypick.sh
delete mode 100644 git-rebase--merge.sh
delete mode 100755 t/t3401-rebase-partial.sh
create mode 100755 t/t3421-rebase-topology-linear.sh
create mode 100755 t/t3425-rebase-topology-merges.sh
--
1.8.3.698.g079b096
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
There's no need to list again the prerequisites.
Signed-off-by: Felipe Contreras <redacted>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
Move the relevant code from sequencer to log-tree. This code is not
specific to sequencer, and this allows the sequencer to move out of
libgit.
Signed-off-by: Felipe Contreras <redacted>
---
log-tree.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
log-tree.h | 3 ++
sequencer.c | 160 ++---------------------------------------------------------
sequencer.h | 4 --
4 files changed, 166 insertions(+), 162 deletions(-)
@@ -472,6 +475,162 @@ static void show_mergetag(struct rev_info *opt, struct commit *commit)free_commit_extra_headers(to_free);}+staticintis_rfc2822_line(constchar*buf,intlen)+{+inti;++for(i=0;i<len;i++){+intch=buf[i];+if(ch==':')+return1;+if(!isalnum(ch)&&ch!='-')+break;+}++return0;+}++staticintis_cherry_picked_from_line(constchar*buf,intlen)+{+/*+*Weonlycarethatitlooksroughlylike(cherrypickedfrom...)+*/+returnlen>strlen(cherry_picked_prefix)+1&&+!prefixcmp(buf,cherry_picked_prefix)&&buf[len-1]==')';+}++/*+*Returns0fornon-conformingfooter+*Returns1forconformingfooter+*Returns2whensobexistswithinconformingfooter+*Returns3whensobexistswithinconformingfooteraslastentry+*/+inthas_conforming_footer(structstrbuf*sb,structstrbuf*sob,+intignore_footer)+{+charprev;+inti,k;+intlen=sb->len-ignore_footer;+constchar*buf=sb->buf;+intfound_sob=0;++/* footer must end with newline */+if(!len||buf[len-1]!='\n')+return0;++prev='\0';+for(i=len-1;i>0;i--){+charch=buf[i];+if(prev=='\n'&&ch=='\n')/* paragraph break */+break;+prev=ch;+}++/* require at least one blank line */+if(prev!='\n'||buf[i]!='\n')+return0;++/* advance to start of last paragraph */+while(i<len-1&&buf[i]=='\n')+i++;++for(;i<len;i=k){+intfound_rfc2822;++for(k=i;k<len&&buf[k]!='\n';k++)+;/* do nothing */+k++;++found_rfc2822=is_rfc2822_line(buf+i,k-i-1);+if(found_rfc2822&&sob&&+!strncmp(buf+i,sob->buf,sob->len))+found_sob=k;++if(!(found_rfc2822||+is_cherry_picked_from_line(buf+i,k-i-1)))+return0;+}+if(found_sob==i)+return3;+if(found_sob)+return2;+return1;+}++voidappend_cherrypick(structstrbuf*msgbuf,structobject*obj)+{+if(!has_conforming_footer(msgbuf,NULL,0))+strbuf_addch(msgbuf,'\n');+strbuf_addstr(msgbuf,cherry_picked_prefix);+strbuf_addstr(msgbuf,sha1_to_hex(obj->sha1));+strbuf_addstr(msgbuf,")\n");+}++voidappend_signoff(structstrbuf*msgbuf,intignore_footer,unsignedflag)+{+unsignedno_dup_sob=flag&APPEND_SIGNOFF_DEDUP;+structstrbufsob=STRBUF_INIT;+inthas_footer;++strbuf_addstr(&sob,sign_off_header);+strbuf_addstr(&sob,fmt_name(getenv("GIT_COMMITTER_NAME"),+getenv("GIT_COMMITTER_EMAIL")));+strbuf_addch(&sob,'\n');++/*+*Ifthewholemessagebufferisequaltothesob,pretendthatwe+*foundaconformingfooterwithamatchingsob+*/+if(msgbuf->len-ignore_footer==sob.len&&+!strncmp(msgbuf->buf,sob.buf,sob.len))+has_footer=3;+else+has_footer=has_conforming_footer(msgbuf,&sob,ignore_footer);++if(!has_footer){+constchar*append_newlines=NULL;+size_tlen=msgbuf->len-ignore_footer;++if(!len){+/*+*Thebufferiscompletelyempty.Leavefoomfor+*thetitleandbodytobefilledinbytheuser.+*/+append_newlines="\n\n";+}elseif(msgbuf->buf[len-1]!='\n'){+/*+*Incompleteline.Completethelineandadda+*blankonesothatthereisanemptylinebetween+*themessagebodyandthesob.+*/+append_newlines="\n\n";+}elseif(len==1){+/*+*Buffercontainsasinglenewline.Addanother+*sothatweleaveroomforthetitleandbody.+*/+append_newlines="\n";+}elseif(msgbuf->buf[len-2]!='\n'){+/*+*Bufferendswithasinglenewline.Addanother+*sothatthereisanemptylinebetweenthemessage+*bodyandthesob.+*/+append_newlines="\n";+}/* else, the buffer already ends with two newlines. */++if(append_newlines)+strbuf_splice(msgbuf,msgbuf->len-ignore_footer,0,+append_newlines,strlen(append_newlines));+}++if(has_footer!=3&&(!no_dup_sob||has_footer!=2))+strbuf_splice(msgbuf,msgbuf->len-ignore_footer,0,+sob.buf,sob.len);++strbuf_release(&sob);+}+voidshow_log(structrev_info*opt){structstrbufmsgbuf=STRBUF_INIT;
@@ -14,94 +14,10 @@#include"merge-recursive.h"#include"refs.h"#include"argv-array.h"+#include"log-tree.h"#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"-constcharsign_off_header[]="Signed-off-by: ";-staticconstcharcherry_picked_prefix[]="(cherry picked from commit ";--staticintis_rfc2822_line(constchar*buf,intlen)-{-inti;--for(i=0;i<len;i++){-intch=buf[i];-if(ch==':')-return1;-if(!isalnum(ch)&&ch!='-')-break;-}--return0;-}--staticintis_cherry_picked_from_line(constchar*buf,intlen)-{-/*-*Weonlycarethatitlooksroughlylike(cherrypickedfrom...)-*/-returnlen>strlen(cherry_picked_prefix)+1&&-!prefixcmp(buf,cherry_picked_prefix)&&buf[len-1]==')';-}--/*-*Returns0fornon-conformingfooter-*Returns1forconformingfooter-*Returns2whensobexistswithinconformingfooter-*Returns3whensobexistswithinconformingfooteraslastentry-*/-staticinthas_conforming_footer(structstrbuf*sb,structstrbuf*sob,-intignore_footer)-{-charprev;-inti,k;-intlen=sb->len-ignore_footer;-constchar*buf=sb->buf;-intfound_sob=0;--/* footer must end with newline */-if(!len||buf[len-1]!='\n')-return0;--prev='\0';-for(i=len-1;i>0;i--){-charch=buf[i];-if(prev=='\n'&&ch=='\n')/* paragraph break */-break;-prev=ch;-}--/* require at least one blank line */-if(prev!='\n'||buf[i]!='\n')-return0;--/* advance to start of last paragraph */-while(i<len-1&&buf[i]=='\n')-i++;--for(;i<len;i=k){-intfound_rfc2822;--for(k=i;k<len&&buf[k]!='\n';k++)-;/* do nothing */-k++;--found_rfc2822=is_rfc2822_line(buf+i,k-i-1);-if(found_rfc2822&&sob&&-!strncmp(buf+i,sob->buf,sob->len))-found_sob=k;--if(!(found_rfc2822||-is_cherry_picked_from_line(buf+i,k-i-1)))-return0;-}-if(found_sob==i)-return3;-if(found_sob)-return2;-return1;-}-staticvoidremove_sequencer_state(void){structstrbufseq_dir=STRBUF_INIT;
@@ -1123,68 +1034,3 @@ int sequencer_pick_revisions(struct replay_opts *opts)save_opts(opts);returnpick_commits(todo_list,opts);}--voidappend_signoff(structstrbuf*msgbuf,intignore_footer,unsignedflag)-{-unsignedno_dup_sob=flag&APPEND_SIGNOFF_DEDUP;-structstrbufsob=STRBUF_INIT;-inthas_footer;--strbuf_addstr(&sob,sign_off_header);-strbuf_addstr(&sob,fmt_name(getenv("GIT_COMMITTER_NAME"),-getenv("GIT_COMMITTER_EMAIL")));-strbuf_addch(&sob,'\n');--/*-*Ifthewholemessagebufferisequaltothesob,pretendthatwe-*foundaconformingfooterwithamatchingsob-*/-if(msgbuf->len-ignore_footer==sob.len&&-!strncmp(msgbuf->buf,sob.buf,sob.len))-has_footer=3;-else-has_footer=has_conforming_footer(msgbuf,&sob,ignore_footer);--if(!has_footer){-constchar*append_newlines=NULL;-size_tlen=msgbuf->len-ignore_footer;--if(!len){-/*-*Thebufferiscompletelyempty.Leavefoomfor-*thetitleandbodytobefilledinbytheuser.-*/-append_newlines="\n\n";-}elseif(msgbuf->buf[len-1]!='\n'){-/*-*Incompleteline.Completethelineandadda-*blankonesothatthereisanemptylinebetween-*themessagebodyandthesob.-*/-append_newlines="\n\n";-}elseif(len==1){-/*-*Buffercontainsasinglenewline.Addanother-*sothatweleaveroomforthetitleandbody.-*/-append_newlines="\n";-}elseif(msgbuf->buf[len-2]!='\n'){-/*-*Bufferendswithasinglenewline.Addanother-*sothatthereisanemptylinebetweenthemessage-*bodyandthesob.-*/-append_newlines="\n";-}/* else, the buffer already ends with two newlines. */--if(append_newlines)-strbuf_splice(msgbuf,msgbuf->len-ignore_footer,0,-append_newlines,strlen(append_newlines));-}--if(has_footer!=3&&(!no_dup_sob||has_footer!=2))-strbuf_splice(msgbuf,msgbuf->len-ignore_footer,0,-sob.buf,sob.len);--strbuf_release(&sob);-}
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
We are not freeing 'istate->cache' properly.
We can't rely on 'initialized' to keep track of the 'istate->cache',
because it doesn't really mean it's initialized. So assume it always has
data, and free it before overwriting it.
Signed-off-by: Felipe Contreras <redacted>
---
read-cache.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -129,6 +129,9 @@ effect to your index in a row. redundant commits are ignored. This option overrides that behavior and creates an empty commit object. Implies `--allow-empty`.+--skip-empty::+ Instead of failing, skip commits that are or become empty.+ --strategy=<strategy>:: Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in linkgit:git-merge[1]
@@ -3,6 +3,9 @@ '.git/sequencer'. Can be used to continue after resolving conflicts in a failed cherry-pick or revert.+--skip::+ Skip the current commit, and then continue.+ --quit:: Forget about the current operation in progress. Can be used to clear the sequencer state after a failed cherry-pick or
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
So that we can load and store rewrites, as well as other operations on a
list of rewritten commits.
Signed-off-by: Felipe Contreras <redacted>
---
Makefile | 1 +
builtin/rewrite.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
builtin/rewrite.h | 18 ++++++++++++++
3 files changed, 93 insertions(+)
create mode 100644 builtin/rewrite.c
create mode 100644 builtin/rewrite.h
@@ -0,0 +1,74 @@+#include"cache.h"+#include"rewrite.h"++voidadd_rewritten(structrewritten*list,unsignedchar*from,unsignedchar*to)+{+structrewritten_item*item;+if(list->nr+1>=list->alloc){+list->alloc+=32;+list->items=xrealloc(list->items,list->alloc*sizeof(*list->items));+}+item=&list->items[list->nr];+hashcpy(item->from,from);+hashcpy(item->to,to);+list->nr++;+}++intstore_rewritten(structrewritten*list,constchar*file)+{+staticstructlock_filelock;+structstrbufbuf=STRBUF_INIT;+intfd,i,ret=0;++fd=hold_lock_file_for_update(&lock,file,LOCK_DIE_ON_ERROR);+for(i=0;i<list->nr;i++){+structrewritten_item*item=&list->items[i];+strbuf_addf(&buf,"%s %s\n",sha1_to_hex(item->from),sha1_to_hex(item->to));+}+if(write_in_full(fd,buf.buf,buf.len)<0){+error(_("Could not write to %s"),file);+ret=1;+gotoleave;+}+if(commit_lock_file(&lock)<0){+error(_("Error wrapping up %s."),file);+ret=1;+gotoleave;+}+leave:+strbuf_release(&buf);+returnret;+}++voidload_rewritten(structrewritten*list,constchar*file)+{+structstrbufbuf=STRBUF_INIT;+char*p;+intfd;++fd=open(file,O_RDONLY);+if(fd<0)+return;+if(strbuf_read(&buf,fd,0)<0){+close(fd);+strbuf_release(&buf);+return;+}+close(fd);++for(p=buf.buf;*p;){+unsignedcharfrom[20];+unsignedcharto[20];+char*eol=strchrnul(p,'\n');+if(eol-p!=81)+/* wrong size */+break;+if(get_sha1_hex(p,from))+break;+if(get_sha1_hex(p+41,to))+break;+add_rewritten(list,from,to);+p=*eol?eol+1:eol;+}+strbuf_release(&buf);+}
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:37
Will be useful for the next commits.
Signed-off-by: Felipe Contreras <redacted>
---
builtin/sequencer.c | 23 ++++++++++++++++++++++-
builtin/sequencer.h | 1 +
2 files changed, 23 insertions(+), 1 deletion(-)
@@ -947,6 +961,8 @@ static int sequencer_continue(struct replay_opts *opts)returncontinue_single_pick();read_populate_opts(&opts);read_populate_todo(&todo_list,opts);+if(opts->action==REPLAY_PICK)+load_rewritten(&rewritten,git_path(SEQ_REWR_FILE));/* Verify that the conflict has been resolved */if(file_exists(git_path("CHERRY_PICK_HEAD"))||
@@ -957,6 +973,11 @@ static int sequencer_continue(struct replay_opts *opts)}if(index_differs_from("HEAD",0))returnerror_dirty_index(opts);+if(opts->action==REPLAY_PICK){+unsignedcharto[20];+if(!read_ref("HEAD",to))+add_rewritten(&rewritten,todo_list->item->object.sha1,to);+}todo_list=todo_list->next;returnpick_commits(todo_list,opts);}
@@ -1557,16 +1557,10 @@ int cmd_commit(int argc, const char **argv, const char *prefix)rerere(0);run_hook(get_index_file(),"post-commit",NULL);if(amend&&!no_post_rewrite){-structnotes_rewrite_cfg*cfg;structrewrittenrewrite;memset(&rewrite,0,sizeof(rewrite));-cfg=init_copy_notes_for_rewrite("amend");-if(cfg){-/* we are amending, so current_head is not NULL */-copy_note_for_rewrite(cfg,current_head->object.sha1,sha1);-finish_copy_notes_for_rewrite(cfg);-}add_rewritten(&rewrite,current_head->object.sha1,sha1);+copy_rewrite_notes(&rewrite,"amend");run_rewrite_hook(&rewrite,"amend");}if(!quiet)
@@ -51,6 +51,10 @@ OPTIONS feed all <commit>... arguments to a single revision walk (see a later example that uses 'maint master..next').+-q::+--quiet::+ Quiet, suppress feedback messages.+ -e:: --edit:: With this option, 'git cherry-pick' will let you edit the commit
@@ -40,6 +40,10 @@ OPTIONS default, see linkgit:git-rev-list[1] and its '--no-walk' option.+-q::+--quiet::+ Quiet, suppress feedback messages.+ -e:: --edit:: With this option, 'git revert' will let you edit the commit
@@ -19,15 +19,7 @@ esactest-n"$rebase_root"&&root_flag=--rootret=0-iftest-n"$keep_empty"-then-# we have to do this the hard way. git format-patch completely squashes-# empty commits and even if it didn't the format doesn't really lend-# itself well to recording empty patches. fortunately, cherry-pick-# makes this easy-gitcherry-pick--allow-empty"$revisions"-ret=$?-else+ rm-f"$GIT_DIR/rebased-patches" gitformat-patch-k--stdout--full-index--ignore-if-in-upstream\
@@ -0,0 +1,30 @@+#!/bin/sh+#+# Copyright (c) 2010 Junio C Hamano.+#++case"$action"in+continue)+gitam--resolved--resolvemsg="$resolvemsg"&&+move_to_original_branch+return+;;+skip)+gitam--skip--resolvemsg="$resolvemsg"&&+move_to_original_branch+return+;;+esac++test-n"$rebase_root"&&root_flag=--root++gitcherry-pick--allow-empty"$revisions"+ret=$?++iftest0!=$ret+then+test-d"$state_dir"&&write_basic_state+return$ret+fi++move_to_original_branch
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
So it can be used by other tools (e.g. git rebase), and the right action
is passed to the hooks and notes rewrite stuff.
Signed-off-by: Felipe Contreras <redacted>
---
builtin/revert.c | 2 ++
builtin/sequencer.c | 17 ++++++++++++++---
builtin/sequencer.h | 2 ++
git-rebase--interactive.sh | 4 ++--
4 files changed, 20 insertions(+), 5 deletions(-)
@@ -46,6 +46,8 @@ struct replay_opts {/* Only used by REPLAY_NONE */structrev_info*revs;++constchar*action_name;};intsequencer_pick_revisions(structreplay_opts*opts);
@@ -18,12 +18,15 @@ esactest-n"$rebase_root"&&root_flag=--root+mkdir-p"$state_dir"||die"Could not create temporary $state_dir"+:>"$state_dir"/cherrypick||die"Could not mark as cherrypick"+ gitcherry-pick--allow-empty"$revisions"ret=$?iftest0!=$retthen-test-d"$state_dir"&&write_basic_state+write_basic_statereturn$retfi
@@ -3,6 +3,9 @@# Copyright (c) 2010 Junio C Hamano.#+GIT_CHERRY_PICK_HELP="$resolvemsg"+exportGIT_CHERRY_PICK_HELP+case"$action"incontinue)gitcherry-pick--continue&&
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
So that all the tests pass.
Signed-off-by: Felipe Contreras <redacted>
---
git-rebase--cherrypick.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
@@ -21,7 +21,22 @@ test -n "$rebase_root" && root_flag=--root mkdir-p"$state_dir"||die"Could not create temporary $state_dir" :>"$state_dir"/cherrypick||die"Could not mark as cherrypick"-gitcherry-pick--allow-empty"$revisions"+iftest-n"$rebase_root"+then+revisions="$onto...$orig_head"+else+revisions="$upstream...$orig_head"+fi++iftest-n"$keep_empty"+then+extra="--allow-empty"+else+extra="--skip-empty --cherry-pick"+fi+test-n"$GIT_QUIET"&&extra="$extra -q"+test-z"$force_rebase"&&extra="$extra --ff"+gitcherry-pick--no-merges--right-only--topo-order--do-walk$extra"$revisions"ret=$?iftest0!=$ret
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
We are not in am mode.
Signed-off-by: Felipe Contreras <redacted>
---
git-rebase--cherrypick.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
When there's changes in the staging area. Just like the other rebase
modes.
Signed-off-by: Felipe Contreras <redacted>
---
git-rebase--cherrypick.sh | 6 ++++++
1 file changed, 6 insertions(+)
@@ -8,6 +8,12 @@ export GIT_CHERRY_PICK_HELPcase"$action"incontinue)+# do we have anything to commit?+if!gitdiff-index--cached--quietHEAD--+then+gitcommit--no-verify-e||+die"Could not commit staged changes."+figitcherry-pick--continue&&move_to_original_branchreturn
@@ -412,10 +405,6 @@ if test -n "$interactive_rebase"thentype=interactivestate_dir="$merge_dir"-eliftest-n"$do_merge"-then-type=merge-state_dir="$merge_dir"eliftest-n"$git_am_opt"thentype=am
@@ -65,3 +65,19 @@ EOFtest_set_editor"$(pwd)/fake-editor.sh"chmoda+xfake-editor.sh}++# checks that the revisions in "$2" represent a linear range with the+# subjects in "$1"+test_linear_range(){+revlist_merges=$(gitrev-list--merges"$2")&&+test-z"$revlist_merges"&&+expected=$1+set--$(gitlog--reverse--format=%s"$2")+test"$expected"="$*"+}++reset_rebase(){+test_might_failgitrebase--abort&&+gitreset--hard&&+gitclean-f+}
@@ -0,0 +1,78 @@+#!/bin/sh++test_description='basic rebase topology tests'+../test-lib.sh+."$TEST_DIRECTORY"/lib-rebase.sh++# a---b---c+# \+# d---e+test_expect_success'setup''+test_commita&&+test_commitb&&+test_commitc&&+gitcheckoutb&&+test_commitd&&+test_commite+'++test_run_rebase(){+result=$1+shift+test_expect_$result"simple rebase $*""+reset_rebase&&+gitrebase$*ce&&+test_cmp_revcHEAD~2&&+test_linear_range'd e'c..+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* is no-op if upstream is an ancestor""+reset_rebase&&+gitrebase$*be&&+test_cmp_reveHEAD+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* -f rewrites even if upstream is an ancestor""+reset_rebase&&+gitrebase$*-fbe&&+!test_cmp_reveHEAD&&+test_cmp_revbHEAD~2&&+test_linear_range'd e'b..+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* fast-forwards from ancestor of upstream""+reset_rebase&&+gitrebase$*eb&&+test_cmp_reveHEAD+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_done
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
We should call 'git rebase --abort', like a normal user would do.
Signed-off-by: Felipe Contreras <redacted>
---
t/t3420-rebase-autostash.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -160,4 +160,62 @@ test_run_rebase success -m test_run_rebasesuccess-i test_run_rebasesuccess-p+# a---b---c---j!+# \+# d---k!--l+#+# ! = empty+test_expect_success'setup of linear history for empty commit tests''+gitcheckoutc&&+make_emptyj&&+gitcheckoutd&&+make_emptyk&&+test_commitl+'++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* drops empty commit""+reset_rebase&&+gitrebase$*cl&&+test_cmp_revcHEAD~2&&+test_linear_range'd l'c..+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --keep-empty""+reset_rebase&&+gitrebase$*--keep-emptycl&&+test_cmp_revcHEAD~3&&+test_linear_range'd k l'c..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --keep-empty keeps empty even if already in upstream""+reset_rebase&&+gitrebase$*--keep-emptyjl&&+test_cmp_revjHEAD~3&&+test_linear_range'd k l'j..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasefailure-i+test_run_rebasefailure-p+ test_done
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
From: Martin von Zweigbergk <redacted>
Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
t/lib-rebase.sh | 17 ++++++++
t/t3421-rebase-topology-linear.sh | 85 +++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+)
@@ -75,4 +75,89 @@ test_run_rebase success -m test_run_rebasesuccess-i test_run_rebasesuccess-p+# f+# /+# a---b---c---g---h+# \+# d---G---i+#+# uppercase = cherry-picked+# h = reverted g+#+# Reverted patches are there for tests to be able to check if a commit+# that introduced the same change as another commit is+# dropped. Without reverted commits, we could get false positives+# because applying the patch succeeds, but simply results in no+# changes.+test_expect_success'setup of linear history for range selection tests''+gitcheckoutc&&+test_commitg&&+reverthg&&+gitcheckoutd&&+cherry_pickGg&&+test_commiti&&+gitcheckoutb&&+test_commitf+'++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* drops patches in upstream""+reset_rebase&&+gitrebase$*hi&&+test_cmp_revhHEAD~2&&+test_linear_range'd i'h..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* can drop last patch if in upstream""+reset_rebase&&+gitrebase$*hG&&+test_cmp_revhHEAD^&&+test_linear_range'd'h..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --onto drops patches in upstream""+reset_rebase&&+gitrebase$*--ontofhi&&+test_cmp_revfHEAD~2&&+test_linear_range'd i'f..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --onto does not drop patches in onto""+reset_rebase&&+gitrebase$*--ontohfi&&+test_cmp_revhHEAD~3&&+test_linear_range'd G i'h..+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p+ test_done
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
From: Martin von Zweigbergk <redacted>
Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
t/t3421-rebase-topology-linear.sh | 129 ++++++++++++++++++++++++++++++++++++++
1 file changed, 129 insertions(+)
@@ -218,4 +218,133 @@ test_run_rebase failure -m test_run_rebasefailure-i test_run_rebasefailure-p+# m+# /+# a---b---c---g+#+# x---y---B+#+# uppercase = cherry-picked+# m = reverted b+#+# Reverted patches are there for tests to be able to check if a commit+# that introduced the same change as another commit is+# dropped. Without reverted commits, we could get false positives+# because applying the patch succeeds, but simply results in no+# changes.+test_expect_success'setup of linear history for test involving root''+gitcheckoutb&&+revertmb&&+gitcheckout--orphandisjoint&&+gitrm-rf.&&+test_commitx&&+test_commity&&+cherry_pickBb+'++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --onto --root""+reset_rebase&&+gitrebase$*--ontoc--rooty&&+test_cmp_revcHEAD~2&&+test_linear_range'x y'c..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* without --onto --root with disjoint history""+reset_rebase&&+gitrebase$*cy&&+test_cmp_revcHEAD~2&&+test_linear_range'x y'c..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --onto --root drops patch in onto""+reset_rebase&&+gitrebase$*--ontom--rootB&&+test_cmp_revmHEAD~2&&+test_linear_range'x y'm..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --onto --root with merge-base does not go to root""+reset_rebase&&+gitrebase$*--ontom--rootg&&+test_cmp_revmHEAD~2&&+test_linear_range'c g'm..+"+}++test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* without --onto --root with disjoint history drops patch in onto""+reset_rebase&&+gitrebase$*mB&&+test_cmp_revmHEAD~2&&+test_linear_range'x y'm..+"+}+test_run_rebasesuccess''+test_run_rebasefailure-m+test_run_rebasesuccess-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* --root on linear history is a no-op""+reset_rebase&&+gitrebase$*--rootc&&+test_cmp_revcHEAD+"+}+test_run_rebasefailure''+test_run_rebasefailure-m+test_run_rebasefailure-i+test_run_rebasefailure-p++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* -f --root on linear history causes re-write""+reset_rebase&&+gitrebase$*-f--rootc&&+!test_cmp_revaHEAD~2&&+test_linear_range'a b c'HEAD+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i+test_run_rebasesuccess-p+ test_done
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
From: Martin von Zweigbergk <redacted>
t3406 is supposed to test "messages from rebase operation", so let's
move tests in t3400 that fit that description into 3406. Most of the
functionality they tested, except for the messages, has now been
subsumed by t3420.
Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Junio C Hamano <redacted>
Conflicts:
t/t3406-rebase-message.sh
---
t/t3400-rebase.sh | 22 ----------------------
t/t3406-rebase-message.sh | 23 +++++++++++++++++++++++
2 files changed, 23 insertions(+), 22 deletions(-)
@@ -59,28 +59,6 @@ test_expect_success 'rebase against master' 'gitrebasemaster'-test_expect_success'rebase against master twice''-gitrebasemaster>out&&-test_i18ngrep"Current branch my-topic-branch is up to date"out-'--test_expect_success'rebase against master twice with --force''-gitrebase--force-rebasemaster>out&&-test_i18ngrep"Current branch my-topic-branch is up to date, rebase forced"out-'--test_expect_success'rebase against master twice from another branch''-gitcheckoutmy-topic-branch^&&-gitrebasemastermy-topic-branch>out&&-test_i18ngrep"Current branch my-topic-branch is up to date"out-'--test_expect_success'rebase fast-forward to master''-gitcheckoutmy-topic-branch^&&-gitrebasemy-topic-branch>out&&-test_i18ngrep"Fast-forwarded HEAD to my-topic-branch"out-'- test_expect_success'the rebase operation should not have destroyed author information''!(gitlog|grep"Author:"|grep"<>")'
@@ -17,6 +17,29 @@ test_expect_success 'setup' 'gittagstart'+test_expect_success'rebase against master twice''+gitrebase-mmaster&&+gitrebasemaster>out&&+test_i18ngrep"Current branch topic is up to date"out+'++test_expect_success'rebase against master twice with --force''+gitrebase--force-rebasemaster>out&&+test_i18ngrep"Current branch topic is up to date, rebase forced"out+'++test_expect_success'rebase against master twice from another branch''+gitcheckouttopic^&&+gitrebasemastertopic>out&&+test_i18ngrep"Current branch topic is up to date"out+'++test_expect_success'rebase fast-forward to master''+gitcheckouttopic^&&+gitrebasetopic>out&&+test_i18ngrep"Fast-forwarded HEAD to topic"out+'+ test_expect_success'rebase --stat''gitreset--hardstart&&gitrebase--statmaster>diffstat.txt&&
@@ -106,31 +99,9 @@ test_expect_success 'rebase from ambiguous branch name' 'gitrebasemaster'-test_expect_success'rebase after merge master''-gitcheckout--detachrefs/tags/topic&&-gitbranch-Dtopic&&-gitreset--hardtopic&&-gitmergemaster&&-gitrebasemaster&&-!(gitshow|grep"^Merge:")-'--test_expect_success'rebase of history with merges is linearized''-gitcheckoutnonlinear&&-test4=$(gitrev-listmaster..|wc-l)&&-gitrebasemaster&&-test3=$(gitrev-listmaster..|wc-l)-'--test_expect_success'rebase of history with merges after upstream merge is linearized''-gitcheckoutupstream-merged-nonlinear&&-test5=$(gitrev-listmaster..|wc-l)&&-gitrebasemaster&&-test3=$(gitrev-listmaster..|wc-l)-'- test_expect_success'rebase a single mode change''gitcheckoutmaster&&+gitbranch-Dtopic&&echo1>X&&gitaddX&&test_tick&&
@@ -1,45 +0,0 @@-#!/bin/sh-#-# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland-#--test_description='git rebase should detect patches integrated upstream--This test cherry-picks one local change of two into master branch, and-checks that git rebase succeeds with only the second patch in the-local branch.-'-. ./test-lib.sh--test_expect_success 'prepare repository with topic branch' '- test_commit A &&- git checkout -b my-topic-branch &&- test_commit B &&- test_commit C &&- git checkout -f master &&- test_commit A2 A.t-'--test_expect_success 'pick top patch from topic branch into master' '- git cherry-pick C &&- git checkout -f my-topic-branch-'--test_debug '- git cherry master &&- git format-patch -k --stdout --full-index master >/dev/null &&- gitk --all & sleep 1-'--test_expect_success 'rebase topic branch against new master and check git am did not get halted' '- git rebase master &&- test_path_is_missing .git/rebase-apply-'--test_expect_success 'rebase --merge topic branch that was partially merged upstream' '- git reset --hard C &&- git rebase --merge master &&- test_path_is_missing .git/rebase-merge-'--test_done
@@ -477,19 +477,11 @@ test_expect_success 'interrupted squash works as expected (case 2)' 'test$one=$(gitrev-parseHEAD~2)'-test_expect_success'ignore patch if in upstream''-HEAD=$(gitrev-parseHEAD)&&-gitcheckout-bhas-cherry-pickedHEAD^&&+test_expect_success'--continue tries to commit, even for "edit"''echounrelated>file7&&gitaddfile7&&test_tick&&gitcommit-m"unrelated change"&&-gitcherry-pick$HEAD&&-EXPECT_COUNT=1gitrebase-i$HEAD&&-test$HEAD=$(gitrev-parseHEAD^)-'--test_expect_success'--continue tries to commit, even for "edit"''parent=$(gitrev-parseHEAD^)&&test_tick&&FAKE_LINES="edit 1"gitrebase-iHEAD^&&
@@ -0,0 +1,258 @@+#!/bin/sh++test_description='rebase topology tests with merges'+../test-lib.sh+."$TEST_DIRECTORY"/lib-rebase.sh++test_revision_subjects(){+expected="$1"+shift+set--$(gitlog--format=%s--no-walk=unsorted"$@")+test"$expected"="$*"+}++# a---b-----------c+# \ \+# d-------e \+# \ \ \+# n---o---w---v+# \+# z+test_expect_success'setup of non-linear-history''+test_commita&&+test_commitb&&+test_commitc&&+gitcheckoutb&&+test_commitd&&+test_commite++gitcheckoutc&&+test_commitg&&+reverthg&&+gitcheckoutd&&+cherry_pickGg&&+test_commiti&&+gitcheckoutb&&+test_commitf++gitcheckoutd&&+test_commitn&&+test_commito&&+test_mergewe&&+test_mergevc&&+gitcheckouto&&+test_commitz+'++test_run_rebase(){+result=$1+shift+test_expect_$result"rebase $* after merge from upstream""+reset_rebase&&+gitrebase$*ew&&+test_cmp_reveHEAD~2&&+test_linear_range'n o'e..+"+}+test_run_rebasesuccess''+test_run_rebasesuccess-m+test_run_rebasesuccess-i++test_run_rebase(){+result=$1+shift+expected=$1+shift+test_expect_$result"rebase $* of non-linear history is linearized in place""+reset_rebase&&+gitrebase$*dw&&+test_cmp_revdHEAD~3&&+test_linear_range"\'"$expected"\'"d..+"+}+#TODO: make order consistent across all flavors of rebase+test_run_rebasesuccess'e n o'''+test_run_rebasesuccess'e n o'-m+test_run_rebasesuccess'n o e'-i++test_run_rebase(){+result=$1+shift+expected=$1+shift+test_expect_$result"rebase $* of non-linear history is linearized upstream""+reset_rebase&&+gitrebase$*cw&&+test_cmp_revcHEAD~4&&+test_linear_range"\'"$expected"\'"c..+"+}+#TODO: make order consistent across all flavors of rebase+test_run_rebasesuccess'd e n o'''+test_run_rebasesuccess'd e n o'-m+test_run_rebasesuccess'd n o e'-i++test_run_rebase(){+result=$1+shift+expected=$1+shift+test_expect_$result"rebase $* of non-linear history with merges after upstream merge is linearized""+reset_rebase&&+gitrebase$*cv&&+test_cmp_revcHEAD~4&&+test_linear_range"\'"$expected"\'"c..+"+}+#TODO: make order consistent across all flavors of rebase+test_run_rebasesuccess'd e n o'''+test_run_rebasesuccess'd e n o'-m+test_run_rebasesuccess'd n o e'-i++test_expect_success"rebase -p is no-op in non-linear history""+reset_rebase&&+gitrebase-pdw&&+test_cmp_revwHEAD+"++test_expect_success"rebase -p is no-op when base inside second parent""+reset_rebase&&+gitrebase-pew&&+test_cmp_revwHEAD+"++test_expect_failure"rebase -p --root on non-linear history is a no-op""+reset_rebase&&+gitrebase-p--rootw&&+test_cmp_revwHEAD+"++test_expect_success"rebase -p re-creates merge from side branch""+reset_rebase&&+gitrebase-pzw&&+test_cmp_revzHEAD^&&+test_cmp_revw^2HEAD^2+"++test_expect_success"rebase -p re-creates internal merge""+reset_rebase&&+gitrebase-pcw&&+test_cmp_revcHEAD~4&&+test_cmp_revHEAD^2^HEAD~3&&+test_revision_subjects'd n e o w'HEAD~3HEAD~2HEAD^2HEAD^HEAD+"++test_expect_success"rebase -p can re-create two branches on onto""+reset_rebase&&+gitrebase-p--ontocdw&&+test_cmp_revcHEAD~3&&+test_cmp_revcHEAD^2^&&+test_revision_subjects'n e o w'HEAD~2HEAD^2HEAD^HEAD+"++# f+# /+# a---b---c---g---h+# \+# d---G---i+# \ \+# e-------u+#+# uppercase = cherry-picked+# h = reverted g+test_expect_success'setup of non-linear-history for patch-equivalence tests''+gitcheckoute&&+test_mergeui+'++test_expect_success"rebase -p re-creates history around dropped commit matching upstream""+reset_rebase&&+gitrebase-phu&&+test_cmp_revhHEAD~3&&+test_cmp_revHEAD^2^HEAD~2&&+test_revision_subjects'd i e u'HEAD~2HEAD^2HEAD^HEAD+"++test_expect_success"rebase -p --onto in merged history drops patches in upstream""+reset_rebase&&+gitrebase-p--ontofhu&&+test_cmp_revfHEAD~3&&+test_cmp_revHEAD^2^HEAD~2&&+test_revision_subjects'd i e u'HEAD~2HEAD^2HEAD^HEAD+"++test_expect_success"rebase -p --onto in merged history does not drop patches in onto""+reset_rebase&&+gitrebase-p--ontohfu&&+test_cmp_revhHEAD~3&&+test_cmp_revHEAD^2~2HEAD~2&&+test_revision_subjects'd G i e u'HEAD~2HEAD^2^HEAD^2HEAD^HEAD+"++# a---b---c---g---h+# \+# d---G---s+# \ \ /+# \ X+# \ / \+# e---t+#+# uppercase = cherry-picked+# h = reverted g+test_expect_success'setup of non-linear-history for dropping whole side''+gitcheckoutG&&+test_mergese&&+gitcheckoute&&+test_mergetG+'++test_expect_failure"rebase -p drops merge commit when entire first-parent side is dropped""+reset_rebase&&+gitrebase-phs&&+test_cmp_revhHEAD~2&&+test_linear_range'd e'h..+"++test_expect_success"rebase -p drops merge commit when entire second-parent side is dropped""+reset_rebase&&+gitrebase-pht&&+test_cmp_revhHEAD~2&&+test_linear_range'd e'h..+"++# a---b---c+# \+# d---e+# \ \+# n---r+# \+# o+#+# r = tree-same with n+test_expect_success'setup of non-linear-history for empty commits''+gitcheckoutn&&+gitmerge--no-commite&&+gitresetn.&&+gitcommit-mr&&+gitreset--hard&&+gitclean-f&&+gittagr+'++test_expect_success"rebase -p re-creates empty internal merge commit""+reset_rebase&&+gitrebase-pcr&&+test_cmp_revcHEAD~3&&+test_cmp_revHEAD^2^HEAD~2&&+test_revision_subjects'd e n r'HEAD~2HEAD^2HEAD^HEAD+"++test_expect_success"rebase -p re-creates empty merge commit""+reset_rebase&&+gitrebase-por&&+test_cmp_reveHEAD^2&&+test_cmp_revoHEAD^&&+test_revision_subjects'r'HEAD+"++test_done
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
From: Martin von Zweigbergk <redacted>
Update the following:
- Quote 'setup'
- Remove blank lines within test case body
- Use test_commit instead of custom quick_one
- Create branch "topic" from tag created by test_commit
Signed-off-by: Martin von Zweigbergk <redacted>
Signed-off-by: Junio C Hamano <redacted>
Conflicts:
t/t3406-rebase-message.sh
---
t/t3406-rebase-message.sh | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
@@ -70,9 +70,8 @@ test_run_rebase () {test_linear_range"\'"$expected"\'"d.."}-#TODO: make order consistent across all flavors of rebase-test_run_rebasesuccess'e n o'''-test_run_rebasesuccess'e n o'-m+test_run_rebasesuccess'n o e'''+test_run_rebasesuccess'n o e'-m test_run_rebasesuccess'n o e'-i test_run_rebase(){
@@ -87,9 +86,8 @@ test_run_rebase () {test_linear_range"\'"$expected"\'"c.."}-#TODO: make order consistent across all flavors of rebase-test_run_rebasesuccess'd e n o'''-test_run_rebasesuccess'd e n o'-m+test_run_rebasesuccess'd n o e'''+test_run_rebasesuccess'd n o e'-m test_run_rebasesuccess'd n o e'-i test_run_rebase(){
@@ -104,9 +102,8 @@ test_run_rebase () {test_linear_range"\'"$expected"\'"c.."}-#TODO: make order consistent across all flavors of rebase-test_run_rebasesuccess'd e n o'''-test_run_rebasesuccess'd e n o'-m+test_run_rebasesuccess'd n o e'''+test_run_rebasesuccess'd n o e'-m test_run_rebasesuccess'd n o e'-i test_expect_success"rebase -p is no-op in non-linear history""
@@ -244,7 +244,7 @@ test_expect_success 'setup for avoiding reapplying old patches' ' test_expect_success'git pull --rebase does not reapply old patches''(cddst&&test_must_failgitpull--rebase&&-test1=$(find.git/rebase-apply-name"000*"|wc-l)+test1=$(cat.git/sequencer/todo|wc-l))'
@@ -92,7 +92,7 @@ test_expect_success 'multiple dcommit from git svn will not clobber svn' " test_expect_success'check that rebase really failed''-test-d.git/rebase-apply+test-d.git/rebase-merge' test_expect_success'resolve, continue the rebase and dcommit'"
@@ -1589,13 +1558,16 @@ int cmd_commit(int argc, const char **argv, const char *prefix)run_hook(get_index_file(),"post-commit",NULL);if(amend&&!no_post_rewrite){structnotes_rewrite_cfg*cfg;+structrewrittenrewrite;+memset(&rewrite,0,sizeof(rewrite));cfg=init_copy_notes_for_rewrite("amend");if(cfg){/* we are amending, so current_head is not NULL */copy_note_for_rewrite(cfg,current_head->object.sha1,sha1);finish_copy_notes_for_rewrite(cfg);}-run_rewrite_hook(current_head->object.sha1,sha1);+add_rewritten(&rewrite,current_head->object.sha1,sha1);+run_rewrite_hook(&rewrite,"amend");}if(!quiet)print_summary(prefix,sha1,!current_head);
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
This code is only useful for cherry-pick and revert built-ins, nothing
else, so let's make it a builtin object.
The first source file that doesn't generate a git-foo builtin, but does
go into the builtin library. Hopefully the first of many to clean
libgit.a.
Signed-off-by: Felipe Contreras <redacted>
---
Makefile | 10 ++++++----
sequencer.c => builtin/sequencer.c | 0
sequencer.h => builtin/sequencer.h | 0
3 files changed, 6 insertions(+), 4 deletions(-)
rename sequencer.c => builtin/sequencer.c (100%)
rename sequencer.h => builtin/sequencer.h (100%)
diff --git a/sequencer.c b/builtin/sequencer.csimilarity index 100%rename from sequencer.crename to builtin/sequencer.cdiff --git a/sequencer.h b/builtin/sequencer.hsimilarity index 100%rename from sequencer.hrename to builtin/sequencer.h
--
1.8.3.698.g079b096
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
Commit 416fda6 (build: do not install git-remote-testpy) made it so
git-remote-testpy is not only not installed, but also not generated by
default, let's make sure tests scripts (NO_INSTALL) are generated as
ell.
Comments-by: Junio C Hamano [off-list ref]
Signed-off-by: Felipe Contreras <redacted>
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Antoine Pelisse <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 9, 2013 at 6:40 PM, Felipe Contreras
[off-list ref] wrote:
This code is only useful for cherry-pick and revert built-ins, nothing
else, so let's make it a builtin object.
The first source file that doesn't generate a git-foo builtin, but does
go into the builtin library. Hopefully the first of many to clean
libgit.a.
Hey Felipe,
I don't understand why the code doesn't belong to libgit.a, and how
it's gonna make it more "clean". I can see that it is needed only by
revert and cherry-pick, but is that the only reason ?
Thanks for taking the time to enlighten me :)
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 9, 2013 at 12:02 PM, Antoine Pelisse [off-list ref] wrote:
On Sun, Jun 9, 2013 at 6:40 PM, Felipe Contreras
[off-list ref] wrote:
quoted
This code is only useful for cherry-pick and revert built-ins, nothing
else, so let's make it a builtin object.
The first source file that doesn't generate a git-foo builtin, but does
go into the builtin library. Hopefully the first of many to clean
libgit.a.
Hey Felipe,
I don't understand why the code doesn't belong to libgit.a, and how
it's gonna make it more "clean". I can see that it is needed only by
revert and cherry-pick, but is that the only reason ?
Thanks for taking the time to enlighten me :)
A libgit library should be useful for things other than builtin
commands. Eventually libgit.a should be similar to libgit2, therefore
if libgit2 wouldn't want sequencer.c in it (it doesn't) neither should
we want this code in libgit.a. It belongs in builtin/lib.a.
If we don't start moving non-library stuff out of libgit.a, libgit.a
will never be a library.
--
Felipe Contreras
I don't understand why the code doesn't belong to libgit.a, and how
it's gonna make it more "clean". I can see that it is needed only by
revert and cherry-pick, but is that the only reason ?
From: Antoine Pelisse <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 9, 2013 at 7:07 PM, Ramkumar Ramachandra [off-list ref] wrote:
Antoine Pelisse wrote:
quoted
I don't understand why the code doesn't belong to libgit.a, and how
it's gonna make it more "clean". I can see that it is needed only by
revert and cherry-pick, but is that the only reason ?
From: SZEDER Gábor <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 09, 2013 at 11:40:15AM -0500, Felipe Contreras wrote:
There's no need to list again the prerequisites.
Signed-off-by: Felipe Contreras <redacted>
Please write more shortlog-friendly subject lines describing what the
actual change is.
In this case for example: "build: substitute library prerequisites
using $^"
Your arguments were unconvincing. The mere fact that I raised this
issue unbeknownst to the earlier posting clearly shows that there's
demand for descriptive subjects.
Your arguments were unconvincing. The mere fact that I raised this
issue unbeknownst to the earlier posting clearly shows that there's
demand for descriptive subjects.
Not to mention that with your subject no body is needed, making the
overall message more succinct.
When reading a log, as soon as I see "trivial" I become suspicious that
someone is trying to cover something up, much like "left as an exercise
for the reader". If the subject says "fix memory leak" then it's
obvious what the patch is meant to do, and when there is no subtlety to
be explained (as there isn't in this patch) there is no need for a body.
Your arguments were unconvincing. The mere fact that I raised this
issue unbeknownst to the earlier posting clearly shows that there's
demand for descriptive subjects.
Not to mention that with your subject no body is needed, making the
overall message more succinct.
It's not succinct at all, because there's no short and quick
description of what the patch actually is; a trivial fix.
When reading a log, as soon as I see "trivial" I become suspicious that
someone is trying to cover something up, much like "left as an exercise
for the reader". If the subject says "fix memory leak" then it's
obvious what the patch is meant to do, and when there is no subtlety to
be explained (as there isn't in this patch) there is no need for a body.
You are not a rational person then. The commit message has absolutely
no bearing on the quality of the code. If you are less suspicious of a
commit message that says "fix memory leak", you are being completely
biased.
Whether the commit message says "fix memory leak", or "trivial fix",
or "foobar", the code might still be doing something wrong, and you
can't decide that until you look at the code.
If you don't care about the code, but still want to know what the
patch is doing, then you can look at the whole commit message, and "We
should free objects before leaving." explains that perfectly.
For the people that only read the summary, the vast majority of them
need to know what this patch is, not what it does, and when they see
"trivial fix" they most likely can skip it.
--
Felipe Contreras
From: Fredrik Gustafsson <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 09, 2013 at 11:40:21AM -0500, Felipe Contreras wrote:
By using good ol' goto.
Signed-off-by: Felipe Contreras <redacted>
I don't see this as an indentation change but as a restructing of the
code. I would prefer something more like
"Replace early return with goto cleanup" (but better phrased).
The same goes for the next patch in this serie, I would prefer if the
shortlog tells what have been done, not how hard it was to do. Even
trivial changes can introduce bugs and when the commit message is just
that "this is trivial" it forces me to read the diff to know if that's
something that can effect me or not.
+leave:
free_message(&msg);
free(defmsg);
leave: should be cleanup: or out: to conform with already written code. I
suppose there will be a lot of those changes from now on and it will be
easier if the name of the cleanup-label always is the same.
Maybe small things to review, but I think those things will lead to a
better code-base in the long term.
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 9, 2013 at 1:17 PM, Fredrik Gustafsson [off-list ref] wrote:
On Sun, Jun 09, 2013 at 11:40:21AM -0500, Felipe Contreras wrote:
quoted
By using good ol' goto.
Signed-off-by: Felipe Contreras <redacted>
I don't see this as an indentation change but as a restructing of the
code. I would prefer something more like
"Replace early return with goto cleanup" (but better phrased).
The explains what the patch is doing, but not why. Why is more important.
The same goes for the next patch in this serie, I would prefer if the
shortlog tells what have been done, not how hard it was to do.
It explains what it is, and why it makes sense.
--
Felipe Contreras
And it could the opinion of a thousand more people, it doesn't make it
anything more than an opinion. To think anything else is to fall in
argumentum ad populum.
--
Felipe Contreras
Your arguments were unconvincing. The mere fact that I raised this
issue unbeknownst to the earlier posting clearly shows that there's
demand for descriptive subjects.
Not to mention that with your subject no body is needed, making the
overall message more succinct.
It's not succinct at all, because there's no short and quick
description of what the patch actually is; a trivial fix.
Is it not equally succinct to say "fix memory leak"?
quoted
When reading a log, as soon as I see "trivial" I become suspicious that
someone is trying to cover something up, much like "left as an exercise
for the reader". If the subject says "fix memory leak" then it's
obvious what the patch is meant to do, and when there is no subtlety to
be explained (as there isn't in this patch) there is no need for a body.
You are not a rational person then. The commit message has absolutely
no bearing on the quality of the code. If you are less suspicious of a
commit message that says "fix memory leak", you are being completely
biased.
Whether the commit message says "fix memory leak", or "trivial fix",
or "foobar", the code might still be doing something wrong, and you
can't decide that until you look at the code.
I have a certain level of trust that commit summaries in git.git will be
accurate. If I want to know what has changed, then "fix memory leak"
implies "no functional change"; if I see "trivial fix" then how do I
know what that is? It could be a whitespace change, a fix to a memory
leak, a typo correction, a change to a separator in a message shown to
the user, or even a small change to corner case behaviour.
If you don't care about the code, but still want to know what the
patch is doing, then you can look at the whole commit message, and "We
should free objects before leaving." explains that perfectly.
The short message is what appears in "What's Cooking", why should I need
to break out of my mail client to find out what it means?
From: Fredrik Gustafsson <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
The explains what the patch is doing, but not why. Why is more important.
You're right. Why are the indentation useless? It doesn't seem to be
useless until you added goto. So why is your goto solution better than
the previous existing solution?
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
Your arguments were unconvincing. The mere fact that I raised this
issue unbeknownst to the earlier posting clearly shows that there's
demand for descriptive subjects.
Not to mention that with your subject no body is needed, making the
overall message more succinct.
It's not succinct at all, because there's no short and quick
description of what the patch actually is; a trivial fix.
Is it not equally succinct to say "fix memory leak"?
Almost. "fix memory leak" doesn't say anything about the scope; it can
be a huge change, or a trivial one.
Perhaps "trivial memory leak fix" would be better.
quoted
quoted
When reading a log, as soon as I see "trivial" I become suspicious that
someone is trying to cover something up, much like "left as an exercise
for the reader". If the subject says "fix memory leak" then it's
obvious what the patch is meant to do, and when there is no subtlety to
be explained (as there isn't in this patch) there is no need for a body.
You are not a rational person then. The commit message has absolutely
no bearing on the quality of the code. If you are less suspicious of a
commit message that says "fix memory leak", you are being completely
biased.
Whether the commit message says "fix memory leak", or "trivial fix",
or "foobar", the code might still be doing something wrong, and you
can't decide that until you look at the code.
I have a certain level of trust that commit summaries in git.git will be
accurate. If I want to know what has changed, then "fix memory leak"
implies "no functional change"; if I see "trivial fix" then how do I
know what that is?
It is a trivial fix, that's what it is. You don't need to bother
yourself with it. Unless you plan to see the code.
It could be a whitespace change,
That's not a fix, that's a cleanup.
a fix to a memory leak, a typo correction, a change to a separator in a message shown to
the user,
You might be right, but I don't think you _need_ to know which one of
them it is; they are all trivial. In 90% of the cases you want to skip
them and keep reading. In the 10% where you do need more, well, you
probably need to look at the code either way.
or even a small change to corner case behaviour.
That's not trivial.
quoted
If you don't care about the code, but still want to know what the
patch is doing, then you can look at the whole commit message, and "We
should free objects before leaving." explains that perfectly.
The short message is what appears in "What's Cooking", why should I need
to break out of my mail client to find out what it means?
You don't, it's a trivial fix, and you said you have a certain level
of trust on commit summaries ;)
--
Felipe Contreras
From: Fredrik Gustafsson <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 09, 2013 at 11:40:43AM -0500, Felipe Contreras wrote:
- git_am_opt="$git_am_opt -q"
This one makes me wonder a bit. I'm not sure about how this works in
git, so I would appriciate if someone can explain. I might also have
misunderstood something.
Here we have two sh-scripts (git rebase
and git am) interacting witch eachother. Both uses GIT_QUIET, so if
GIT_QUIET already is set by the caller (git rebase) the callee doesn't
have to set it to.
However GIT_QUIET is undocumented for git-am (in Git Manual). If we
translate git am to C/ruby/python/perl/etc. will we catch this?
This raises a few more generall questions:
do we already pass information between processes(!) with enviroment
variables? And is this documented the way it should be?
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
From: Felipe Contreras <hidden> Date: 2016-06-15 22:57:38
On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson [off-list ref] wrote:
On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
quoted
The explains what the patch is doing, but not why. Why is more important.
You're right. Why are the indentation useless? It doesn't seem to be
useless until you added goto. So why is your goto solution better than
the previous existing solution?
Because it removes useless indentation :)
This is what they do in the Linux kernel, you tell me which looks better:
a)
if (function1())
goto leave;
if (function2())
goto leave;
if (function3())
goto leave;
if (function4())
goto leave;
good_stuff();
leave:
final_stuff();
or b)
if (!function1()) {
if (!function2()) {
if (!function3()) {
if (!function4()) {
good_stuff();
}
}
}
}
final_stuff();
--
Felipe Contreras
Shouldn't this result in the error "empty commit set passed"? If so,
shouldn't that be checked to actually print that error?
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
From: Fredrik Gustafsson <hidden> Date: 2016-06-15 22:57:39
On Sun, Jun 09, 2013 at 02:16:29PM -0500, Felipe Contreras wrote:
On Sun, Jun 9, 2013 at 2:08 PM, Fredrik Gustafsson [off-list ref] wrote:
quoted
On Sun, Jun 09, 2013 at 01:19:03PM -0500, Felipe Contreras wrote:
quoted
The explains what the patch is doing, but not why. Why is more important.
You're right. Why are the indentation useless? It doesn't seem to be
useless until you added goto. So why is your goto solution better than
the previous existing solution?
Because it removes useless indentation :)
This is what they do in the Linux kernel, you tell me which looks better:
a)
if (function1())
goto leave;
if (function2())
goto leave;
if (function3())
goto leave;
if (function4())
goto leave;
good_stuff();
leave:
final_stuff();
or b)
if (!function1()) {
if (!function2()) {
if (!function3()) {
if (!function4()) {
good_stuff();
}
}
}
}
final_stuff();
--
Felipe Contreras
Oh, so this is purely a "this code style is better than the current
code style"-patch? I won't argue with that. I simply trust Junio in such
cases, I had such discussions with him before.
I thought it was partly to increase cleanup capabilities to. For
example, why isn't msg and defmsg freed when "return allow"?
Still wonder about introducing a new label name for cleanup.
--
Med vänliga hälsningar
Fredrik Gustafsson
tel: 0733-608274
e-post: iveqy@iveqy.com
I think I'd prefer a mixture of both.
"sequencer: trivial fix: free objects before leaving".
This gives the best of both worlds in that the 'triviality' is plainly
there to see, and so is the type of triviality, just in case it has some
un-noticed side effect that someone is looking for at a leter date
Same goes for "build: trivial cleanup: don't repeat prerequisites"
[PATCH v4 03/45]
All the best,
Philip
@@ -70,9 +70,8 @@ test_run_rebase () {test_linear_range"\'"$expected"\'"d.."}-#TODO: make order consistent across all flavors of rebase-test_run_rebasesuccess'e n o'''-test_run_rebasesuccess'e n o'-m+test_run_rebasesuccess'n o e'''+test_run_rebasesuccess'n o e'-m test_run_rebasesuccess'n o e'-i
If you do end up re-sending the series on top of my series, I'd prefer
to see the end result having the first argument inlined, so these few
lines become simply:
test_run_rebase success ''
test_run_rebase success -m
test_run_rebase success -i
@@ -70,9 +70,8 @@ test_run_rebase () {test_linear_range"\'"$expected"\'"d.."}-#TODO: make order consistent across all flavors of rebase-test_run_rebasesuccess'e n o'''-test_run_rebasesuccess'e n o'-m+test_run_rebasesuccess'n o e'''+test_run_rebasesuccess'n o e'-m test_run_rebasesuccess'n o e'-i
If you do end up re-sending the series on top of my series, I'd prefer
to see the end result having the first argument inlined, so these few
lines become simply:
Somebody else would need to do that, there's no point in me sending
these patches, just to increase the number of my patches that get
completely ignored by Junio.
--
Felipe Contreras