{"thread":{"id":"1454","subject":"\"git revert\" (Re: pci_update_resource() getting called on sparc64)","startedAt":"2005-08-08T19:57:44Z","lastAt":"2005-08-09T00:13:53Z","messageCount":12,"participants":["Linus Torvalds","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"6947","messageId":"Pine.LNX.4.58.0508081257190.3258@g5.osdl.org","threadId":"1454","inReplyTo":"Pine.LNX.4.58.0508081249110.3258@g5.osdl.org","subject":"\"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-08T19:57:44Z","receivedAt":"2005-08-08T19:57:44Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nComments?\n\n\t\tLinus\n\nOn Mon, 8 Aug 2005, Linus Torvalds wrote:\n> \n> \n> On Mon, 8 Aug 2005, Greg KH wrote:\n> > \n> > Hm, how do you revert a git patch?\n> \n> Something like this?\n> \n> \t#!/bin/sh\n> \t. git-sh-setup-script || die \"Not a git archive\"\n> \trev=$(git-rev-parse --verify --revs-only \"$@\") || exit\n> \tgit-diff-tree -R -p $rev | git-apply --index &&\n> \t\techo \"Revert $rev\" | git commit\n> \n> Just name it \"git-revert-script\" and it might do what you want to do.\n> \n> It may not have the nicest error messages: if you try to revert a merge\n> (which won't have a diff), git-apply will say something like\n> \n> \tfatal: No changes\n> \n> which isn't exactly being helpful. And the revert message could be made \n> more interesting (like putting the first line of the description of what \n> we reverted into the message instead of just the revision number).\n> \n> \t\tLinus\n> \n"},{"id":"6949","messageId":"7vd5oo40mq.fsf@assigned-by-dhcp.cox.net","threadId":"1454","inReplyTo":"Pine.LNX.4.58.0508081257190.3258@g5.osdl.org","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T20:47:09Z","receivedAt":"2005-08-08T20:47:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n>> It may not have the nicest error messages: if you try to revert a merge\n>> (which won't have a diff), git-apply will say something like\n>> \n>> \tfatal: No changes\n>> \n>> which isn't exactly being helpful. And the revert message could be made \n>> more interesting (like putting the first line of the description of what \n>> we reverted into the message instead of just the revision number).\n\n> Comments?\n>\n> \t\tLinus\n\nI like the general idea, and if we had a commit pretty format\n\"oneline\", then something like this would make it look nicer.\n\nTotally untested.  I acquired your habit of coding in my e-mail\nclient ;-).\n\n        #!/bin/sh\n        . git-sh-setup-script || die \"Not a git archive\"\n\n        rev=$(git-rev-parse --verify --revs-only \"$@\") &&\n        commit=$(git-rev-parse --verify --revs-only \"$commit^0\") || exit\n        if git-diff-tree -R -p $commit | git-apply --index &&\n           msg=$(git-rev-list --pretty=oneline --max-count=1 $commit)\n        then\n                {\n                        echo \"Revert $msg\"\n                        echo\n                        echo \"This reverts $commit commit.\"\n                        test \"$rev\" = \"$commit\" ||\n                        echo \"(original 'git revert' arguments: $@)\"\n                } | git commit\n        else\n                # Now why did it fail?\n                parents=`git-cat-file commit \"$commit\" 2>/dev/null |\n                        sed -ne '/^$/q;/^parent /p' |\n                        wc -l`\n                case $parents in\n                0) die \"Cannot revert the root commit nor non commit-ish\" ;;\n                1) die \"The patch does not apply\" ;;\n                *) die \"Cannot revert a merge commit\" ;;\n                esac\n        fi\n"},{"id":"6951","messageId":"Pine.LNX.4.58.0508081357020.3258@g5.osdl.org","threadId":"1454","inReplyTo":"7vd5oo40mq.fsf@assigned-by-dhcp.cox.net","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-08T20:59:18Z","receivedAt":"2005-08-08T20:59:18Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 8 Aug 2005, Junio C Hamano wrote:\n> \n> Totally untested.  I acquired your habit of coding in my e-mail\n> client ;-).\n\nLooks good. Although I also have this advanced testing habit of just \nreading the email and if it looks sane it tested out ok ;)\n\nBut it strikes me that we could use the \"-M\" flag to git-diff-tree, which\nmakes it a lot more likely that we can revert renames, even if the file\nhas been slightly changed afterwards.\n\n\t\t\tLinus\n"},{"id":"6952","messageId":"7voe882kds.fsf@assigned-by-dhcp.cox.net","threadId":"1454","inReplyTo":"Pine.LNX.4.58.0508081357020.3258@g5.osdl.org","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T21:23:27Z","receivedAt":"2005-08-08T21:23:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Mon, 8 Aug 2005, Junio C Hamano wrote:\n>> \n>> Totally untested.  I acquired your habit of coding in my e-mail\n>> client ;-).\n>\n> Looks good. Although I also have this advanced testing habit of just \n> reading the email and if it looks sane it tested out ok ;)\n\nHeh, I immediately spotted two bugs after I sent it out, one\nmine, another yours.\n\n * dereferencing potential tag to get to the underlying commit\n   was a good idea of mine, poorly executed.  It should\n   rev-parse $rev^0, not $commit^0.\n\n * git commit does not take commit message from stdin.  I think\n   we should do something like this:\n\ndiff --git a/git-commit-script b/git-commit-script\n--- a/git-commit-script\n+++ b/git-commit-script\n@@ -92,11 +92,13 @@ then\n \trm .editmsg\n \texit 1\n fi\n-case \"$use_commit\" in\n-'')\n+if test -t 0 && \"$use_commit\" = \"\"\n+then\n \t${VISUAL:-${EDITOR:-vi}} .editmsg\n-\t;;\n-esac\n+else\n+\techo >&2 \"(reading commit message from standard input)\"\n+\tcat >.editmsg\n+fi\n grep -v '^#' < .editmsg | git-stripspace > .cmitmsg\n [ -s .cmitmsg ] && \n \ttree=$(git-write-tree) &&\n"},{"id":"6954","messageId":"Pine.LNX.4.63.0508082329170.2934@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1454","inReplyTo":"7voe882kds.fsf@assigned-by-dhcp.cox.net","subject":"git-commit-script, was Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-08T21:30:59Z","receivedAt":"2005-08-08T21:30:59Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 8 Aug 2005, Junio C Hamano wrote:\n\n>  * git commit does not take commit message from stdin.  I think\n>    we should do something like this:\n>\n> [...]\n\nAnd could we rename the *-m* flag at the same time? Because I often catch \nmyself typing\n\n\tgit commit -m \"Some_commit_message\"\n\nCiao,\nDscho\n"},{"id":"6955","messageId":"7vhde02jab.fsf@assigned-by-dhcp.cox.net","threadId":"1454","inReplyTo":"Pine.LNX.4.63.0508082329170.2934@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: git-commit-script, was Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T21:47:08Z","receivedAt":"2005-08-08T21:47:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> And could we rename the *-m* flag at the same time? Because I often catch \n> myself typing\n>\n> \tgit commit -m \"Some_commit_message\"\n\nSure, what's the alternative spelling for the current -m,\nthough?  Would -c be OK for commit?\n"},{"id":"6956","messageId":"Pine.LNX.4.58.0508081444040.3258@g5.osdl.org","threadId":"1454","inReplyTo":"7voe882kds.fsf@assigned-by-dhcp.cox.net","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-08T21:58:35Z","receivedAt":"2005-08-08T21:58:35Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 8 Aug 2005, Junio C Hamano wrote:\n> \n>  * git commit does not take commit message from stdin.  I think\n>    we should do something like this:\n\nYes. Alteratively (or additionally), we should add a command line option \nto set the commit message.\n\nCVS uses \"-m\", but you already took that. I forget what BK used, but I \nthink it was \"-Y\" (with lowercase \"-y\" being \"take message from file\". Or \nmaybe the other way around).\n\nOr if you want to be more CVS-like, use \"-F\", and accept \"-\" for stdin?\n\nBut I like \"test -t 0\" regardless. Very few editors are ok with non-tty\nstdin, although I could imagine some disturbed individual having \"ed\" as\ntheir editor and expecting to be able to pipe commands into it or\nsomething.\n\n\t\tLinus\n"},{"id":"6957","messageId":"Pine.LNX.4.58.0508081458550.3258@g5.osdl.org","threadId":"1454","inReplyTo":"7vhde02jab.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-commit-script, was Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-08T22:01:41Z","receivedAt":"2005-08-08T22:01:41Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 8 Aug 2005, Junio C Hamano wrote:\n> \n> Sure, what's the alternative spelling for the current -m,\n> though?  Would -c be OK for commit?\n\nHow about using long names?\n\n\tgit commit --reuse-message <sha1>\n\nlooks a lot more intuitively understandable to me than something like \"-c\"\n\nMost of us don't use 300bps terminals any more, so typing a few extra \ncharacters is probably ok.\n\nNow, to make things be backwards-compatible, it should be easy enough to \nnotice\n\n   \"Oh, the argument to '-m' is just a single SHA1, let's see if it's a\n    commit, and turn '-m' into '--reuse-message' automatically\"\n\nIf anybody cares. Does cogito already use \"-m\"?\n\n\t\tLinus\n"},{"id":"6961","messageId":"7vd5oo11wj.fsf@assigned-by-dhcp.cox.net","threadId":"1454","inReplyTo":"Pine.LNX.4.58.0508081444040.3258@g5.osdl.org","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T22:47:56Z","receivedAt":"2005-08-08T22:47:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Or if you want to be more CVS-like, use \"-F\", and accept \"-\" for stdin?\n\nYes my vote goes:\n\n\t-m \"message\"\n        -c \"from this commit, literally.\"\n        -C \"from this commit, but let me edit the log further.\"\n        -F \"from this file.\"\n        -F - <stdin\n\n> But I like \"test -t 0\" regardless. Very few editors are ok with non-tty\n> stdin, although I could imagine some disturbed individual having \"ed\" as\n> their editor and expecting to be able to pipe commands into it or\n> something.\n\nI am a disturbed individual who always works in Emacs and run\n\"git commit\" in the compilation buffer, setting EDITOR to\nemacsclient.  Admittably the compilation buffer uses pty, so\n\"test -t 0\" would succeed, though.\n"},{"id":"6963","messageId":"7v4qa011gc.fsf@assigned-by-dhcp.cox.net","threadId":"1454","inReplyTo":"Pine.LNX.4.58.0508081458550.3258@g5.osdl.org","subject":"Re: git-commit-script, was Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T22:57:39Z","receivedAt":"2005-08-08T22:57:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> Most of us don't use 300bps terminals any more, so typing a few extra \n> characters is probably ok.\n\nAgain you are right.\n"},{"id":"6967","messageId":"Pine.LNX.4.63.0508090202140.3860@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1454","inReplyTo":"7vd5oo11wj.fsf@assigned-by-dhcp.cox.net","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-09T00:03:46Z","receivedAt":"2005-08-09T00:03:46Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 8 Aug 2005, Junio C Hamano wrote:\n\n> Linus Torvalds <torvalds@osdl.org> writes:\n> \n> > Or if you want to be more CVS-like, use \"-F\", and accept \"-\" for stdin?\n> \n> Yes my vote goes:\n> \n> \t-m \"message\"\n>         -c \"from this commit, literally.\"\n>         -C \"from this commit, but let me edit the log further.\"\n>         -F \"from this file.\"\n>         -F - <stdin\n\nThe royal penguin speaketh, and the little blue penguin gets a fish:\n\n[PATCH] git commit usage is more like cvs's\n\nTeach git-commit-script about different ways to provide a commit message,\nincluding the famous -m flag from CVS.\n\n---\n\n git-commit-script |   48 ++++++++++++++++++++++++++++++++++--------------\n 1 files changed, 34 insertions(+), 14 deletions(-)\n\n457d879496cb5f742ed6bccc9a435f414b0fd2a7\ndiff --git a/git-commit-script b/git-commit-script\n--- a/git-commit-script\n+++ b/git-commit-script\n@@ -6,20 +6,41 @@\n . git-sh-setup-script || die \"Not a git archive\"\n \n usage () {\n-\tdie 'git commit [--all] [-m existing-commit] [<path>...]'\n+\tdie 'git commit [options] [<path>...]\n+Options:\n+\t--all\t\tautomatically do a git-update-cache on all modified\n+\t\t\tfiles\n+\t-m <message>\tuse this message in the commit\n+\t-c <commit>\tuse the same message as in the given commit\n+\t-C <commit>\tas -c, but let me edit it\n+\t-F <file>\ttake the message from file\n+\t-F -\t\ttake the message from stdin'\n }\n \n files=()\n+call_editor=true\n+rm -f .editmsg || die \"Could not write edit message\"\n while case \"$#\" in 0) break ;; esac\n do\n     case \"$1\" in\n+    -m|-c|-C|-F)\n+\t[ \"$#\" -ne 1 ] || usage;;\n+    esac\n+\n+    case \"$1\" in\n     -m) shift\n-        case \"$#\" in\n-\t0) usage ;;\n-\t*) use_commit=`git-rev-parse --verify \"$1\"` ||\n-\t   exit ;;\n-\tesac\n-\t;;\n+\tcall_editor=\"\"\n+\techo \"$1\" >> .editmsg;;\n+    -c) shift\n+\tcall_editor=\"\"\n+\tuse_commit=`git-rev-parse --verify \"$1\"` ||\n+\texit ;;\n+    -C) shift\n+\tuse_commit=`git-rev-parse --verify \"$1\"` ||\n+\texit ;;\n+    -F) shift\n+\tcall_editor=\"\"\n+\tcat \"$1\" >> .editmsg;;\n     --all)\n \tfiles=($(git-diff-files --name-only))\\\n \t;;\n@@ -42,7 +63,7 @@ if [ ! -r \"$GIT_DIR/HEAD\" ]; then\n \t\techo \"#\"\n \t\tgit-ls-files | sed 's/^/# New file: /'\n \t\techo \"#\"\n-\t) > .editmsg\n+\t) >> .editmsg\n \tPARENTS=\"\"\n else\n \tif [ -f \"$GIT_DIR/MERGE_HEAD\" ]; then\n@@ -83,7 +104,7 @@ else\n \t\texport GIT_AUTHOR_DATE\n \t\tgit-cat-file commit \"$use_commit\" |\n \t\tsed -e '1,/^$/d'\n-\tfi >.editmsg\n+\tfi >> .editmsg\n \tgit-status-script >>.editmsg\n fi\n if [ \"$?\" != \"0\" -a ! -f $GIT_DIR/MERGE_HEAD ]\n@@ -92,11 +113,10 @@ then\n \trm .editmsg\n \texit 1\n fi\n-case \"$use_commit\" in\n-'')\n-\t${VISUAL:-${EDITOR:-vi}} .editmsg\n-\t;;\n-esac\n+\n+[ -z \"$use_commit\" -o \"$call_editor\" = true ] &&\n+${VISUAL:-${EDITOR:-vi}} .editmsg\n+\n grep -v '^#' < .editmsg | git-stripspace > .cmitmsg\n [ -s .cmitmsg ] && \n \ttree=$(git-write-tree) &&\n"},{"id":"6969","messageId":"Pine.LNX.4.63.0508090213170.4025@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1454","inReplyTo":"Pine.LNX.4.63.0508090202140.3860@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: \"git revert\" (Re: pci_update_resource() getting called on sparc64)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-09T00:13:53Z","receivedAt":"2005-08-09T00:13:53Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"[PATCH] Adapt git-cherry and git-rebase-script to latest changes of git commit\n\nTeach git-cherry and git-rebase-script to use the \"-c\" option, since\n\"-m\" means something different to git-commit-script now.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n git-cherry        |    2 +-\n git-rebase-script |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\n34d6840882e65109a17fa02bf2cefec269fd7637\ndiff --git a/git-cherry b/git-cherry\n--- a/git-cherry\n+++ b/git-cherry\n@@ -23,7 +23,7 @@ The output is intended to be used as:\n     while read commit\n     do\n         GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p \"$commit\" &&\n-\tgit-commit-script -m \"$commit\"\n+\tgit-commit-script -c \"$commit\"\n     done\n '\n \ndiff --git a/git-rebase-script b/git-rebase-script\n--- a/git-rebase-script\n+++ b/git-rebase-script\n@@ -37,7 +37,7 @@ do\n \tesac\n \tS=`cat \"$GIT_DIR/HEAD\"` &&\n         GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p $commit &&\n-\tgit-commit-script -m \"$commit\" || {\n+\tgit-commit-script -c \"$commit\" || {\n \t\techo $commit >>$fail\n \t\tgit-read-tree --reset -u $S\n \t}\n"}]}