{"thread":{"id":"8716","subject":"[PATCH 1/3] rebase -i: several cleanups","startedAt":"2007-06-25T17:56:55Z","lastAt":"2007-06-27T10:33:22Z","messageCount":6,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"45781","messageId":"Pine.LNX.4.64.0706251856300.4059@racer.site","threadId":"8716","inReplyTo":null,"subject":"[PATCH 1/3] rebase -i: several cleanups","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-25T17:56:55Z","receivedAt":"2007-06-25T17:56:55Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSupport \"--verbose\" in addition to \"-v\", show short names in the list\ncomment, clean up if there is nothing to do, and add several \"test_ticks\"\nin the test script.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-rebase--interactive.sh    |   19 +++++++++++++++----\n t/t3404-rebase-interactive.sh |    2 ++\n 2 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex ab36572..b95fe86 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -60,6 +60,11 @@ die_with_patch () {\n \tdie \"$2\"\n }\n \n+die_abort () {\n+\trm -rf \"$DOTEST\" 2> /dev/null\n+\tdie \"$1\"\n+}\n+\n pick_one () {\n \tcase \"$1\" in -n) sha1=$2 ;; *) sha1=$1 ;; esac\n \tgit rev-parse --verify $sha1 || die \"Invalid commit name: $sha1\"\n@@ -212,7 +217,7 @@ do\n \t-C*)\n \t\tdie \"Interactive rebase uses merge, so $1 does not make sense\"\n \t\t;;\n-\t-v)\n+\t-v|--verbose)\n \t\tVERBOSE=t\n \t\t;;\n \t-i|--interactive)\n@@ -264,8 +269,11 @@ do\n \t\techo $ONTO > \"$DOTEST\"/onto\n \t\ttest t = \"$VERBOSE\" && : > \"$DOTEST\"/verbose\n \n+\t\tSHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)\n+\t\tSHORTHEAD=$(git rev-parse --short $HEAD)\n+\t\tSHORTONTO=$(git rev-parse --short $ONTO)\n \t\tcat > \"$TODO\" << EOF\n-# Rebasing $UPSTREAM..$HEAD onto $ONTO\n+# Rebasing $SHORTUPSTREAM)..$SHORTHEAD onto $SHORTONTO\n #\n # Commands:\n #  pick = use commit\n@@ -277,13 +285,16 @@ EOF\n \t\t\tsed \"s/^/pick /\" >> \"$TODO\"\n \n \t\ttest -z \"$(grep -ve '^$' -e '^#' < $TODO)\" &&\n-\t\t\tdie \"Nothing to do\"\n+\t\t\tdie_abort \"Nothing to do\"\n \n \t\tcp \"$TODO\" \"$TODO\".backup\n \t\t${VISUAL:-${EDITOR:-vi}} \"$TODO\" ||\n \t\t\tdie \"Could not execute editor\"\n \n-\t\tgit reset --hard $ONTO && do_rest\n+\t\ttest -z \"$(grep -ve '^$' -e '^#' < $TODO)\" &&\n+\t\t\tdie_abort \"Nothing to do\"\n+\n+\t\tgit checkout $ONTO && do_rest\n \tesac\n \tshift\n done\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 48aa8ea..19a3a8e 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -140,6 +140,7 @@ test_expect_success 'abort' '\n test_expect_success 'retain authorship' '\n \techo A > file7 &&\n \tgit add file7 &&\n+\ttest_tick &&\n \tGIT_AUTHOR_NAME=\"Twerp Snog\" git commit -m \"different author\" &&\n \tgit tag twerp &&\n \tgit rebase -i --onto master HEAD^ &&\n@@ -149,6 +150,7 @@ test_expect_success 'retain authorship' '\n test_expect_success 'squash' '\n \tgit reset --hard twerp &&\n \techo B > file7 &&\n+\ttest_tick &&\n \tGIT_AUTHOR_NAME=\"Nitfol\" git commit -m \"nitfol\" file7 &&\n \techo \"******************************\" &&\n \tFAKE_LINES=\"1 squash 2\" git rebase -i --onto master HEAD~2 &&\n-- \n1.5.2.2.3172.ge55a1-dirty\n"},{"id":"45867","messageId":"7vk5tqurrw.fsf@assigned-by-dhcp.pobox.com","threadId":"8716","inReplyTo":"Pine.LNX.4.64.0706251856300.4059@racer.site","subject":"Re: [PATCH 1/3] rebase -i: several cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-27T01:09:55Z","receivedAt":"2007-06-27T01:09:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Support \"--verbose\" in addition to \"-v\", show short names in the list\n> comment, clean up if there is nothing to do, and add several \"test_ticks\"\n> in the test script.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  git-rebase--interactive.sh    |   19 +++++++++++++++----\n>  t/t3404-rebase-interactive.sh |    2 ++\n>  2 files changed, 17 insertions(+), 4 deletions(-)\n>\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index ab36572..b95fe86 100755\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -60,6 +60,11 @@ die_with_patch () {\n>  \tdie \"$2\"\n>  }\n>  \n> +die_abort () {\n> +\trm -rf \"$DOTEST\" 2> /dev/null\n> +\tdie \"$1\"\n> +}\n\nWhy \"2>/dev/null\" here?\n\n> @@ -264,8 +269,11 @@ do\n>  \t\techo $ONTO > \"$DOTEST\"/onto\n>  \t\ttest t = \"$VERBOSE\" && : > \"$DOTEST\"/verbose\n>  \n> +\t\tSHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)\n> +\t\tSHORTHEAD=$(git rev-parse --short $HEAD)\n> +\t\tSHORTONTO=$(git rev-parse --short $ONTO)\n>  \t\tcat > \"$TODO\" << EOF\n> -# Rebasing $UPSTREAM..$HEAD onto $ONTO\n> +# Rebasing $SHORTUPSTREAM)..$SHORTHEAD onto $SHORTONTO\n\nWhat is this close-paren about?  Is it a typo?\n"},{"id":"45868","messageId":"Pine.LNX.4.64.0706270216070.4438@racer.site","threadId":"8716","inReplyTo":"7vk5tqurrw.fsf@assigned-by-dhcp.pobox.com","subject":"Re: [PATCH 1/3] rebase -i: several cleanups","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-27T01:17:08Z","receivedAt":"2007-06-27T01:17:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 26 Jun 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Support \"--verbose\" in addition to \"-v\", show short names in the list\n> > comment, clean up if there is nothing to do, and add several \"test_ticks\"\n> > in the test script.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> >  git-rebase--interactive.sh    |   19 +++++++++++++++----\n> >  t/t3404-rebase-interactive.sh |    2 ++\n> >  2 files changed, 17 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> > index ab36572..b95fe86 100755\n> > --- a/git-rebase--interactive.sh\n> > +++ b/git-rebase--interactive.sh\n> > @@ -60,6 +60,11 @@ die_with_patch () {\n> >  \tdie \"$2\"\n> >  }\n> >  \n> > +die_abort () {\n> > +\trm -rf \"$DOTEST\" 2> /dev/null\n> > +\tdie \"$1\"\n> > +}\n> \n> Why \"2>/dev/null\" here?\n\nJust to be sure. If it does not exist, it's no error. No sense alarming \nthe user.\n\n> > @@ -264,8 +269,11 @@ do\n> >  \t\techo $ONTO > \"$DOTEST\"/onto\n> >  \t\ttest t = \"$VERBOSE\" && : > \"$DOTEST\"/verbose\n> >  \n> > +\t\tSHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)\n> > +\t\tSHORTHEAD=$(git rev-parse --short $HEAD)\n> > +\t\tSHORTONTO=$(git rev-parse --short $ONTO)\n> >  \t\tcat > \"$TODO\" << EOF\n> > -# Rebasing $UPSTREAM..$HEAD onto $ONTO\n> > +# Rebasing $SHORTUPSTREAM)..$SHORTHEAD onto $SHORTONTO\n> \n> What is this close-paren about?  Is it a typo?\n\nDarn. It _is_ a typo. I overlooked it _both_ when typing _and_ when \nlooking at the result.\n\nSorry.\n\nCiao,\nDscho\n"},{"id":"45875","messageId":"7vodj2tazk.fsf@assigned-by-dhcp.pobox.com","threadId":"8716","inReplyTo":"Pine.LNX.4.64.0706270216070.4438@racer.site","subject":"Re: [PATCH 1/3] rebase -i: several cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-27T01:57:51Z","receivedAt":"2007-06-27T01:57:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> > +die_abort () {\n>> > +\trm -rf \"$DOTEST\" 2> /dev/null\n>> > +\tdie \"$1\"\n>> > +}\n>> \n>> Why \"2>/dev/null\" here?\n>\n> Just to be sure. If it does not exist, it's no error. No sense alarming \n> the user.\n\nYeah, but isn't that exactly why you have \"-f\" there?  On the\nother hand, if $DOTEST exists but for some reason couldn't be\nremoved, we probably would want to know about it.\n\n    $ rm -fr no-such\n    $ mkdir no-such\n    $ echo >no-such/file\n    $ rm -fr no-such\n    $ mkdir no-such\n    $ echo >no-such/file\n    $ chmod a-w no-such\n    $ rm -fr no-such\n    rm: cannot remove `no-such/file': Permission denied\n"},{"id":"45874","messageId":"7vk5tqtavf.fsf@assigned-by-dhcp.pobox.com","threadId":"8716","inReplyTo":"Pine.LNX.4.64.0706270216070.4438@racer.site","subject":"Re: [PATCH 1/3] rebase -i: several cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-27T02:00:20Z","receivedAt":"2007-06-27T02:00:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> > @@ -264,8 +269,11 @@ do\n>> >  \t\techo $ONTO > \"$DOTEST\"/onto\n>> >  \t\ttest t = \"$VERBOSE\" && : > \"$DOTEST\"/verbose\n>> >  \n>> > +\t\tSHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)\n>> > +\t\tSHORTHEAD=$(git rev-parse --short $HEAD)\n>> > +\t\tSHORTONTO=$(git rev-parse --short $ONTO)\n>> >  \t\tcat > \"$TODO\" << EOF\n>> > -# Rebasing $UPSTREAM..$HEAD onto $ONTO\n>> > +# Rebasing $SHORTUPSTREAM)..$SHORTHEAD onto $SHORTONTO\n>> \n>> What is this close-paren about?  Is it a typo?\n>\n> Darn. It _is_ a typo. I overlooked it _both_ when typing _and_ when \n> looking at the result.\n\nNo worries; will fix up.  I just wanted to make sure that I did\nnot know the notation that had some meaning.\n"},{"id":"45902","messageId":"Pine.LNX.4.64.0706271130020.4438@racer.site","threadId":"8716","inReplyTo":"7vodj2tazk.fsf@assigned-by-dhcp.pobox.com","subject":"Re: [PATCH 1/3] rebase -i: several cleanups","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-27T10:33:22Z","receivedAt":"2007-06-27T10:33:22Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 26 Jun 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> > +die_abort () {\n> >> > +\trm -rf \"$DOTEST\" 2> /dev/null\n> >> > +\tdie \"$1\"\n> >> > +}\n> >> \n> >> Why \"2>/dev/null\" here?\n> >\n> > Just to be sure. If it does not exist, it's no error. No sense alarming \n> > the user.\n> \n> Yeah, but isn't that exactly why you have \"-f\" there?  On the\n> other hand, if $DOTEST exists but for some reason couldn't be\n> removed, we probably would want to know about it.\n> \n>     $ rm -fr no-such\n>     $ mkdir no-such\n>     $ echo >no-such/file\n>     $ rm -fr no-such\n>     $ mkdir no-such\n>     $ echo >no-such/file\n>     $ chmod a-w no-such\n>     $ rm -fr no-such\n>     rm: cannot remove `no-such/file': Permission denied\n\nGood point.\n\nOkay, let's leave the 2> /dev/null out.\n\nCiao,\nDscho\n"}]}