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

Re: MinGW port pull request

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jun 24, 2008, 13:01 UTC
Message-ID
<4860F019.6090309@viscovery.net>
In-Reply-To
<7vskv79l37.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
>  * There is an interaction with dr/ceiling topic that is already in 'next'
>    that needs to be resolved before we merge this in 'next'.
> 
> Parked in 'pu' for now but with a broken merge resolution.

Please amend the merge commit by this to get the correct resolution: minoffset in the MinGW port and ceil_offset in dr/ceiling are used for the same purpose where always ceil_offset == minoffset-1.

We need to adjust ceil_offset only if longest_ancestor_length() returned -1 (i.e. "there is no prefix") to skip the drive prefix ("C:"); because if there was some prefix, then the return value will already have accounted for the drive prefix.

-- Hannes
diff --git a/setup.c b/setup.c
index 531f852..39f1648 100644
--- a/setup.c
+++ b/setup.c
@@ -382,7 +382,6 @@ const char *setup_git_directory_gently(int *nongit_ok)
 	const char *gitdirenv;
 	const char *gitfile_dir;
 	int len, offset, ceil_offset;
-	int minoffset = 0;

 	/*
 	 * Let's assume that we are in a git repository.
@@ -433,12 +432,10 @@ const char *setup_git_directory_gently(int

 	if (!getcwd(cwd, sizeof(cwd)-1))
 		die("Unable to read current working directory");
-	if (has_dos_drive_prefix(cwd))
-		minoffset = 2;

 	ceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);
-	if (ceil_offset < minoffset)
-		ceil_offset = minoffset;
+	if (ceil_offset < 0 && has_dos_drive_prefix(cwd))
+		ceil_offset = 1;

 	/*
 	 * Test in the following order (relative to the cwd):
Previous: Johannes Sixt
Message 7 of 7 in “MinGW port pull request”
  1. Johannes SixtJun 20, 2008
  2. Junio C HamanoJun 21, 2008
  3. Johannes SixtJun 21, 2008
  4. Jim RadenJun 21, 2008
  5. Junio C HamanoJun 21, 2008
  6. Johannes SixtJun 23, 2008
  7. Johannes SixtJun 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.