Do not use GUID on dir in git init --shared=all on FreeBSD
It does not allow changing the bit to a non-root user. This fixes t1301-shared-repo.sh on the platform. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
Mar 5, 2008 at 00:15 UTC
81a24b52c164b96d37c8c50799a624e2e8ce8a57
3 files changed
+11
-1
Makefile
+4
@@ -478,6 +478,7 @@ ifeq ($(uname_S),FreeBSD)
478
NO_MEMMEM = YesPlease
479
BASIC_CFLAGS += -I/usr/local/include
480
BASIC_LDFLAGS += -L/usr/local/lib
481
+ DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
482
endif
483
ifeq ($(uname_S),OpenBSD)
484
NO_STRCASESTR = YesPlease
@@ -747,6 +748,9 @@ ifdef THREADED_DELTA_SEARCH
748
EXTLIBS += -lpthread
749
LIB_OBJS += thread-utils.o
750
endif
751
+ifdef DIR_HAS_BSD_GROUP_SEMANTICS
752
+ COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
753
+endif
754
755
ifeq ($(TCLTK_PATH),)
756
NO_TCLTK=NoThanks
git-compat-util.h
+6
@@ -437,4 +437,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
437
#define qsort git_qsort
438
#endif
439
440
+#ifndef DIR_HAS_BSD_GROUP_SEMANTICS
441
+# define FORCE_DIR_SET_GID S_ISGID
442
+#else
443
+# define FORCE_DIR_SET_GID 0
444
+#endif
445
+
446
#endif
path.c
+1
-1
@@ -283,7 +283,7 @@ int adjust_shared_perm(const char *path)
283
? (S_IXGRP|S_IXOTH)
284
: 0));
285
if (S_ISDIR(mode))
286
- mode |= S_ISGID;
286
+ mode |= FORCE_DIR_SET_GID;
287
if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
288
return -2;
289
return 0;