config.mak.uname: Darwin: define HAVE_GETDELIM for modern OS X releases
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 8b5659b2086a2716b8978b2a57bbdc0d7ff5124a..42a4ee57843f569fb754121f01bb8c46feee2fd3 100644 (file)
--- a/git.c
+++ b/git.c
@@ -204,10 +204,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                                fprintf(stderr, "No directory given for -C.\n" );
                                usage(git_usage_string);
                        }
-                       if (chdir((*argv)[1]))
-                               die_errno("Cannot change to '%s'", (*argv)[1]);
-                       if (envchanged)
-                               *envchanged = 1;
+                       if ((*argv)[1][0]) {
+                               if (chdir((*argv)[1]))
+                                       die_errno("Cannot change to '%s'", (*argv)[1]);
+                               if (envchanged)
+                                       *envchanged = 1;
+                       }
                        (*argv)++;
                        (*argc)--;
                } else {