Commit Diff


commit - fbb7e5c7d46ba5854dbb9fe5c26725e6edea28f1
commit + 03df25b334950c4fa76dc9a86b3df050861298ce
blob - cc9ccebbbcbf52c7fb1d4425846593808cec592a
blob + e957e0fcbcf9e617d6ed124f3d94f20fc1387476
--- TODO
+++ TODO
@@ -2,6 +2,7 @@ lib:
 - handle checkout of trees which contain submodules by identifying and
   ignoring such tree entries; requires a .ini config parser (from isakmpd?)
 - allow removing multiple paths at once for 'got rm'
+- allow adding directory paths with 'got add'
 - recursive addition: got add -R
 - recursive removal: got rm -R
 
blob - a868d40089e2efdad8a04be237fe2b48a04e2849
blob + 61562ca737ba48acc9ec864ecdc25796636c48e3
--- lib/fileindex.c
+++ lib/fileindex.c
@@ -18,6 +18,7 @@
 #include <sys/tree.h>
 #include <sys/stat.h>
 
+#include <errno.h>
 #include <dirent.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -60,9 +61,13 @@ got_fileindex_entry_update(struct got_fileindex_entry 
 	if (lstat(ondisk_path, &sb) != 0) {
 		if ((entry->flags & GOT_FILEIDX_F_NO_FILE_ON_DISK) == 0)
 			return got_error_prefix_errno2("lstat", ondisk_path);
-	} else
+	} else {
+		if (sb.st_mode & S_IFDIR)
+			return got_error_set_errno(EISDIR, ondisk_path);
 		entry->flags &= ~GOT_FILEIDX_F_NO_FILE_ON_DISK;
+	}
 
+
 	if ((entry->flags & GOT_FILEIDX_F_NO_FILE_ON_DISK) == 0) {
 		if (update_timestamps) {
 			entry->ctime_sec = sb.st_ctime;