about summary refs log tree commit diff
path: root/scan-tree.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scan-tree.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/scan-tree.c b/scan-tree.c
index a0e09ce..eda8c67 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -159,24 +159,23 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
 
 static void scan_path(const char *base, const char *path, repo_config_fn fn)
 {
-	DIR *dir;
+	DIR *dir = opendir(path);
 	struct dirent *ent;
 	char *buf;
 	struct stat st;
 
+	if (!dir) {
+		fprintf(stderr, "Error opening directory %s: %s (%d)\n",
+			path, strerror(errno), errno);
+		return;
+	}
 	if (is_git_dir(path)) {
 		add_repo(base, path, fn);
-		return;
+		goto end;
 	}
 	if (is_git_dir(fmt("%s/.git", path))) {
 		add_repo(base, fmt("%s/.git", path), fn);
-		return;
-	}
-	dir = opendir(path);
-	if (!dir) {
-		fprintf(stderr, "Error opening directory %s: %s (%d)\n",
-			path, strerror(errno), errno);
-		return;
+		goto end;
 	}
 	while((ent = readdir(dir)) != NULL) {
 		if (ent->d_name[0] == '.') {
@@ -202,6 +201,7 @@ static void scan_path(const char *base, const char *path, repo_config_fn fn)
 			scan_path(base, buf, fn);
 		free(buf);
 	}
+end:
 	closedir(dir);
 }
 
interfaceLars Hjemli 2007-05-13Add standard interface for file diff functionsLars Hjemli 2007-05-13Show number of changed files in log viewLars Hjemli 2007-05-13Use standard tree-diff function when showing diffstat for single commitLars Hjemli 2007-05-13Add shared diff-handling functionsLars Hjemli 2007-05-12css: fix bad rendering in Internet ExplorerLars Hjemli 2007-05-11Add links to enable downloading of tagged blobsLars Hjemli 2007-05-11Makefile: add support for building w.o. preinstalled gitLars Hjemli 2007-05-11Tag release v0.3Lars Hjemli 2007-05-11Update README with submodule build infoLars Hjemli 2007-05-11Add submodule links in tree listingLars Hjemli 2007-05-11Add submodules.sh and use it during buildsLars Hjemli 2007-05-11Added git as a submoduleLars Hjemli 2007-05-09Add support for downloading single blobsLars Hjemli 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli 2007-02-21Layout updateLars Hjemli 2007-02-08Make snapshot feature configurableLars Hjemli 2007-02-08Add support for snapshotsLars Hjemli 2007-02-05cgit v0.2Lars Hjemli 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli 2007-02-04Update cgitrc templateLars Hjemli 2007-02-04Add support for lightweight tagsLars Hjemli 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli 2007-02-04Do not die if tag has no messageLars Hjemli 2007-02-03Fix search for non-virtual urlsLars Hjemli 2007-01-28Update README with install/config informationLars Hjemli