[PATCH] Make git-k an alias to gitk
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Tue, 29 May 2007, Nguyen Thai Ngoc Duy wrote:
> On 5/29/07, Johannes Sixt <J.Sixt@eudaptics.com> wrote:
> > Nguyen Thai Ngoc Duy wrote:
> > > I'd suggest create a small C wrapper to launch gitk. It
> > > would be much easier that way IMHO.
> >
> > Doh! You're right! It's even there already, right before our
> > eyes:
> >
> > pointy..clicky..pointy..clicky (aka: cp gitk git-k)
> >
> > $ git k
> >
> > :)
>
> Maybe we should teach git.c to try gitk if git-k is not found ;)
Something like this?
Makefile | 2 +-
git.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 5f94630..01ab1ff 100644
--- a/Makefile
+++ b/Makefile
@@ -262,7 +262,7 @@ EXTRA_PROGRAMS =
BUILT_INS = \
git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
git-get-tar-commit-id$X git-init$X git-repo-config$X \
- git-fsck-objects$X git-cherry-pick$X \
+ git-fsck-objects$X git-cherry-pick$X git-k$X \
$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
# what 'all' will build and 'install' will install, in gitexecdir
diff --git a/git.c b/git.c
index 04eb344..53d81e9 100644
--- a/git.c
+++ b/git.c
@@ -216,6 +216,11 @@ static int handle_alias(int *argcp, const char ***argv)
return ret;
}
+static int cmd_gitk(int argc, const char **argv, const char *prefix)
+{
+ return execv("gitk", (char *const *)argv);
+}
+
const char git_version_string[] = GIT_VERSION;
#define RUN_SETUP (1<<0)
@@ -274,6 +279,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "help", cmd_help },
{ "init", cmd_init_db },
{ "init-db", cmd_init_db },
+ { "k", cmd_gitk },
{ "log", cmd_log, RUN_SETUP | USE_PAGER },
{ "ls-files", cmd_ls_files, RUN_SETUP },
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
--
1.5.2.2641.g404de-dirty