{"thread":{"id":"51215","subject":"[PATCH 0/2] document alias accepting non-command first word","startedAt":"2019-05-31T20:23:05Z","lastAt":"2019-06-06T12:48:53Z","messageCount":8,"participants":["Denton Liu","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"376506","messageId":"cover.1559333840.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":null,"subject":"[PATCH 0/2] document alias accepting non-command first word","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-05-31T20:23:01Z","receivedAt":"2019-05-31T20:23:05Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When I first saw Johannes' email here[1], I was surprised that an alias\nwhere the first-word is a command-line option to be passed into `git`\nwas permitted. I was only used to aliases where the first word is a\ncommand.\n\nDocument this behaviour so that users will be able to discover that this\nis a feature.\n\n[1]: https://public-inbox.org/git/nycvar.QRO.7.76.6.1905281235280.44@tvgsbejvaqbjf.bet/\n\n\n\nDenton Liu (2):\n  config/alias.txt: change \" and ' to `\n  config/alias.txt: document alias accepting non-command first word\n\n Documentation/config/alias.txt | 20 ++++++++++++++------\n 1 file changed, 14 insertions(+), 6 deletions(-)\n\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376507","messageId":"6f3c18424e7199716d6128aad1dc0da9388d3cb0.1559333840.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":"cover.1559333840.git.liu.denton@gmail.com","subject":"[PATCH 1/2] config/alias.txt: change \" and ' to `","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-05-31T20:23:03Z","receivedAt":"2019-05-31T20:23:08Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, the documentation would mix \" and ' for code and config\nsnippets. Change these instances to ` so that they are marked up in\nmonospace.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/config/alias.txt | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\nindex 0b14178314..5425449a50 100644\n--- a/Documentation/config/alias.txt\n+++ b/Documentation/config/alias.txt\n@@ -1,7 +1,7 @@\n alias.*::\n \tCommand aliases for the linkgit:git[1] command wrapper - e.g.\n-\tafter defining \"alias.last = cat-file commit HEAD\", the invocation\n-\t\"git last\" is equivalent to \"git cat-file commit HEAD\". To avoid\n+\tafter defining `alias.last = cat-file commit HEAD`, the invocation\n+\t`git last` is equivalent to `git cat-file commit HEAD`. To avoid\n \tconfusion and troubles with script usage, aliases that\n \thide existing Git commands are ignored. Arguments are split by\n \tspaces, the usual shell quoting and escaping is supported.\n@@ -9,10 +9,10 @@ alias.*::\n +\n If the alias expansion is prefixed with an exclamation point,\n it will be treated as a shell command.  For example, defining\n-\"alias.new = !gitk --all --not ORIG_HEAD\", the invocation\n-\"git new\" is equivalent to running the shell command\n-\"gitk --all --not ORIG_HEAD\".  Note that shell commands will be\n+`alias.new = !gitk --all --not ORIG_HEAD`, the invocation\n+`git new` is equivalent to running the shell command\n+`gitk --all --not ORIG_HEAD`.  Note that shell commands will be\n executed from the top-level directory of a repository, which may\n not necessarily be the current directory.\n-`GIT_PREFIX` is set as returned by running 'git rev-parse --show-prefix'\n+`GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix`\n from the original current directory. See linkgit:git-rev-parse[1].\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376508","messageId":"13d9ddd3541e3815078c4853c6f7c25cddd89126.1559333840.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":"cover.1559333840.git.liu.denton@gmail.com","subject":"[PATCH 2/2] config/alias.txt: document alias accepting non-command first word","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-05-31T20:23:06Z","receivedAt":"2019-05-31T20:23:10Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"One can see that an alias that begins with a non-command first word,\nsuch as `loud-rebase = -c commit.verbose=true rebase`, is permitted.\nHowever, this isn't immediately obvious to users as alias instances\ntypically begin with a command.\n\nDocument the fact that an alias can begin with a non-command first word\nso that users will be able to discover that this is a feature.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/config/alias.txt | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\nindex 5425449a50..f241f03ebe 100644\n--- a/Documentation/config/alias.txt\n+++ b/Documentation/config/alias.txt\n@@ -7,6 +7,14 @@ alias.*::\n \tspaces, the usual shell quoting and escaping is supported.\n \tA quote pair or a backslash can be used to quote them.\n +\n+Note that the first word of an alias does not necessarily have to be a\n+command. It can be a command-line option that will be passed into the\n+invocation of `git`. In particular, this is useful when used with `-c`\n+to pass in one-time configurations. For example,\n+`loud-rebase = -c commit.verbose=true rebase` can be defined such that\n+running `git loud-merge` would be equivalent to\n+`git -c commit.verbose=true rebase`.\n++\n If the alias expansion is prefixed with an exclamation point,\n it will be treated as a shell command.  For example, defining\n `alias.new = !gitk --all --not ORIG_HEAD`, the invocation\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376712","messageId":"nycvar.QRO.7.76.6.1906051434500.1775@tvgsbejvaqbjf.bet","threadId":"51215","inReplyTo":"13d9ddd3541e3815078c4853c6f7c25cddd89126.1559333840.git.liu.denton@gmail.com","subject":"Re: [PATCH 2/2] config/alias.txt: document alias accepting non-command first word","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-06-05T12:37:13Z","receivedAt":"2019-06-05T12:37:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Fri, 31 May 2019, Denton Liu wrote:\n\n> One can see that an alias that begins with a non-command first word,\n> such as `loud-rebase = -c commit.verbose=true rebase`, is permitted.\n> However, this isn't immediately obvious to users as alias instances\n> typically begin with a command.\n>\n> Document the fact that an alias can begin with a non-command first word\n> so that users will be able to discover that this is a feature.\n\nYou caught me.\n\nGranted, back in 2006, when I introduced that feature, we were not *quite*\nas diligent about documenting new features as we are today (see\n4ab243a944a6 (Allow an alias to start with \"-p\", 2006-07-24)).\n\nI like your patch! Maybe you would like to mention `-p`, too, as a\npossible use case, as that was the original reason I introduced the\nfeature? (To this day, the first thing I do on a new machine *right* after\ninstalling Git is to call `git config --global alias.ps '-p status'`)\n\nI'd be fine with these two patches as-are, of course.\n\nThank you!\nDscho\n\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  Documentation/config/alias.txt | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n>\n> diff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\n> index 5425449a50..f241f03ebe 100644\n> --- a/Documentation/config/alias.txt\n> +++ b/Documentation/config/alias.txt\n> @@ -7,6 +7,14 @@ alias.*::\n>  \tspaces, the usual shell quoting and escaping is supported.\n>  \tA quote pair or a backslash can be used to quote them.\n>  +\n> +Note that the first word of an alias does not necessarily have to be a\n> +command. It can be a command-line option that will be passed into the\n> +invocation of `git`. In particular, this is useful when used with `-c`\n> +to pass in one-time configurations. For example,\n> +`loud-rebase = -c commit.verbose=true rebase` can be defined such that\n> +running `git loud-merge` would be equivalent to\n> +`git -c commit.verbose=true rebase`.\n> ++\n>  If the alias expansion is prefixed with an exclamation point,\n>  it will be treated as a shell command.  For example, defining\n>  `alias.new = !gitk --all --not ORIG_HEAD`, the invocation\n> --\n> 2.22.0.rc1.169.g49223abbf8\n>\n>\n"},{"id":"376728","messageId":"cover.1559755652.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":"cover.1559333840.git.liu.denton@gmail.com","subject":"[PATCH v2 0/2] Doc: document alias accepting non-command first word","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-06-05T20:10:07Z","receivedAt":"2019-06-05T20:10:13Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Thanks for the review, Johannes. I think it's a good idea to add another\nalias for `-p` so included that suggestion. Also, while I was at it, I\nfound a typo so I fixed that too.\n\nChanges since v1:\n\n* s/loud-merge/loud-rebase/\n* Add `-p` as another example since that was Dscho's original use-case\n\n\nDenton Liu (2):\n  config/alias.txt: change \" and ' to `\n  config/alias.txt: document alias accepting non-command first word\n\n Documentation/config/alias.txt | 22 ++++++++++++++++------\n 1 file changed, 16 insertions(+), 6 deletions(-)\n\nInterdiff against v1:\ndiff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\nindex f241f03ebe..f1ca739d57 100644\n--- a/Documentation/config/alias.txt\n+++ b/Documentation/config/alias.txt\n@@ -10,10 +10,12 @@ alias.*::\n Note that the first word of an alias does not necessarily have to be a\n command. It can be a command-line option that will be passed into the\n invocation of `git`. In particular, this is useful when used with `-c`\n-to pass in one-time configurations. For example,\n+to pass in one-time configurations or `-p` to force pagination. For example,\n `loud-rebase = -c commit.verbose=true rebase` can be defined such that\n-running `git loud-merge` would be equivalent to\n-`git -c commit.verbose=true rebase`.\n+running `git loud-rebase` would be equivalent to\n+`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a\n+helpful alias since `git ps` would paginate the output of `git status`\n+where the original command does not.\n +\n If the alias expansion is prefixed with an exclamation point,\n it will be treated as a shell command.  For example, defining\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376729","messageId":"bdc99e133258e01bc6d88ac66de22c15f9aa70c8.1559755652.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":"cover.1559755652.git.liu.denton@gmail.com","subject":"[PATCH v2 1/2] config/alias.txt: change \" and ' to `","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-06-05T20:10:11Z","receivedAt":"2019-06-05T20:10:15Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, the documentation would mix \" and ' for code and config\nsnippets. Change these instances to ` so that they are marked up in\nmonospace.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/config/alias.txt | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\nindex 0b14178314..5425449a50 100644\n--- a/Documentation/config/alias.txt\n+++ b/Documentation/config/alias.txt\n@@ -1,7 +1,7 @@\n alias.*::\n \tCommand aliases for the linkgit:git[1] command wrapper - e.g.\n-\tafter defining \"alias.last = cat-file commit HEAD\", the invocation\n-\t\"git last\" is equivalent to \"git cat-file commit HEAD\". To avoid\n+\tafter defining `alias.last = cat-file commit HEAD`, the invocation\n+\t`git last` is equivalent to `git cat-file commit HEAD`. To avoid\n \tconfusion and troubles with script usage, aliases that\n \thide existing Git commands are ignored. Arguments are split by\n \tspaces, the usual shell quoting and escaping is supported.\n@@ -9,10 +9,10 @@ alias.*::\n +\n If the alias expansion is prefixed with an exclamation point,\n it will be treated as a shell command.  For example, defining\n-\"alias.new = !gitk --all --not ORIG_HEAD\", the invocation\n-\"git new\" is equivalent to running the shell command\n-\"gitk --all --not ORIG_HEAD\".  Note that shell commands will be\n+`alias.new = !gitk --all --not ORIG_HEAD`, the invocation\n+`git new` is equivalent to running the shell command\n+`gitk --all --not ORIG_HEAD`.  Note that shell commands will be\n executed from the top-level directory of a repository, which may\n not necessarily be the current directory.\n-`GIT_PREFIX` is set as returned by running 'git rev-parse --show-prefix'\n+`GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix`\n from the original current directory. See linkgit:git-rev-parse[1].\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376730","messageId":"44c4e1c560de607f30eb87234611a5bbc00620a7.1559755652.git.liu.denton@gmail.com","threadId":"51215","inReplyTo":"cover.1559755652.git.liu.denton@gmail.com","subject":"[PATCH v2 2/2] config/alias.txt: document alias accepting non-command first word","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-06-05T20:10:13Z","receivedAt":"2019-06-05T20:10:17Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"One can see that an alias that begins with a non-command first word,\nsuch as `loud-rebase = -c commit.verbose=true rebase`, is permitted.\nHowever, this isn't immediately obvious to users as alias instances\ntypically begin with a command.\n\nDocument the fact that an alias can begin with a non-command first word\nso that users will be able to discover that this is a feature.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/config/alias.txt | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/Documentation/config/alias.txt b/Documentation/config/alias.txt\nindex 5425449a50..f1ca739d57 100644\n--- a/Documentation/config/alias.txt\n+++ b/Documentation/config/alias.txt\n@@ -7,6 +7,16 @@ alias.*::\n \tspaces, the usual shell quoting and escaping is supported.\n \tA quote pair or a backslash can be used to quote them.\n +\n+Note that the first word of an alias does not necessarily have to be a\n+command. It can be a command-line option that will be passed into the\n+invocation of `git`. In particular, this is useful when used with `-c`\n+to pass in one-time configurations or `-p` to force pagination. For example,\n+`loud-rebase = -c commit.verbose=true rebase` can be defined such that\n+running `git loud-rebase` would be equivalent to\n+`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a\n+helpful alias since `git ps` would paginate the output of `git status`\n+where the original command does not.\n++\n If the alias expansion is prefixed with an exclamation point,\n it will be treated as a shell command.  For example, defining\n `alias.new = !gitk --all --not ORIG_HEAD`, the invocation\n-- \n2.22.0.rc1.169.g49223abbf8\n\n"},{"id":"376747","messageId":"nycvar.QRO.7.76.6.1906061448350.42@tvgsbejvaqbjf.bet","threadId":"51215","inReplyTo":"cover.1559755652.git.liu.denton@gmail.com","subject":"Re: [PATCH v2 0/2] Doc: document alias accepting non-command first word","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-06-06T12:48:50Z","receivedAt":"2019-06-06T12:48:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Wed, 5 Jun 2019, Denton Liu wrote:\n\n> Thanks for the review, Johannes. I think it's a good idea to add another\n> alias for `-p` so included that suggestion. Also, while I was at it, I\n> found a typo so I fixed that too.\n>\n> Changes since v1:\n>\n> * s/loud-merge/loud-rebase/\n> * Add `-p` as another example since that was Dscho's original use-case\n\nLooks good to me!\nDscho\n"}]}