X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git.c;h=a53e24feae183b77986947f9b120a02bc1c18113;hb=960e0eb3eae8d1a5db754ebe44c0ccb414b855ad;hp=89feb0b6dc9c34902aa7c3c4ac526c646c0e0d84;hpb=769b008e0eaef6876e68c65538f81f841b53cb8e;p=git.git diff --git a/git.c b/git.c index 89feb0b6d..a53e24fea 100644 --- a/git.c +++ b/git.c @@ -158,7 +158,7 @@ static int handle_alias(int *argcp, const char ***argv) if (ret >= 0 && WIFEXITED(ret) && WEXITSTATUS(ret) != 127) exit(WEXITSTATUS(ret)); - die("Failed to run '%s' when expanding alias '%s'\n", + die("Failed to run '%s' when expanding alias '%s'", alias_string + 1, alias_command); } count = split_cmdline(alias_string, &new_argv); @@ -195,8 +195,8 @@ static int handle_alias(int *argcp, const char ***argv) ret = 1; } - if (subdir) - chdir(subdir); + if (subdir && chdir(subdir)) + die("Cannot change to %s: %s", subdir, strerror(errno)); errno = saved_errno; @@ -266,6 +266,7 @@ static void handle_internal_command(int argc, const char **argv) const char *cmd = argv[0]; static struct cmd_struct commands[] = { { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE }, + { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE }, { "annotate", cmd_annotate, RUN_SETUP }, { "apply", cmd_apply }, { "archive", cmd_archive }, @@ -427,9 +428,8 @@ int main(int argc, const char **argv) * name, and the dirname as the default exec_path * if we don't have anything better. */ - do - --slash; - while (cmd <= slash && !is_dir_sep(*slash)); + while (cmd <= slash && !is_dir_sep(*slash)) + slash--; if (cmd <= slash) { *slash++ = 0; git_set_argv0_path(cmd);