t8001/t8002 (blame): modernize style
[gitweb.git] / test-subprocess.c
index 8926bc52a9a6e2a16924664372a8af3ee2ed3136..93525eb7be48eb11c242200827a7f6f0706ee241 100644 (file)
@@ -9,12 +9,12 @@ int main(int argc, char **argv)
        setup_git_directory_gently(&nogit);
        if (nogit)
                die("No git repo found");
-       if (!strcmp(argv[1], "--setup-work-tree")) {
+       if (argc > 1 && !strcmp(argv[1], "--setup-work-tree")) {
                setup_work_tree();
                argv++;
        }
        memset(&cp, 0, sizeof(cp));
        cp.git_cmd = 1;
-       cp.argv = (const char **)argv+1;
+       cp.argv = (const char **)argv + 1;
        return run_command(&cp);
 }