From: Jeff King <hidden> Date: 2016-06-15 22:44:16
If we have an alias "foo" defined, then the help text for
"foo" (via "git help foo" or "git foo --help") now shows the
definition of the alias.
Before showing an alias definition, we make sure that there
is no git command which would override the alias (so that
even though you may have a "log" alias, even though it will
not work, we don't want to it supersede "git help log").
Signed-off-by: Jeff King <redacted>
---
help.c | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
From: Jay Soffian <hidden> Date: 2016-06-15 22:44:16
On Sun, Feb 24, 2008 at 5:17 PM, Jeff King [off-list ref] wrote:
If we have an alias "foo" defined, then the help text for
"foo" (via "git help foo" or "git foo --help") now shows the
definition of the alias.
Heh, now I can kill this alias of mine:
h = "!sh -c 'git alias \"$1\" || git help \"$1\"' -"
:-)
This too would be less ugly as a built-in:
alias = "! sh -c 'if test -z \"$1\"; then git config --list \
| expand \
| sed \"/^alias\\./!d; s/^alias\\.//; s/=/ /; s/ */ /g\" \
| sort | while read n v; do \
printf \"%-16s\" \"$n\"; echo \"$v\" | gnused \
\"s/\\(.\\{68\\}\\) /\\1\\n\t\t/g\" | expand; \
done; else git config \"alias.$1\"; fi' -"
:-)
j.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:44:17
Hi,
On Sun, 24 Feb 2008, Jay Soffian wrote:
This too would be less ugly as a built-in:
alias = "! sh -c 'if test -z \"$1\"; then git config --list \
| expand \
| sed \"/^alias\\./!d; s/^alias\\.//; s/=/ /; s/ */ /g\" \
| sort | while read n v; do \
printf \"%-16s\" \"$n\"; echo \"$v\" | gnused \
\"s/\\(.\\{68\\}\\) /\\1\\n\t\t/g\" | expand; \
done; else git config \"alias.$1\"; fi' -"
Wow. This would look less ugly as an alias like this, too:
alias = "!sh -c 'case $# in \
0) git config --get-regexp \"^alias\\.\" | sed \"s/^alias\\.//\";; \
*) git config \"alias.$0\" ;; \
esac'"
which incidentally fixes a bug in your alias: you ignore $0 which is the
first parameter when using the sh -c '' idiom.
Of course, you can change the sed call to your liking...
Ciao,
Dscho
From: Jay Soffian <hidden> Date: 2016-06-15 22:44:17
On Tue, Feb 26, 2008 at 7:43 AM, Johannes Schindelin
[off-list ref] wrote:
On Sun, 24 Feb 2008, Jay Soffian wrote:
> This too would be less ugly as a built-in:
>
> [elided so as not to burn anyone's eyes out again :-) -- jay]
Wow. This would look less ugly as an alias like this, too:
alias = "!sh -c 'case $# in \
0) git config --get-regexp \"^alias\\.\" | sed \"s/^alias\\.//\";; \
*) git config \"alias.$0\" ;; \
esac'"
which incidentally fixes a bug in your alias: you ignore $0 which is the
first parameter when using the sh -c '' idiom.
Test mine. Test yours. See which works. :-)
At least on my system, I had to use:
sh -c '...' -
And then refer to $1.
Of course, you can change the sed call to your liking...
Most of the ugliness in mine is that I crammed the whitespace down and
that I'm using a quite involved pipeline to reformat all my aliases so
they fit into my terminal window.
But the --get-regexp is a good tip.
j.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:44:17
Hi,
On Tue, 26 Feb 2008, Jay Soffian wrote:
On Tue, Feb 26, 2008 at 7:43 AM, Johannes Schindelin
[off-list ref] wrote:
quoted
On Sun, 24 Feb 2008, Jay Soffian wrote:
> This too would be less ugly as a built-in:
>
> [elided so as not to burn anyone's eyes out again :-) -- jay]
Wow. This would look less ugly as an alias like this, too:
alias = "!sh -c 'case $# in \
0) git config --get-regexp \"^alias\\.\" | sed \"s/^alias\\.//\";; \
*) git config \"alias.$0\" ;; \
esac'"
which incidentally fixes a bug in your alias: you ignore $0 which is the
first parameter when using the sh -c '' idiom.