Advertisement
Guest User

Untitled

a guest
Dec 14th, 2011
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. From 75c7d4ca8d84dd81aff185172046290e8e8ba7fb Mon Sep 17 00:00:00 2001
  2. From: Patrick Sudowe <patrick.sudowe@rwth-aachen.de>
  3. Date: Thu, 18 Feb 2010 01:09:20 +0100
  4. Subject: [PATCH] help: show help message also for aliased commands
  5.  
  6. git help <alias> currently only shows the actual git command
  7. <alias> refers to. This patch changes the behavior so that
  8. the help for the actual git command is shown. The user usually
  9. knows the aliases defined, and sometimes its just more convenient
  10. to type something like git help co than git help checkout
  11. to find out about the rarely used option.
  12. ---
  13. builtin-help.c | 12 ++++++++----
  14. 1 files changed, 8 insertions(+), 4 deletions(-)
  15.  
  16. diff --git a/builtin-help.c b/builtin-help.c
  17. index 3182a2b..4d8906d 100644
  18. --- a/builtin-help.c
  19. +++ b/builtin-help.c
  20. @@ -416,6 +416,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
  21. {
  22. int nongit;
  23. const char *alias;
  24. + const char *cmd;
  25. enum help_format parsed_help_format;
  26. load_command_list("git-", &main_cmds, &other_cmds);
  27.  
  28. @@ -446,19 +447,22 @@ int cmd_help(int argc, const char **argv, const char *prefix)
  29. alias = alias_lookup(argv[0]);
  30. if (alias && !is_git_command(argv[0])) {
  31. printf("`git %s' is aliased to `%s'\n", argv[0], alias);
  32. - return 0;
  33. + cmd = alias;
  34. + } else {
  35. + cmd = argv[0];
  36. }
  37.  
  38. +
  39. switch (help_format) {
  40. case HELP_FORMAT_NONE:
  41. case HELP_FORMAT_MAN:
  42. - show_man_page(argv[0]);
  43. + show_man_page(cmd);
  44. break;
  45. case HELP_FORMAT_INFO:
  46. - show_info_page(argv[0]);
  47. + show_info_page(cmd);
  48. break;
  49. case HELP_FORMAT_WEB:
  50. - show_html_page(argv[0]);
  51. + show_html_page(cmd);
  52. break;
  53. }
  54.  
  55. --
  56. 1.7.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement