about summary refs log tree commit diff
path: root/third_party/git/setup.c
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
commit93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch)
tree85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/setup.c
parent6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff)
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing
changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/setup.c')
-rw-r--r--third_party/git/setup.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/third_party/git/setup.c b/third_party/git/setup.c
index 5ea9285a128c..8dcb4631f7d3 100644
--- a/third_party/git/setup.c
+++ b/third_party/git/setup.c
@@ -4,7 +4,6 @@
 #include "dir.h"
 #include "string-list.h"
 #include "chdir-notify.h"
-#include "promisor-remote.h"
 
 static int inside_git_dir = -1;
 static int inside_work_tree = -1;
@@ -120,13 +119,8 @@ char *prefix_path_gently(const char *prefix, int len,
 char *prefix_path(const char *prefix, int len, const char *path)
 {
 	char *r = prefix_path_gently(prefix, len, NULL, path);
-	if (!r) {
-		const char *hint_path = get_git_work_tree();
-		if (!hint_path)
-			hint_path = get_git_dir();
-		die(_("'%s' is outside repository at '%s'"), path,
-		    absolute_path(hint_path));
-	}
+	if (!r)
+		die(_("'%s' is outside repository"), path);
 	return r;
 }
 
@@ -202,26 +196,9 @@ static void NORETURN die_verify_filename(struct repository *r,
  */
 static int looks_like_pathspec(const char *arg)
 {
-	const char *p;
-	int escaped = 0;
-
-	/*
-	 * Wildcard characters imply the user is looking to match pathspecs
-	 * that aren't in the filesystem. Note that this doesn't include
-	 * backslash even though it's a glob special; by itself it doesn't
-	 * cause any increase in the match. Likewise ignore backslash-escaped
-	 * wildcard characters.
-	 */
-	for (p = arg; *p; p++) {
-		if (escaped) {
-			escaped = 0;
-		} else if (is_glob_special(*p)) {
-			if (*p == '\\')
-				escaped = 1;
-			else
-				return 1;
-		}
-	}
+	/* anything with a wildcard character */
+	if (!no_wildcard(arg))
+		return 1;
 
 	/* long-form pathspec magic */
 	if (starts_with(arg, ":("))
@@ -501,7 +478,7 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
 	}
 
 	repository_format_precious_objects = candidate->precious_objects;
-	set_repository_format_partial_clone(candidate->partial_clone);
+	repository_format_partial_clone = xstrdup_or_null(candidate->partial_clone);
 	repository_format_worktree_config = candidate->worktree_config;
 	string_list_clear(&candidate->unknown_extensions, 0);
 
@@ -820,7 +797,7 @@ static const char *setup_discovered_git_dir(const char *gitdir,
 		set_git_dir(gitdir);
 	inside_git_dir = 0;
 	inside_work_tree = 1;
-	if (offset >= cwd->len)
+	if (offset == cwd->len)
 		return NULL;
 
 	/* Make "offset" point past the '/' (already the case for root dirs) */
@@ -942,7 +919,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
 	const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
 	struct string_list ceiling_dirs = STRING_LIST_INIT_DUP;
 	const char *gitdirenv;
-	int ceil_offset = -1, min_offset = offset_1st_component(dir->buf);
+	int ceil_offset = -1, min_offset = has_dos_drive_prefix(dir->buf) ? 3 : 1;
 	dev_t current_device = 0;
 	int one_filesystem = 1;
 
@@ -970,12 +947,6 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
 	if (ceil_offset < 0)
 		ceil_offset = min_offset - 2;
 
-	if (min_offset && min_offset == dir->len &&
-	    !is_dir_sep(dir->buf[min_offset - 1])) {
-		strbuf_addch(dir, '/');
-		min_offset++;
-	}
-
 	/*
 	 * Test in the following order (relative to the dir):
 	 * - .git (file containing "gitdir: <path>")