git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
Dec 15, 2006, 21:55 UTC
Message-ID
<7vodq4n7ss.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20061215002015.GI26202@spearce.org>
Shawn Pearce <spearce@spearce.org> writes:
Show 21 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> Hi,
>> 
>> On Thu, 14 Dec 2006, Shawn O. Pearce wrote:
>> 
>> > +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.

Previous: Shawn PearceNext: Shawn Pearce
Message 8 of 9 in “Re: What's in git.git (stable)”
  1. Junio C HamanoDec 14, 2006
  2. Enable reflogs by default in any repository with a working directory.Shawn O. Pearce, Dec 14, 2006
  3. J. Bruce FieldsDec 14, 2006
  4. Shawn PearceDec 14, 2006
  5. J. Bruce FieldsDec 14, 2006
  6. Johannes SchindelinDec 15, 2006
  7. Shawn PearceDec 15, 2006
  8. Junio C HamanoDec 15, 2006
  9. Shawn PearceDec 14, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.