{"thread":{"id":"17149","subject":"[PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","startedAt":"2009-01-13T16:11:03Z","lastAt":"2009-01-15T22:56:00Z","messageCount":7,"participants":["Ted Pavlic","Shawn O. Pearce","Boyd Stephen Smith Jr.","Adeodato Simó","Teemu Likonen","Markus Heidelberg"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"100285","messageId":"496CBD17.3000207@tedpavlic.com","threadId":"17149","inReplyTo":null,"subject":"[PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-13T16:11:03Z","receivedAt":"2009-01-13T16:11:03Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"\nThird in a series of patches that make bash completions more robust to\ndifferent interactive shell configurations and editors.\n\n[PATCH 3/3] Adds a #!bash to the top of bash completions so that editors \ncan recognize\n  it as a bash script. Also adds a few simple comments above commands that\n  take arguments. The comments are meant to remind editors of potential\n  problems that can occur when the script is sourced on systems with \"set\n  -u.\"\n\nSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n---\n  contrib/completion/git-completion.bash |   15 +++++++++++++++\n  1 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash \nb/contrib/completion/git-completion.bash\nindex 201f9a6..f8b845a 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1,3 +1,4 @@\n+#!bash\n  #\n  # bash completion support for core Git.\n  #\n@@ -50,6 +51,8 @@ case \"$COMP_WORDBREAKS\" in\n  *)   COMP_WORDBREAKS=\"$COMP_WORDBREAKS:\"\n  esac\n\n+# __gitdir accepts 0 or 1 arguments (i.e., location)\n+# returns location of .git repo\n  __gitdir ()\n  {\n  \tif [ -z \"${1-}\" ]; then\n@@ -67,6 +70,8 @@ __gitdir ()\n  \tfi\n  }\n\n+# __git_ps1 accepts 0 or 1 arguments (i.e., format string)\n+# returns text to add to bash PS1 prompt (includes branch name)\n  __git_ps1 ()\n  {\n  \tlocal g=\"$(git rev-parse --git-dir 2>/dev/null)\"\n@@ -119,6 +124,7 @@ __git_ps1 ()\n  \tfi\n  }\n\n+# __gitcomp_1 requires 2 arguments\n  __gitcomp_1 ()\n  {\n  \tlocal c IFS=' '$'\\t'$'\\n'\n@@ -131,6 +137,8 @@ __gitcomp_1 ()\n  \tdone\n  }\n\n+# __gitcomp accepts 1, 2, 3, or 4 arguments\n+# generates completion reply with compgen\n  __gitcomp ()\n  {\n  \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n@@ -150,6 +158,7 @@ __gitcomp ()\n  \tesac\n  }\n\n+# __git_heads accepts 0 or 1 arguments (to pass to __gitdir)\n  __git_heads ()\n  {\n  \tlocal cmd i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n@@ -168,6 +177,7 @@ __git_heads ()\n  \tdone\n  }\n\n+# __git_tags accepts 0 or 1 arguments (to pass to __gitdir)\n  __git_tags ()\n  {\n  \tlocal cmd i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n@@ -186,6 +196,7 @@ __git_tags ()\n  \tdone\n  }\n\n+# __git_refs accepts 0 or 1 arguments (to pass to __gitdir)\n  __git_refs ()\n  {\n  \tlocal i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n@@ -218,6 +229,7 @@ __git_refs ()\n  \tdone\n  }\n\n+# __git_refs2 requires 1 argument (to pass to __git_refs)\n  __git_refs2 ()\n  {\n  \tlocal i\n@@ -226,6 +238,7 @@ __git_refs2 ()\n  \tdone\n  }\n\n+# __git_refs_remotes requires 1 argument (to pass to ls-remote)\n  __git_refs_remotes ()\n  {\n  \tlocal cmd i is_hash=y\n@@ -470,6 +483,7 @@ __git_aliases ()\n  \tdone\n  }\n\n+# __git_aliased_command requires 1 argument\n  __git_aliased_command ()\n  {\n  \tlocal word cmdline=$(git --git-dir=\"$(__gitdir)\" \\\n@@ -482,6 +496,7 @@ __git_aliased_command ()\n  \tdone\n  }\n\n+# __git_find_subcommand requires 1 argument\n  __git_find_subcommand ()\n  {\n  \tlocal word subcommand c=1\n-- \n1.6.1.87.g15624\n"},{"id":"100290","messageId":"20090113164518.GS10179@spearce.org","threadId":"17149","inReplyTo":"496CBD17.3000207@tedpavlic.com","subject":"Re: [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-13T16:45:18Z","receivedAt":"2009-01-13T16:45:18Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> wrote:\n>\n> Third in a series of patches that make bash completions more robust to\n> different interactive shell configurations and editors.\n>\n> [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors  \n> can recognize\n>  it as a bash script. Also adds a few simple comments above commands that\n>  take arguments. The comments are meant to remind editors of potential\n>  problems that can occur when the script is sourced on systems with \"set\n>  -u.\"\n\nAside from the message format... OK.  The message really should\nhave looked like this from an mbox point of view:\n\n\tFrom: Ted Pavlic <ted@tedpavlic.com>\n\tTo: git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>\n\tCc: \"Shawn O. Pearce\" <spearce@spearce.org>\n\tBcc: \n\tSubject: [PATCH 3/3] bash-completion: Add internal function documentation\n\n\tSlightly document the internal functions of the bash\n\tcompletion package, so callers are more easily able to\n\tdetermine the expected arguments.\n\n\tSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n\t---\n\n\t Third in a series to improve the bash completion package,\n\t so it sucks less.\n\n\t contrib/completion/git-completion.bash |   15 +++++++++++++++\n\t 1 files changed, 15 insertions(+), 0 deletions(-)\n\n\tdiff --git a/contrib/completion/git-completion.bash  \n\nSee how the stuff that doesn't matter to the commit message itself\ngoes after the \"---\" line?  And how the subject is a niceshort, one\nline summary of the module impacted and the change?  These show up in\ngitk and git shortlog, and thus in the \"What's changed in git.git\"\nnewsletters Junio publishes.  Its important that the subject be\nreally short and sweet.  You can put more detail above the \"---\"\nline, and it will be included in the commit when Junio applies it.\n\nThis is all based on the formatting at the time of commit.\nAnything up to the first \"\\n\\n\" in a commit message goes into the\nemail subject line.  The rest goes into the email body, but above the\n\"---\" line.  You can then edit the buffer before sending to insert\nnon-commit message text after the \"---\" and before the diff stat.\n\nYou can include my Ack'd by line below your Signed-off-by when you\nresend it.\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n> ---\n>  contrib/completion/git-completion.bash |   15 +++++++++++++++\n>  1 files changed, 15 insertions(+), 0 deletions(-)\n\n-- \nShawn.\n"},{"id":"100305","messageId":"200901131403.16012.bss@iguanasuicide.net","threadId":"17149","inReplyTo":"20090113164518.GS10179@spearce.org","subject":"Re: [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2009-01-13T20:03:11Z","receivedAt":"2009-01-13T20:03:11Z","isPatch":true,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Tuesday 2009 January 13 10:45:18 Shawn O. Pearce wrote:\n>See [...] how the subject is a niceshort, one\n>line summary of the module impacted and the change?\n\nMy rule for this is absolutely no more than 80 characters.  Generally, you \nwouldn't want more than 60 or so, since it is used as the Subject: header and \ngenerally has some prefix added.\n\nAs shown says, details can go in the rest of the commit message.  If you are \nusing more than 60-80 characters even without details, you might think about \nsplitting the patch.\n\n>This is all based on the formatting at the time of commit.\n>Anything up to the first \"\\n\\n\" in a commit message goes into the\n>email subject line.\n\nIIRC, multiple \"-m\" options to \"git commit\" will be separated by \"\\n\\n\", so \nthat's one way to do it if you don't like your $EDITOR for some reason.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"100306","messageId":"20090113201024.GA20129@chistera.yi.org","threadId":"17149","inReplyTo":"200901131403.16012.bss@iguanasuicide.net","subject":"Re: [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-13T20:10:24Z","receivedAt":"2009-01-13T20:10:24Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Boyd Stephen Smith Jr. [Tue, 13 Jan 2009 14:03:11 -0600]:\n\n> On Tuesday 2009 January 13 10:45:18 Shawn O. Pearce wrote:\n> >See [...] how the subject is a niceshort, one\n> >line summary of the module impacted and the change?\n\n> My rule for this is absolutely no more than 80 characters.\n\nMy rule for *all* of the commit message is \"absolutely no more than 76\ncharacters\". With more than 76, `git log` wraps in a 80-column terminal.\n\nJust my 2¢,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \nLa música es de los que la quieren escuchar y de nadie más.\n                -- Andrés Calamaro\n"},{"id":"100309","messageId":"8763kjt0mw.fsf_-_@iki.fi","threadId":"17149","inReplyTo":"20090113201024.GA20129@chistera.yi.org","subject":"Commit messages","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2009-01-13T20:24:39Z","receivedAt":"2009-01-13T20:24:39Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Adeodato Simó (2009-01-13 21:10 +0100) wrote:\n\n> * Boyd Stephen Smith Jr. [Tue, 13 Jan 2009 14:03:11 -0600]:\n>\n>> My rule for this is absolutely no more than 80 characters.\n>\n> My rule for *all* of the commit message is \"absolutely no more than 76\n> characters\". With more than 76, `git log` wraps in a 80-column terminal.\n\nHere's my rule:\n\n\n(add-to-list 'auto-mode-alist\n             '(\"/\\\\.git/\\\\(COMMIT\\\\|TAG\\\\)_EDITMSG\\\\'\" .\n               vcs-message-mode))\n\n(define-derived-mode vcs-message-mode text-mode \"VCS-message\"\n  \"Major mode for editing commit and tag messages.\" \n  (auto-fill-mode 1)\n  (set (make-local-variable 'tab-stop-list)\n       (number-sequence 4 100 4))\n  (setq indent-tabs-mode nil\n        fill-column 72\n        truncate-lines t))\n"},{"id":"100437","messageId":"496E190B.7020104@tedpavlic.com","threadId":"17149","inReplyTo":"8763kjt0mw.fsf_-_@iki.fi","subject":"Re: Commit messages","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-14T16:55:39Z","receivedAt":"2009-01-14T16:55:39Z","isPatch":false,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"That rule could be modified to support .stgit-edit.txt as well.\n\n> (add-to-list 'auto-mode-alist\n>               '(\"/\\\\.git/\\\\(COMMIT\\\\|TAG\\\\)_EDITMSG\\\\'\" .\n>                 vcs-message-mode))\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"100668","messageId":"200901152356.00997.markus.heidelberg@web.de","threadId":"17149","inReplyTo":"20090113201024.GA20129@chistera.yi.org","subject":"Re: [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that can occur when the script is sourced on systems with \"set, -u.\"","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-01-15T22:56:00Z","receivedAt":"2009-01-15T22:56:00Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Adeodato Simó, 13.01.2009:\n> * Boyd Stephen Smith Jr. [Tue, 13 Jan 2009 14:03:11 -0600]:\n> \n> > On Tuesday 2009 January 13 10:45:18 Shawn O. Pearce wrote:\n> > >See [...] how the subject is a niceshort, one\n> > >line summary of the module impacted and the change?\n> \n> > My rule for this is absolutely no more than 80 characters.\n> \n> My rule for *all* of the commit message is \"absolutely no more than 76\n> characters\". With more than 76, `git log` wraps in a 80-column terminal.\n\nWhat about the 50 character limit proposed in the documentation\n(git-commit, gittutorial, user-manual)?\n\nAt the beginning I tried to fulfil this limit, but often it's not easy.\nSo should it be adjusted to a slightly higher value in the documentation\nor even split into a recommended limit (e.g. 50) and a recommended\nabsolute maximum (e.g. 76)? Hmm, the split wouldn't make sense, I think.\n\nMarkus\n"}]}