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

Re: [PATCH] init: show "Reinit" message even in an (existing) empty repository

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 25, 2008, 09:55 UTC
Message-ID
<alpine.LSU.1.00.0803251052310.10660@wbgn129.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7viqzbmf2h.fsf@gitster.siamese.dyndns.org>
Hi,
On Tue, 25 Mar 2008, Junio C Hamano wrote:
Show 16 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > diff --git a/builtin-init-db.c b/builtin-init-db.c
> > index 1975910..ceb4727 100644
> > --- a/builtin-init-db.c
> > +++ b/builtin-init-db.c
> > @@ -168,10 +168,9 @@ static int create_default_files(const char *git_dir, const char *template_path)
> >  {
> >  	unsigned len = strlen(git_dir);
> >  	static char path[PATH_MAX];
> > -	unsigned char sha1[20];
> >  	struct stat st1;
> >  	char repo_version_string[10];
> > 	int reinit;
> 
> Here I saw a hand-edit, but that is less of a problem...

Heh, yes. I originally set reinit = 0, and thought I was clever by patch editing. But I have less experience with that than necessary, and then, I am not as clever as I thought, either... ;-)

Show 12 quoted lines
> >  	int filemode;
> >  
> >  	if (len > sizeof(path)-50)
> > @@ -220,7 +219,7 @@ static int create_default_files(const char *git_dir, const char *template_path)
> >  	 * branch, if it does not exist yet.
> >  	 */
> >  	strcpy(path + len, "HEAD");
> > -	reinit = !read_ref("HEAD", sha1);
> > +	reinit = !access(path, R_OK);
> 
> If this is a HEAD (or .git/HEAD) that is a dangling symlink (we do still
> support them, don't we?) wouldn't this access fail?

Right. I already saw your commit, and while I would have to think hard if it is implementing the correct logic (what does access() do with a dangling symlink? Is || correct?), I just trust you.

Although I have to admit that having the authorship of this commit is giving me more credit than I deserve.

Thanks, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 21 of 25 in “Store autocrlf during init-db (was [msysGit] autocrlf problems with Git-preview20080301.exe)”
  1. Steffen ProhaskaMar 23, 2008
  2. init-db: Store current value of autocrlfSteffen Prohaska, Mar 23, 2008
  3. Dmitry PotapovMar 24, 2008
  4. Johannes SchindelinMar 23, 2008
  5. Steffen ProhaskaMar 23, 2008
  6. Johannes SchindelinMar 23, 2008
  7. Steffen ProhaskaMar 23, 2008
  8. Johannes SchindelinMar 23, 2008
  9. Steffen ProhaskaMar 23, 2008
  10. Johannes SchindelinMar 23, 2008
  11. Steffen ProhaskaMar 23, 2008
  12. Johannes SchindelinMar 23, 2008
  13. Dmitry PotapovMar 23, 2008
  14. Johannes SchindelinMar 24, 2008
  15. Dmitry PotapovMar 24, 2008
  16. Johannes SchindelinMar 24, 2008
  17. Dmitry PotapovMar 24, 2008
  18. Introduce core.initHookJohannes Schindelin, Mar 24, 2008
  19. init: show "Reinit" message even in an (existing) empty repositoryJohannes Schindelin, Mar 24, 2008
  20. Junio C HamanoMar 25, 2008
  21. Johannes SchindelinMar 25, 2008
  22. Junio C HamanoMar 24, 2008
  23. Introduce core.initHookJohannes Schindelin, Mar 24, 2008
  24. Junio C HamanoMar 24, 2008
  25. Introduce core.initHookJohannes Schindelin, Mar 24, 2008

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.