Skip to content

Commit

Permalink
Merge branch 'dt/refs-backend-pre-vtable'
Browse files Browse the repository at this point in the history
Code preparation for pluggable ref backends.

* dt/refs-backend-pre-vtable:
  refs: break out ref conflict checks
  files_log_ref_write: new function
  initdb: make safe_create_dir public
  refs: split filesystem-based refs code into a new file
  refs/refs-internal.h: new header file
  refname_is_safe(): improve docstring
  pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()
  copy_msg(): rename to copy_reflog_msg()
  verify_refname_available(): new function
  verify_refname_available(): rename function
  • Loading branch information
Junio C Hamano committed Dec 8, 2015
2 parents fa5f239 + 0845122 commit b1cda70
Show file tree
Hide file tree
Showing 7 changed files with 3,949 additions and 3,855 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ LIB_OBJS += reachable.o
LIB_OBJS += read-cache.o
LIB_OBJS += reflog-walk.o
LIB_OBJS += refs.o
LIB_OBJS += refs/files-backend.o
LIB_OBJS += ref-filter.o
LIB_OBJS += remote.o
LIB_OBJS += replace_object.o
Expand Down Expand Up @@ -2432,7 +2433,7 @@ profile-clean:
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))

clean: profile-clean coverage-clean
$(RM) *.o *.res block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o
$(RM) *.o *.res refs/*.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o
$(RM) xdiff/*.o vcs-svn/*.o ewah/*.o builtin/*.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Expand Down
12 changes: 0 additions & 12 deletions builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ static int init_shared_repository = -1;
static const char *init_db_template_dir;
static const char *git_link;

static void safe_create_dir(const char *dir, int share)
{
if (mkdir(dir, 0777) < 0) {
if (errno != EEXIST) {
perror(dir);
exit(1);
}
}
else if (share && adjust_shared_perm(dir))
die(_("Could not make %s writable by group"), dir);
}

static void copy_templates_1(struct strbuf *path, struct strbuf *template,
DIR *dir)
{
Expand Down
8 changes: 8 additions & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -1768,4 +1768,12 @@ void stat_validity_update(struct stat_validity *sv, int fd);
int versioncmp(const char *s1, const char *s2);
void sleep_millisec(int millisec);

/*
* Create a directory and (if share is nonzero) adjust its permissions
* according to the shared_repository setting. Only use this for
* directories under $GIT_DIR. Don't use it for working tree
* directories.
*/
void safe_create_dir(const char *dir, int share);

#endif /* CACHE_H */
12 changes: 12 additions & 0 deletions path.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,18 @@ int adjust_shared_perm(const char *path)
return 0;
}

void safe_create_dir(const char *dir, int share)
{
if (mkdir(dir, 0777) < 0) {
if (errno != EEXIST) {
perror(dir);
exit(1);
}
}
else if (share && adjust_shared_perm(dir))
die(_("Could not make %s writable by group"), dir);
}

static int have_same_root(const char *path1, const char *path2)
{
int is_abs1, is_abs2;
Expand Down
Loading

0 comments on commit b1cda70

Please sign in to comment.