{"thread":{"id":"15044","subject":"[PATCH] Improve error output of git-rebase without any arguments","startedAt":"2008-08-17T00:26:21Z","lastAt":"2008-08-17T05:55:04Z","messageCount":6,"participants":["Stephan Beyer","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"87394","messageId":"1218932781-30475-1-git-send-email-s-beyer@gmx.net","threadId":"15044","inReplyTo":null,"subject":"[PATCH] Improve error output of git-rebase without any arguments","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-08-17T00:26:21Z","receivedAt":"2008-08-17T00:26:21Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"\"git rebase\" without arguments on initial startup showed:\n\n\tfatal: Needed a single revision\n\tinvalid upstream\n\nThis patch makes it show the ordinary usage string.\nFor the case that .git/rebase-{apply,merge} exists,\n\n\tA rebase is in progress, try --continue, --skip or --abort.\n\nis shown now.\n\nSigned-off-by: Stephan Beyer <s-beyer@gmx.net>\n---\n\tStumbled across this today and looks for me like\n\ta patch for 1.6.0 :-)\n\n git-rebase.sh |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 412e135..fe669ad 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -146,6 +146,12 @@ is_interactive () {\n \n is_interactive \"$@\" && exec git-rebase--interactive \"$@\"\n \n+if test $# -eq 0\n+then\n+\ttest -d \"$dotest\" -o -d \"$GIT_DIR\"/rebase-apply || usage\n+\tdie 'A rebase is in progress, try --continue, --skip or --abort.'\n+fi\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -277,7 +283,7 @@ It seems that I cannot create a '\"$GIT_DIR\"'/rebase-apply directory,\n and I wonder if you are in the middle of patch application or another\n rebase.  If that is not the case, please\n \trm -fr '\"$GIT_DIR\"'/rebase-apply\n- and run me again.  I am stopping in case you still have something\n+and run me again.  I am stopping in case you still have something\n valuable there.'\n \t\texit 1\n \tfi\n-- \n1.6.0.rc3.308.g5b83\n"},{"id":"87395","messageId":"7v1w0ocqow.fsf@gitster.siamese.dyndns.org","threadId":"15044","inReplyTo":"1218932781-30475-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH] Improve error output of git-rebase without any arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-17T02:37:19Z","receivedAt":"2008-08-17T02:37:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephan Beyer <s-beyer@gmx.net> writes:\n\n> \tStumbled across this today and looks for me like\n> \ta patch for 1.6.0 :-)\n\nIs presense of \"$dotest\" or \"$GIT_DIR/rebase-apply\" a _sure sign_ that\nallows you to say \"A rebase is in progress\" with confidence?\n\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 412e135..fe669ad 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -146,6 +146,12 @@ is_interactive () {\n>  \n>  is_interactive \"$@\" && exec git-rebase--interactive \"$@\"\n>  \n> +if test $# -eq 0\n> +then\n> +\ttest -d \"$dotest\" -o -d \"$GIT_DIR\"/rebase-apply || usage\n> +\tdie 'A rebase is in progress, try --continue, --skip or --abort.'\n> +fi\n> +\n>  while test $# != 0\n>  do\n>  \tcase \"$1\" in\n"},{"id":"87400","messageId":"1218945930-29281-1-git-send-email-s-beyer@gmx.net","threadId":"15044","inReplyTo":"7v1w0ocqow.fsf@gitster.siamese.dyndns.org","subject":"[PATCH try2] Improve error output of git-rebase","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-08-17T04:05:30Z","receivedAt":"2008-08-17T04:05:30Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"\"git rebase\" without arguments on initial startup showed:\n\n\tfatal: Needed a single revision\n\tinvalid upstream\n\nThis patch makes it show the ordinary usage string.\n\nIf .git/rebase-apply exists, this patch tries to make the error message\nslightly more exact:\n - if .git/rebase-apply/applying exists, the error message supposes that\n   we are in the middle of git-am\n - if .git/rebase-apply/rebasing exists, it is perhaps another rebase.\n\nSigned-off-by: Stephan Beyer <s-beyer@gmx.net>\n---\n\tHi,\n\n\tJunio C Hamano wrote:\n\t> Stephan Beyer <s-beyer@gmx.net> writes:\n\t>~\n\t> > ^...Stumbled across this today and looks for me like\n\t> > ^...a patch for 1.6.0 :-)\n\t>~\n\t> Is presense of \"$dotest\" or \"$GIT_DIR/rebase-apply\" a _sure sign_ that\n\t> allows you to say \"A rebase is in progress\" with confidence?\n\n\tCurrently this is a sure sign that either a git-rebase or a git-am is\n\tin progress.\n\tI considered the existence of .git/rebase-apply/applying and\n\t.git/rebase-apply/rebasing as a good way to determine which one it is\n\tif .git/rebase-apply exists.\n\n\tAlso there already are two error messages that could be used, so I\n\tuse them and are only a little more exact.\n\n\tRegards,\n\t  Stephan\n\n git-rebase.sh |   23 ++++++++++++++++-------\n 1 files changed, 16 insertions(+), 7 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 412e135..850c58a 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -146,6 +146,10 @@ is_interactive () {\n \n is_interactive \"$@\" && exec git-rebase--interactive \"$@\"\n \n+# If no arguments are given and there is no git-am/git-rebase in\n+# progress, print the usage string and die.\n+test $# -ne 0 -o -d \"$dotest\" -o -d \"$GIT_DIR\"/rebase-apply || usage\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -265,19 +269,24 @@ do\n \tshift\n done\n \n-# Make sure we do not have $GIT_DIR/rebase-apply\n+# Make sure we do not have $GIT_DIR/rebase-apply nor $dotest\n if test -z \"$do_merge\"\n then\n-\tif mkdir \"$GIT_DIR\"/rebase-apply\n+\tif mkdir \"$GIT_DIR\"/rebase-apply 2>/dev/null\n \tthen\n \t\trmdir \"$GIT_DIR\"/rebase-apply\n \telse\n+\t\twhat='a patch application or another rebase.'\n+\t\ttest -f \"$GIT_DIR\"/rebase-apply/applying &&\n+\t\t\twhat='a patch application (git-am).'\n+\t\ttest -f \"$GIT_DIR\"/rebase-apply/rebasing &&\n+\t\t\twhat='another rebase.'\n \t\techo >&2 '\n-It seems that I cannot create a '\"$GIT_DIR\"'/rebase-apply directory,\n-and I wonder if you are in the middle of patch application or another\n-rebase.  If that is not the case, please\n+It seems that I cannot create a rebase-apply directory, and I wonder\n+if you are in the middle of '\"$what\"'\n+If that is not the case, please\n \trm -fr '\"$GIT_DIR\"'/rebase-apply\n- and run me again.  I am stopping in case you still have something\n+and run me again.  I am stopping in case you still have something\n valuable there.'\n \t\texit 1\n \tfi\n@@ -285,7 +294,7 @@ else\n \tif test -d \"$dotest\"\n \tthen\n \t\tdie \"previous rebase directory $dotest still exists.\" \\\n-\t\t\t'try git-rebase < --continue | --abort >'\n+\t\t\t'Try git-rebase (--continue | --abort | --skip)'\n \tfi\n fi\n \n-- \n1.6.0.rc3.312.ge6010a\n"},{"id":"87401","messageId":"20080817041135.GA23513@leksak.fem-net","threadId":"15044","inReplyTo":"1218945930-29281-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH try2] Improve error output of git-rebase","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-08-17T04:11:35Z","receivedAt":"2008-08-17T04:11:35Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"Hi,\n\nStephan Beyer wrote:\n> @@ -285,7 +294,7 @@ else\n>  \tif test -d \"$dotest\"\n>  \tthen\n>  \t\tdie \"previous rebase directory $dotest still exists.\" \\\n> -\t\t\t'try git-rebase < --continue | --abort >'\n> +\t\t\t'Try git-rebase (--continue | --abort | --skip)'\n\t\t\t\t^^\n\t\t\tThis should perhaps be dashless. :\\\n\nAnd when \"git rebase -m\" has been invoked, a conflict occurs and the\nuser is typing \"git rebase\", then\n\n\tfatal: Needed a single revision\n\tinvalid upstream\n\nshows up again. So the patch does not affect all cases... :|\n\nRegards\n\n-- \nStephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F\n"},{"id":"87402","messageId":"1218947143-12734-1-git-send-email-s-beyer@gmx.net","threadId":"15044","inReplyTo":"20080817041135.GA23513@leksak.fem-net","subject":"[PATCH try3] Improve error output of git-rebase","fromName":"Stephan Beyer","fromEmail":"s-beyer@gmx.net","sentAt":"2008-08-17T04:25:43Z","receivedAt":"2008-08-17T04:25:43Z","isPatch":true,"sender":{"key":"s-beyer@gmx.net","avatar":"https://avatars.githubusercontent.com/u/143889?v=4"},"body":"\"git rebase\" without arguments on initial startup showed:\n\n\tfatal: Needed a single revision\n\tinvalid upstream\n\nThis patch makes it show the ordinary usage string.\n\nIf .git/rebase-merge or .git/rebase-apply/rebasing exists, git-rebase\nwill die with a message saying that a rebase is in progress and the user\nshould try --skip/--abort/--continue.\n\nIf .git/rebase-apply/applying exists, git-rebase will die with a message\nsaying that git-am is in progress, regardless how many arguments are\ngiven.\n\nIf no arguments are given and .git/rebase-apply/ exists, but neither a\nrebasing nor applying file is in that directory, git-rebase dies with a\nmessage saying that rebase-apply exists and no arguments were given.\n\nSigned-off-by: Stephan Beyer <s-beyer@gmx.net>\n---\n\tI've stashed away *these* changes before I made up the try2 patch.\n\tI tested several cases and I think it is ok.\n\n\tSorry for all the noise.\n\n\tRegards\n\n git-rebase.sh |   21 ++++++++++++++++-----\n 1 files changed, 16 insertions(+), 5 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 412e135..528b604 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -144,8 +144,19 @@ is_interactive () {\n \tdone && test -n \"$1\"\n }\n \n+test -f \"$GIT_DIR\"/rebase-apply/applying &&\n+\tdie 'It looks like git-am is in progress. Cannot rebase.'\n+\n is_interactive \"$@\" && exec git-rebase--interactive \"$@\"\n \n+if test $# -eq 0\n+then\n+\ttest -d \"$dotest\" -o -d \"$GIT_DIR\"/rebase-apply || usage\n+\ttest -d \"$dotest\" -o -f \"$GIT_DIR\"/rebase-apply/rebasing &&\n+\t\tdie 'A rebase is in progress, try --continue, --skip or --abort.'\n+\tdie \"No arguments given and $GIT_DIR/rebase-apply already exists.\"\n+fi\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -268,16 +279,16 @@ done\n # Make sure we do not have $GIT_DIR/rebase-apply\n if test -z \"$do_merge\"\n then\n-\tif mkdir \"$GIT_DIR\"/rebase-apply\n+\tif mkdir \"$GIT_DIR\"/rebase-apply 2>/dev/null\n \tthen\n \t\trmdir \"$GIT_DIR\"/rebase-apply\n \telse\n \t\techo >&2 '\n-It seems that I cannot create a '\"$GIT_DIR\"'/rebase-apply directory,\n-and I wonder if you are in the middle of patch application or another\n+It seems that I cannot create a rebase-apply directory, and\n+I wonder if you are in the middle of patch application or another\n rebase.  If that is not the case, please\n \trm -fr '\"$GIT_DIR\"'/rebase-apply\n- and run me again.  I am stopping in case you still have something\n+and run me again.  I am stopping in case you still have something\n valuable there.'\n \t\texit 1\n \tfi\n@@ -285,7 +296,7 @@ else\n \tif test -d \"$dotest\"\n \tthen\n \t\tdie \"previous rebase directory $dotest still exists.\" \\\n-\t\t\t'try git-rebase < --continue | --abort >'\n+\t\t\t'Try git rebase (--continue | --abort | --skip)'\n \tfi\n fi\n \n-- \n1.6.0.rc3.18.gc698c8\n"},{"id":"87412","messageId":"7v7iag9oef.fsf@gitster.siamese.dyndns.org","threadId":"15044","inReplyTo":"1218947143-12734-1-git-send-email-s-beyer@gmx.net","subject":"Re: [PATCH try3] Improve error output of git-rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-17T05:55:04Z","receivedAt":"2008-08-17T05:55:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephan Beyer <s-beyer@gmx.net> writes:\n\n> \"git rebase\" without arguments on initial startup showed:\n>\n> \tfatal: Needed a single revision\n> \tinvalid upstream\n>\n> This patch makes it show the ordinary usage string.\n\n> \tI've stashed away *these* changes before I made up the try2 patch.\n> \tI tested several cases and I think it is ok.\n\nThanks, this round looks safe and sane.\n"}]}