From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:20
Non-interactive rebase requires the working tree to be clean, but
applies what is in the index without requiring the user to do it
herself. Imitate that, but (since we are interactive, after all)
fire up an editor with the commit message.
It also fixes a subtle bug: a forgotten "continue" was removed, which
led to an infinite loop when continuing without remaining patches.
Both issues noticed by Frank Lichtenheld.
Signed-off-by: Johannes Schindelin <redacted>
---
git-rebase--interactive.sh | 25 ++++++++++++++++---------
t/t3404-rebase-interactive.sh | 16 +++++++++++++++-
2 files changed, 31 insertions(+), 10 deletions(-)
@@ -201,6 +203,7 @@ do_next () {gitcat-filecommit$sha1|sed-e'1,/^$/d'>>"$MSG"gitreset--softHEAD^author_script=$(get_author_ident_from_commit$sha1)+echo"$author_script">"$DOTEST"/author-scriptcase$failedinf)# This is like --amend, but with a different message
@@ -212,10 +215,6 @@ do_next () {cp"$MSG""$GIT_DIR"/MERGE_MSGwarnwarn"Could not apply $sha1... $rest"-warn"After you fixed that, commit the result with"-warn-warn" $(echo$author_script|tr'\012'' ') \\"-warn" git commit -F \"$GIT_DIR\"/MERGE_MSG -e"die_with_patch$sha1""esac;;
@@ -265,6 +264,14 @@ dotest-d"$DOTEST"||die"No interactive rebase running"+# commit if necessary+gitrev-parse--verifyHEAD>/dev/null&&+gitupdate-index--refresh&&+gitdiff-files--quiet&&+!gitdiff-index--cached--quietHEAD&&+."$DOTEST"/author-script&&+gitcommit-F"$DOTEST"/message-e+require_clean_work_treedo_rest;;
@@ -265,6 +264,14 @@ do test -d "$DOTEST" || die "No interactive rebase running"+ # commit if necessary+ git rev-parse --verify HEAD > /dev/null &&+ git update-index --refresh &&+ git diff-files --quiet &&+ ! git diff-index --cached --quiet HEAD &&+ . "$DOTEST"/author-script &&+ git commit -F "$DOTEST"/message -e+
Oh well. For this to work, there has to be a line
export GIT_AUTHOR_NAME GIT_AUTHOR_NAME GIT_AUTHOR_DATE &&
before the "git commit" line, I think.
Ciao,
Dscho
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:21
Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:
Non-interactive rebase requires the working tree to be clean, but
applies what is in the index without requiring the user to do it
herself. Imitate that, but (since we are interactive, after all)
fire up an editor with the commit message.
Could we also have "git rebase <base> <branch>"?
I find it useful when I have many branches to rebase:
~/project @master$ git rebase master branch1
~/project @branch1$ git rebase master branch2
~/project @branch2$ git rebase master branch3
...
Otherwise one have to, for example, "git checkout branch1" first,
and only then run rebase-interactive. Checkout is not very pleasant
operation on windows if you have many files (well, nothing is pleasant
there, but this one have to be done often). Rebase-interactive is
*very* slow there, but I just could not part with it after having
tried it once :)
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:25
Hi,
On Fri, 13 Jul 2007, Alex Riesen wrote:
Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:
quoted
Non-interactive rebase requires the working tree to be clean, but
applies what is in the index without requiring the user to do it
herself. Imitate that, but (since we are interactive, after all)
fire up an editor with the commit message.
Could we also have "git rebase <base> <branch>"?
Don't we do that already? AFAICT it is already in the synopsis, ever
since rebase -i was introduced into the "next" branch, on June 25...
Ciao,
Dscho
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:25
Johannes Schindelin, Wed, Aug 01, 2007 17:57:25 +0200:
On Fri, 13 Jul 2007, Alex Riesen wrote:
quoted
Johannes Schindelin, Sun, Jul 08, 2007 04:01:29 +0200:
quoted
Non-interactive rebase requires the working tree to be clean, but
applies what is in the index without requiring the user to do it
herself. Imitate that, but (since we are interactive, after all)
fire up an editor with the commit message.
Could we also have "git rebase <base> <branch>"?
Don't we do that already? AFAICT it is already in the synopsis, ever
since rebase -i was introduced into the "next" branch, on June 25...
Err... "git rebase -i <base> <branch>"
Does not work, just checked:
$ git rebase -i base branch
/usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent
cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory
Invalid branchname: branch
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:25
When calling "git rebase -i <upstream> <branch>", git should switch
to <branch> first. This worked before, but I broke it by my
"Shut git rebase -i up" patch.
Fix that, and add a test to make sure that it does not break again.
Signed-off-by: Johannes Schindelin <redacted>
---
On Wed, 1 Aug 2007, Alex Riesen wrote:
> Johannes Schindelin, Wed, Aug 01, 2007 17:57:25 +0200:
> > On Fri, 13 Jul 2007, Alex Riesen wrote:
> >
> > > Could we also have "git rebase <base> <branch>"?
> >
> > Don't we do that already? AFAICT it is already in the
> > synopsis, ever since rebase -i was introduced into the "next"
> > branch, on June 25...
> >
>
> Err... "git rebase -i <base> <branch>"
>
> Does not work, just checked:
>
> $ git rebase -i base branch
> /usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent
> cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory
> Invalid branchname: branch
Sorry...
git-rebase--interactive.sh | 2 +-
t/t3404-rebase-interactive.sh | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
@@ -405,6 +405,7 @@ dorequire_clean_work_tree+mkdir"$DOTEST"||die"Could not create temporary $DOTEST"iftest!-z"$2"thenoutputgitshow-ref--verify--quiet"refs/heads/$2"||
@@ -418,7 +419,6 @@ dotest-z"$ONTO"&&ONTO=$UPSTREAM-mkdir"$DOTEST"||die"Could not create temporary $DOTEST":>"$DOTEST"/interactive||die"Could not mark as interactive"gitsymbolic-refHEAD>"$DOTEST"/head-name||die"Could not get HEAD"
@@ -98,6 +98,14 @@ test_expect_success 'no changes are a nop' 'test$(gitrev-parseI)=$(gitrev-parseHEAD)'+test_expect_success'test the [branch] option''+gitcheckout-bdead-end&&+gitrmfile6&&+gitcommit-m"stop here"&&+gitrebase-iFbranch2&&+test$(gitrev-parseI)=$(gitrev-parseHEAD)+'+ test_expect_success'rebase on top of a non-conflicting commit''gitcheckoutbranch1&&gittagoriginal-branch1&&
From: Alex Riesen <hidden> Date: 2016-06-15 22:43:25
Signed-off-by: Alex Riesen <redacted>
---
git-rebase--interactive.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Alex Riesen, Wed, Aug 01, 2007 23:45:56 +0200:
$ git rebase -i base branch
/usr/local/bin/git-rebase--interactive: 482: cannot create /home/user/projects/tmp/.git/.dotest-merge/output: Directory nonexistent
cat: /home/user/projects/tmp/.git/.dotest-merge/output: No such file or directory
Invalid branchname: branch
Oh... Sometimes I can *very* slow. I believe it is as simple as that
git-rebase--interactive.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -404,6 +404,7 @@ doesacrequire_clean_work_tree+mkdir"$DOTEST"||die"Could not create temporary $DOTEST"iftest!-z"$2"then
@@ -418,7 +419,6 @@ dotest-z"$ONTO"&&ONTO=$UPSTREAM-mkdir"$DOTEST"||die"Could not create temporary $DOTEST":>"$DOTEST"/interactive||die"Could not mark as interactive"gitsymbolic-refHEAD>"$DOTEST"/head-name||die"Could not get HEAD"
@@ -404,6 +404,7 @@ doesacrequire_clean_work_tree+mkdir"$DOTEST"||die"Could not create temporary $DOTEST"iftest!-z"$2"then
@@ -418,7 +419,6 @@ dotest-z"$ONTO"&&ONTO=$UPSTREAM-mkdir"$DOTEST"||die"Could not create temporary $DOTEST":>"$DOTEST"/interactive||die"Could not mark as interactive"gitsymbolic-refHEAD>"$DOTEST"/head-name||die"Could not get HEAD"
Heh. I take that as an ACK from you to my patch? Mine has a test case,
too ;-)
Ciao,
Dscho