Thread (9 messages) 9 messages, 4 authors, 2016-08-11

Re: [PATCH] Enable reflogs by default in any repository with a working directory.

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:26:34

Shawn Pearce [off-list ref] writes:
Johannes Schindelin [off-list ref] wrote:
quoted
Hi,

On Thu, 14 Dec 2006, Shawn O. Pearce wrote:
quoted
+int is_bare_git_dir (const char *dir)
+{
+	if (!strcmp(dir, DEFAULT_GIT_DIR_ENVIRONMENT))
+		return 0;
+	const char *s = strrchr(dir, '/');
+	return !s || strcmp(s + 1, DEFAULT_GIT_DIR_ENVIRONMENT);
 }
This function does not really determine if the repo is bare. I have no 
better name for it, though.
guess_if_bare_git_dir ?

I struggled to name that thing because it can't really tell, its just
guessing... but it is going to be right most of the time.  Of course
I'm sure there's some Git user somewhere who will confuse it.
I think the name is fine, but probably a comment in front would
help unconfuse people.

	/* Does it look like a repository without a working tree? */

Unfortunately there currently are public bare repositories that
have index under them because they were primed by rsync from
developers' working repositories.  I do not think it is
unreasonable to persuade owners of them to drop index -- then we
could use absence of $GIT_DIR/index as a strong clue that the
repository is bare.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help