Git development
 help / color / mirror / Atom feed
* [PATCH v4 02/12] urlmatch.h: use config_fn_t type
From: Glen Choo via GitGitGadget @ 2023-06-26 18:11 UTC (permalink / raw)
  To: git
  Cc: Jonathan Tan, Ævar Arnfjörð Bjarmason,
	Emily Shaffer, Phillip Wood, Jeff King, Glen Choo, Glen Choo
In-Reply-To: <pull.1497.v4.git.git.1687803083.gitgitgadget@gmail.com>

From: Glen Choo <chooglen@google.com>

These are actually used as config callbacks, so use the typedef-ed type
and make future refactors easier.

Signed-off-by: Glen Choo <chooglen@google.com>
---
 urlmatch.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/urlmatch.h b/urlmatch.h
index 9f40b00bfb8..bee374a642c 100644
--- a/urlmatch.h
+++ b/urlmatch.h
@@ -2,6 +2,7 @@
 #define URL_MATCH_H
 
 #include "string-list.h"
+#include "config.h"
 
 struct url_info {
 	/* normalized url on success, must be freed, otherwise NULL */
@@ -48,8 +49,8 @@ struct urlmatch_config {
 	const char *key;
 
 	void *cb;
-	int (*collect_fn)(const char *var, const char *value, void *cb);
-	int (*cascade_fn)(const char *var, const char *value, void *cb);
+	config_fn_t collect_fn;
+	config_fn_t cascade_fn;
 	/*
 	 * Compare the two matches, the one just discovered and the existing
 	 * best match and return a negative value if the found item is to be
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v4 01/12] config: inline git_color_default_config
From: Glen Choo via GitGitGadget @ 2023-06-26 18:11 UTC (permalink / raw)
  To: git
  Cc: Jonathan Tan, Ævar Arnfjörð Bjarmason,
	Emily Shaffer, Phillip Wood, Jeff King, Glen Choo, Glen Choo
In-Reply-To: <pull.1497.v4.git.git.1687803083.gitgitgadget@gmail.com>

From: Glen Choo <chooglen@google.com>

git_color_default_config() is a shorthand for calling two other config
callbacks. There are no other non-static functions that do this and it
will complicate our refactoring of config_fn_t so inline it instead.

Signed-off-by: Glen Choo <chooglen@google.com>
---
 builtin/add.c         | 5 ++++-
 builtin/branch.c      | 5 ++++-
 builtin/clean.c       | 6 ++++--
 builtin/grep.c        | 5 ++++-
 builtin/show-branch.c | 5 ++++-
 builtin/tag.c         | 6 +++++-
 color.c               | 8 --------
 color.h               | 6 +-----
 8 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 6137e7b4ad7..e01efdfc50d 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -365,7 +365,10 @@ static int add_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	return git_color_default_config(var, value, cb);
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
 }
 
 static const char embedded_advice[] = N_(
diff --git a/builtin/branch.c b/builtin/branch.c
index 075e580d224..8337b9e71bb 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -117,7 +117,10 @@ static int git_branch_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	return git_color_default_config(var, value, cb);
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
 }
 
 static const char *branch_get_color(enum color_branch ix)
diff --git a/builtin/clean.c b/builtin/clean.c
index 78852d28cec..57e7f7cac64 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -130,8 +130,10 @@ static int git_clean_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	/* inspect the color.ui config variable and others */
-	return git_color_default_config(var, value, cb);
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
 }
 
 static const char *clean_get_color(enum color_clean ix)
diff --git a/builtin/grep.c b/builtin/grep.c
index b86c754defb..76cf999d310 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -293,7 +293,10 @@ static int wait_all(void)
 static int grep_cmd_config(const char *var, const char *value, void *cb)
 {
 	int st = grep_config(var, value, cb);
-	if (git_color_default_config(var, value, NULL) < 0)
+
+	if (git_color_config(var, value, cb) < 0)
+		st = -1;
+	else if (git_default_config(var, value, cb) < 0)
 		st = -1;
 
 	if (!strcmp(var, "grep.threads")) {
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 7ef4a642c17..a2461270d4b 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -579,7 +579,10 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	return git_color_default_config(var, value, cb);
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
 }
 
 static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
diff --git a/builtin/tag.c b/builtin/tag.c
index 49b64c7a288..1acf5f7a59f 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -209,7 +209,11 @@ static int git_tag_config(const char *var, const char *value, void *cb)
 
 	if (starts_with(var, "column."))
 		return git_column_config(var, value, "tag", &colopts);
-	return git_color_default_config(var, value, cb);
+
+	if (git_color_config(var, value, cb) < 0)
+		return -1;
+
+	return git_default_config(var, value, cb);
 }
 
 static void write_tag_body(int fd, const struct object_id *oid)
diff --git a/color.c b/color.c
index 83abb11eda0..b24b19566b9 100644
--- a/color.c
+++ b/color.c
@@ -430,14 +430,6 @@ int git_color_config(const char *var, const char *value, void *cb UNUSED)
 	return 0;
 }
 
-int git_color_default_config(const char *var, const char *value, void *cb)
-{
-	if (git_color_config(var, value, cb) < 0)
-		return -1;
-
-	return git_default_config(var, value, cb);
-}
-
 void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb)
 {
 	if (*color)
diff --git a/color.h b/color.h
index cfc8f841b23..bb28343be21 100644
--- a/color.h
+++ b/color.h
@@ -88,12 +88,8 @@ extern const int column_colors_ansi_max;
  */
 extern int color_stdout_is_tty;
 
-/*
- * Use the first one if you need only color config; the second is a convenience
- * if you are just going to change to git_default_config, too.
- */
+/* Parse color config. */
 int git_color_config(const char *var, const char *value, void *cb);
-int git_color_default_config(const char *var, const char *value, void *cb);
 
 /*
  * Parse a config option, which can be a boolean or one of
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v4 00/12] config: remove global state from config iteration
From: Glen Choo via GitGitGadget @ 2023-06-26 18:11 UTC (permalink / raw)
  To: git
  Cc: Jonathan Tan, Ævar Arnfjörð Bjarmason,
	Emily Shaffer, Phillip Wood, Jeff King, Glen Choo
In-Reply-To: <pull.1497.v3.git.git.1687290231.gitgitgadget@gmail.com>

Thanks for the careful reread of the previous round and the helpful suggestions.
This version is _mostly_ just the previous one rebased onto a newer 'master'
with the conflicting topics applied, per Jonathan's and Junio's suggestions, and
I plan to address Jonathan's comments in the next version.

Junio: There is now a minor conflict with the bugfix I sent in [1] (the
resolution is to just pick this series). It seemed small enough that I didn't
think it was worth basing this series on top of that, but let me know if you
feel otherwise. If both series happen to go through the same release cycle, we
could also drop that one-patch.

I also tested these patches on top of 'seen', and the only conflict I found was
with en/header-split-cache-h-part-3, where ll-merge.c got renamed to merge-ll.c,
so we need to apply the config refactor there (should work with .cocci).

= Changes since v3

- Rebase onto newer 'master'
- Move the 'remove UNUSED from tr2_cfg_cb' hunk from 9/12 -> 8/12. It should
  have been there all along; v3 8/12 didn't build at all.

[1] https://lore.kernel.org/git/pull.1535.git.git.1687801297404.gitgitgadget@gmail.com/


Glen Choo (12):
  config: inline git_color_default_config
  urlmatch.h: use config_fn_t type
  config: add ctx arg to config_fn_t
  config.c: pass ctx in configsets
  config: pass ctx with config files
  builtin/config.c: test misuse of format_config()
  config.c: pass ctx with CLI config
  trace2: plumb config kvi
  config: pass kvi to die_bad_number()
  config.c: remove config_reader from configsets
  config: add kvi.path, use it to evaluate includes
  config: pass source to config_parser_event_fn_t

 alias.c                                       |   3 +-
 archive-tar.c                                 |   5 +-
 archive-zip.c                                 |   1 +
 builtin/add.c                                 |   8 +-
 builtin/blame.c                               |   5 +-
 builtin/branch.c                              |   8 +-
 builtin/cat-file.c                            |   5 +-
 builtin/checkout.c                            |  12 +-
 builtin/clean.c                               |   9 +-
 builtin/clone.c                               |  11 +-
 builtin/column.c                              |   3 +-
 builtin/commit-graph.c                        |   3 +-
 builtin/commit.c                              |  20 +-
 builtin/config.c                              |  72 ++-
 builtin/difftool.c                            |   5 +-
 builtin/fetch.c                               |  13 +-
 builtin/fsmonitor--daemon.c                   |  11 +-
 builtin/grep.c                                |  12 +-
 builtin/help.c                                |   5 +-
 builtin/index-pack.c                          |   9 +-
 builtin/log.c                                 |  12 +-
 builtin/merge.c                               |   7 +-
 builtin/multi-pack-index.c                    |   1 +
 builtin/pack-objects.c                        |  19 +-
 builtin/patch-id.c                            |   5 +-
 builtin/pull.c                                |   5 +-
 builtin/push.c                                |   5 +-
 builtin/read-tree.c                           |   5 +-
 builtin/rebase.c                              |   5 +-
 builtin/receive-pack.c                        |  15 +-
 builtin/reflog.c                              |   7 +-
 builtin/remote.c                              |  15 +-
 builtin/repack.c                              |   5 +-
 builtin/reset.c                               |   5 +-
 builtin/send-pack.c                           |   5 +-
 builtin/show-branch.c                         |   8 +-
 builtin/stash.c                               |   5 +-
 builtin/submodule--helper.c                   |   3 +-
 builtin/tag.c                                 |   9 +-
 builtin/var.c                                 |   5 +-
 builtin/worktree.c                            |   5 +-
 bundle-uri.c                                  |   9 +-
 color.c                                       |   8 -
 color.h                                       |   6 +-
 compat/mingw.c                                |   3 +-
 compat/mingw.h                                |   4 +-
 config.c                                      | 552 +++++++-----------
 config.h                                      |  80 ++-
 connect.c                                     |   4 +-
 .../coccinelle/config_fn_ctx.pending.cocci    | 144 +++++
 contrib/coccinelle/git_config_number.cocci    |  27 +
 convert.c                                     |   4 +-
 credential.c                                  |   1 +
 delta-islands.c                               |   4 +-
 diff.c                                        |  19 +-
 diff.h                                        |   7 +-
 fetch-pack.c                                  |   5 +-
 fmt-merge-msg.c                               |   7 +-
 fmt-merge-msg.h                               |   3 +-
 fsck.c                                        |  12 +-
 fsck.h                                        |   4 +-
 git-compat-util.h                             |   2 +
 gpg-interface.c                               |   7 +-
 grep.c                                        |   7 +-
 grep.h                                        |   4 +-
 help.c                                        |   9 +-
 http.c                                        |  15 +-
 ident.c                                       |   4 +-
 ident.h                                       |   4 +-
 imap-send.c                                   |   7 +-
 ll-merge.c                                    |   1 +
 ls-refs.c                                     |   1 +
 mailinfo.c                                    |   5 +-
 notes-utils.c                                 |   4 +-
 notes.c                                       |   4 +-
 pager.c                                       |   5 +-
 pretty.c                                      |   1 +
 promisor-remote.c                             |   4 +-
 remote.c                                      |   8 +-
 revision.c                                    |   4 +-
 scalar.c                                      |   4 +-
 sequencer.c                                   |  29 +-
 setup.c                                       |  18 +-
 submodule-config.c                            |  31 +-
 submodule-config.h                            |   3 +-
 t/helper/test-config.c                        |  24 +-
 t/helper/test-userdiff.c                      |   4 +-
 t/t1300-config.sh                             |  27 +
 trace2.c                                      |   4 +-
 trace2.h                                      |   3 +-
 trace2/tr2_cfg.c                              |  16 +-
 trace2/tr2_sysenv.c                           |   3 +-
 trace2/tr2_tgt.h                              |   4 +-
 trace2/tr2_tgt_event.c                        |   4 +-
 trace2/tr2_tgt_normal.c                       |   4 +-
 trace2/tr2_tgt_perf.c                         |   4 +-
 trailer.c                                     |   2 +
 upload-pack.c                                 |  18 +-
 urlmatch.c                                    |   7 +-
 urlmatch.h                                    |   8 +-
 worktree.c                                    |   2 +-
 xdiff-interface.c                             |   5 +-
 xdiff-interface.h                             |   4 +-
 103 files changed, 960 insertions(+), 638 deletions(-)
 create mode 100644 contrib/coccinelle/config_fn_ctx.pending.cocci
 create mode 100644 contrib/coccinelle/git_config_number.cocci


base-commit: 6ff334181cfb6485d3ba50843038209a2a253907
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1497%2Fchooglen%2Fconfig%2Fno-global-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1497/chooglen/config/no-global-v4
Pull-Request: https://github.com/git/git/pull/1497

Range-diff vs v3:

  1:  26109b65142 !  1:  7bfffb454c5 config: inline git_color_default_config
     @@ Commit message
      
          Signed-off-by: Glen Choo <chooglen@google.com>
      
     + ## builtin/add.c ##
     +@@ builtin/add.c: static int add_config(const char *var, const char *value, void *cb)
     + 		return 0;
     + 	}
     + 
     +-	return git_color_default_config(var, value, cb);
     ++	if (git_color_config(var, value, cb) < 0)
     ++		return -1;
     ++
     ++	return git_default_config(var, value, cb);
     + }
     + 
     + static const char embedded_advice[] = N_(
     +
       ## builtin/branch.c ##
      @@ builtin/branch.c: static int git_branch_config(const char *var, const char *value, void *cb)
       		return 0;
  2:  1aeffcb1395 =  2:  739c519ce62 urlmatch.h: use config_fn_t type
  3:  d3eb439aad2 !  3:  a9a0a50f32a config: add ctx arg to config_fn_t
     @@ builtin/add.c: static struct option builtin_add_options[] = {
       	if (!strcmp(var, "add.ignoreerrors") ||
       	    !strcmp(var, "add.ignore-errors")) {
      @@ builtin/add.c: static int add_config(const char *var, const char *value, void *cb)
     - 		return 0;
     - 	}
     + 	if (git_color_config(var, value, cb) < 0)
     + 		return -1;
       
      -	return git_default_config(var, value, cb);
      +	return git_default_config(var, value, ctx, cb);
     @@ builtin/difftool.c: static const char *const builtin_difftool_usage[] = {
      
       ## builtin/fetch.c ##
      @@ builtin/fetch.c: struct fetch_config {
     - 	enum display_format display_format;
     + 	int submodule_fetch_jobs;
       };
       
      -static int git_fetch_config(const char *k, const char *v, void *cb)
  4:  c5051ddc10d =  4:  39b2e291f86 config.c: pass ctx in configsets
  5:  595e7d2e163 !  5:  bfc6d2833c5 config: pass ctx with config files
     @@ config.c: static int do_git_config_sequence(struct config_reader *reader,
      +							 CONFIG_SCOPE_LOCAL, NULL);
       
       	config_reader_set_scope(reader, CONFIG_SCOPE_WORKTREE);
     - 	if (!opts->ignore_worktree && repository_format_worktree_config) {
     - 		char *path = git_pathdup("config.worktree");
     - 		if (!access_or_die(path, R_OK, 0))
     --			ret += git_config_from_file(fn, path, data);
     -+			ret += git_config_from_file_with_options(fn, path, data,
     + 	if (!opts->ignore_worktree && worktree_config &&
     + 	    repo && repo->repository_format_worktree_config &&
     + 	    !access_or_die(worktree_config, R_OK, 0)) {
     +-		ret += git_config_from_file(fn, worktree_config, data);
     ++			ret += git_config_from_file_with_options(fn, worktree_config, data,
      +								 CONFIG_SCOPE_WORKTREE,
      +								 NULL);
     - 		free(path);
       	}
       
     + 	config_reader_set_scope(reader, CONFIG_SCOPE_COMMAND);
      @@ config.c: int config_with_options(config_fn_t fn, void *data,
       	 * regular lookup sequence.
       	 */
     @@ config.c: int config_with_options(config_fn_t fn, void *data,
      +							data, config_source->scope,
      +							NULL);
       	} else if (config_source && config_source->blob) {
     - 		struct repository *repo = config_source->repo ?
     - 			config_source->repo : the_repository;
       		ret = git_config_from_blob_ref(fn, repo, config_source->blob,
      -						data);
      +					       data, config_source->scope);
       	} else {
     - 		ret = do_git_config_sequence(&the_reader, opts, fn, data);
     + 		ret = do_git_config_sequence(&the_reader, opts, repo, fn, data);
       	}
      @@ config.c: static int configset_add_value(struct config_reader *reader,
       	if (!reader->source)
  6:  a2a891a069f =  6:  897bdc759b5 builtin/config.c: test misuse of format_config()
  7:  1fb1708bbd9 !  7:  33e4437737d config.c: pass ctx with CLI config
     @@ builtin/config.c: static int collect_config(const char *key_, const char *value_
       
       static int get_value(const char *key_, const char *regex_, unsigned flags)
      @@ builtin/config.c: static int get_value(const char *key_, const char *regex_, unsigned flags)
     - 			    &given_config_source, &config_options);
     + 			    &config_options);
       
       	if (!values.nr && default_value) {
      +		struct key_value_info kvi = KVI_INIT;
  8:  66572df7beb !  8:  9bd5f60282c trace2: plumb config kvi
     @@ config.c: static void populate_remote_urls(struct config_include_data *inc)
      -
       	inc->remote_urls = xmalloc(sizeof(*inc->remote_urls));
       	string_list_init_dup(inc->remote_urls);
     - 	config_with_options(add_remote_url, inc->remote_urls, inc->config_source, &opts);
     + 	config_with_options(add_remote_url, inc->remote_urls,
     + 			    inc->config_source, inc->repo, &opts);
      -
      -	config_reader_set_scope(inc->config_reader, store_scope);
       }
       
       static int forbid_remote_url(const char *var, const char *value UNUSED,
      @@ config.c: static int do_git_config_sequence(struct config_reader *reader,
     - 	char *xdg_config = NULL;
       	char *user_config = NULL;
       	char *repo_config;
     + 	char *worktree_config;
      -	enum config_scope prev_parsing_scope = reader->parsing_scope;
       
     - 	if (opts->commondir)
     - 		repo_config = mkpathdup("%s/config", opts->commondir);
     + 	/*
     + 	 * Ensure that either:
      @@ config.c: static int do_git_config_sequence(struct config_reader *reader,
     - 	else
     - 		repo_config = NULL;
     + 		worktree_config = NULL;
     + 	}
       
      -	config_reader_set_scope(reader, CONFIG_SCOPE_SYSTEM);
       	if (git_config_system() && system_config &&
     @@ config.c: static int do_git_config_sequence(struct config_reader *reader,
       							 CONFIG_SCOPE_LOCAL, NULL);
       
      -	config_reader_set_scope(reader, CONFIG_SCOPE_WORKTREE);
     - 	if (!opts->ignore_worktree && repository_format_worktree_config) {
     - 		char *path = git_pathdup("config.worktree");
     - 		if (!access_or_die(path, R_OK, 0))
     + 	if (!opts->ignore_worktree && worktree_config &&
     + 	    repo && repo->repository_format_worktree_config &&
     + 	    !access_or_die(worktree_config, R_OK, 0)) {
      @@ config.c: static int do_git_config_sequence(struct config_reader *reader,
     - 		free(path);
     + 								 NULL);
       	}
       
      -	config_reader_set_scope(reader, CONFIG_SCOPE_COMMAND);
     @@ trace2.h: void trace2_thread_exit_fl(const char *file, int line);
       	trace2_def_param_fl(__FILE__, __LINE__, (param), (value))
      
       ## trace2/tr2_cfg.c ##
     +@@ trace2/tr2_cfg.c: struct tr2_cfg_data {
     +  * See if the given config key matches any of our patterns of interest.
     +  */
     + static int tr2_cfg_cb(const char *key, const char *value,
     +-		      const struct config_context *ctx UNUSED, void *d)
     ++		      const struct config_context *ctx, void *d)
     + {
     + 	struct strbuf **s;
     + 	struct tr2_cfg_data *data = (struct tr2_cfg_data *)d;
      @@ trace2/tr2_cfg.c: static int tr2_cfg_cb(const char *key, const char *value,
       		struct strbuf *buf = *s;
       		int wm = wildmatch(buf->buf, key, WM_CASEFOLD);
  9:  123e19dda4a !  9:  114723ee4a7 config: pass kvi to die_bad_number()
     @@ builtin/fetch.c: static int git_fetch_config(const char *k, const char *v,
       	}
       
       	if (!strcmp(k, "submodule.fetchjobs")) {
     --		submodule_fetch_jobs_config = parse_submodule_fetchjobs(k, v);
     -+		submodule_fetch_jobs_config = parse_submodule_fetchjobs(k, v, ctx->kvi);
     +-		fetch_config->submodule_fetch_jobs = parse_submodule_fetchjobs(k, v);
     ++		fetch_config->submodule_fetch_jobs = parse_submodule_fetchjobs(k, v, ctx->kvi);
       		return 0;
       	} else if (!strcmp(k, "fetch.recursesubmodules")) {
     - 		recurse_submodules = parse_fetch_recurse_submodules_arg(k, v);
     + 		fetch_config->recurse_submodules = parse_fetch_recurse_submodules_arg(k, v);
      @@ builtin/fetch.c: static int git_fetch_config(const char *k, const char *v,
       	}
       
       	if (!strcmp(k, "fetch.parallel")) {
     --		fetch_parallel_config = git_config_int(k, v);
     -+		fetch_parallel_config = git_config_int(k, v, ctx->kvi);
     - 		if (fetch_parallel_config < 0)
     +-		fetch_config->parallel = git_config_int(k, v);
     ++		fetch_config->parallel = git_config_int(k, v, ctx->kvi);
     + 		if (fetch_config->parallel < 0)
       			die(_("fetch.parallel cannot be negative"));
     - 		if (!fetch_parallel_config)
     + 		if (!fetch_config->parallel)
      
       ## builtin/fsmonitor--daemon.c ##
      @@ builtin/fsmonitor--daemon.c: static int fsmonitor_config(const char *var, const char *value,
     @@ t/helper/test-config.c: int cmd__config(int argc, const char **argv)
       				printf("(NULL)\n");
       			else
      
     - ## trace2/tr2_cfg.c ##
     -@@ trace2/tr2_cfg.c: struct tr2_cfg_data {
     -  * See if the given config key matches any of our patterns of interest.
     -  */
     - static int tr2_cfg_cb(const char *key, const char *value,
     --		      const struct config_context *ctx UNUSED, void *d)
     -+		      const struct config_context *ctx, void *d)
     - {
     - 	struct strbuf **s;
     - 	struct tr2_cfg_data *data = (struct tr2_cfg_data *)d;
     -
       ## upload-pack.c ##
      @@ upload-pack.c: static int find_symref(const char *refname,
       }
 10:  8ec24b018e9 ! 10:  807057b6d7f config.c: remove config_reader from configsets
     @@ config.c: static void repo_read_config(struct repository *repo)
      -	data.config_set = repo->config;
      -	data.config_reader = &the_reader;
      -
     --	if (config_with_options(config_set_callback, &data, NULL, &opts) < 0)
     +-	if (config_with_options(config_set_callback, &data, NULL, repo, &opts) < 0)
      +	if (config_with_options(config_set_callback, repo->config, NULL,
     -+				&opts) < 0)
     ++				repo, &opts) < 0)
       		/*
       		 * config_with_options() normally returns only
       		 * zero, as most errors are fatal, and
     @@ config.c: static void read_protected_config(void)
       	git_configset_init(&protected_config);
      -	data.config_set = &protected_config;
      -	data.config_reader = &the_reader;
     --	config_with_options(config_set_callback, &data, NULL, &opts);
     -+	config_with_options(config_set_callback, &protected_config, NULL, &opts);
     +-	config_with_options(config_set_callback, &data, NULL, NULL, &opts);
     ++	config_with_options(config_set_callback, &protected_config, NULL,
     ++			    NULL, &opts);
       }
       
       void git_protected_config(config_fn_t fn, void *data)
 11:  8ae115cff88 ! 11:  3f0f84df972 config: add kvi.path, use it to evaluate includes
     @@ Commit message
      
       ## config.c ##
      @@ config.c: struct config_include_data {
     - 	void *data;
       	const struct config_options *opts;
       	struct git_config_source *config_source;
     + 	struct repository *repo;
      -	struct config_reader *config_reader;
       
       	/*
     @@ config.c: static void kvi_from_source(struct config_source *cs,
       
       static int git_parse_source(struct config_source *cs, config_fn_t fn,
      @@ config.c: int config_with_options(config_fn_t fn, void *data,
     - 		inc.data = data;
       		inc.opts = opts;
     + 		inc.repo = repo;
       		inc.config_source = config_source;
      -		inc.config_reader = &the_reader;
       		fn = git_config_include;
 12:  484d553cc7d ! 12:  fe2f154fe8b config: pass source to config_parser_event_fn_t
     @@ config.c: int git_config_system(void)
      -static int do_git_config_sequence(struct config_reader *reader,
      -				  const struct config_options *opts,
      +static int do_git_config_sequence(const struct config_options *opts,
     + 				  const struct repository *repo,
       				  config_fn_t fn, void *data)
       {
     - 	int ret = 0;
      @@ config.c: int config_with_options(config_fn_t fn, void *data,
       		ret = git_config_from_blob_ref(fn, repo, config_source->blob,
       					       data, config_source->scope);
       	} else {
     --		ret = do_git_config_sequence(&the_reader, opts, fn, data);
     -+		ret = do_git_config_sequence(opts, fn, data);
     +-		ret = do_git_config_sequence(&the_reader, opts, repo, fn, data);
     ++		ret = do_git_config_sequence(opts, repo, fn, data);
       	}
       
       	if (inc.remote_urls) {

-- 
gitgitgadget

^ permalink raw reply

* [PATCH] config: don't BUG when both kvi and source are set
From: Glen Choo via GitGitGadget @ 2023-06-26 17:41 UTC (permalink / raw)
  To: git; +Cc: Jesse Kasky, Derrick Stolee, Jonathan Tan, Glen Choo, Glen Choo

From: Glen Choo <chooglen@google.com>

When iterating through config, we read config source metadata from
global values - either a "struct config_source + enum config_scope"
or a "struct key_value_info", using the current_config* functions. Prior
to the series starting from 0c60285147 (config.c: create config_reader
and the_reader, 2023-03-28), we weren't very picky about which values we
should read in which situation; we did note that both groups of values
generally shouldn't be set together, but if both were set,
current_config* preferentially reads key_value_info. When that series
added more structure, we enforced that either the former (when parsing a
config source) can be set, or the latter (when iterating a config set),
but *never* both at the same time. See 9828453ff0 (config.c: remove
current_config_kvi, 2023-03-28) and 5cdf18e7cd (config.c: remove
current_parsing_scope, 2023-03-28).

That was a good simplifying constraint that helped us reason about the
global state, but it turns out that there is at least one situation
where we need both to be set at the same time: in a blobless partial
clone where .gitmodules is missing. "git fetch" in such a repo will
start a config parse over .gitmodules (setting the config_source), and
Git will attempt to lazy-fetch it from the promisor remote. However,
when we try to read the promisor configuration, we start iterating a
config set (setting the key_value_info), and we BUG() out because that's
not allowed any more.

Teaching config_reader to gracefully handle this is somewhat
complicated, but fortunately, there are proposed changes to the config.c
machinery to get rid of this global state, and make the BUG() obsolete
[1]. We should rely on that as the eventual solution, and avoid doing
yet another refactor in the meantime.

Therefore, fix the bug by removing the BUG() check. We're reverting to
an older, less safe state, but that's generally okay since
key_value_info is always preferentially read, so we'd always read the
correct values when we iterate a config set in the middle of a config
parse (like we are here). The reverse would be wrong, but extremely
unlikely to happen since very few callers parse config without going
through a config set.

[1] https://lore.kernel.org/git/pull.1497.v3.git.git.1687290231.gitgitgadget@gmail.com

Signed-off-by: Glen Choo <chooglen@google.com>
---
    config: don't BUG when both kvi and source are set
    
    Here's a quick fix for the bug reported at [1]. As noted in the commit
    message and that thread, I think the real fix to take [2], which
    simplifies the config.c state and makes this a non-issue, so this is
    just a band-aid while we wait for that.
    
    [1]
    https://lore.kernel.org/git/CAJSLrw6qhHj8Kxrqhp7xN=imTHgg79QB9Fxa9XpdZYFnBKhkvA@mail.gmail.com/
    [2]
    https://lore.kernel.org/git/pull.1497.v3.git.git.1687290231.gitgitgadget@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1535%2Fchooglen%2Fpush-ppuusrxwqpkt-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1535/chooglen/push-ppuusrxwqpkt-v1
Pull-Request: https://github.com/git/git/pull/1535

 config.c                 |  6 ------
 t/t5616-partial-clone.sh | 10 ++++++++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/config.c b/config.c
index f5bdac0aeed..3edb9d72dd3 100644
--- a/config.c
+++ b/config.c
@@ -106,8 +106,6 @@ static struct config_reader the_reader;
 static inline void config_reader_push_source(struct config_reader *reader,
 					     struct config_source *top)
 {
-	if (reader->config_kvi)
-		BUG("source should not be set while iterating a config set");
 	top->prev = reader->source;
 	reader->source = top;
 }
@@ -125,16 +123,12 @@ static inline struct config_source *config_reader_pop_source(struct config_reade
 static inline void config_reader_set_kvi(struct config_reader *reader,
 					 struct key_value_info *kvi)
 {
-	if (kvi && (reader->source || reader->parsing_scope))
-		BUG("kvi should not be set while parsing a config source");
 	reader->config_kvi = kvi;
 }
 
 static inline void config_reader_set_scope(struct config_reader *reader,
 					   enum config_scope scope)
 {
-	if (scope && reader->config_kvi)
-		BUG("scope should only be set when iterating through a config source");
 	reader->parsing_scope = scope;
 }
 
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index f519d2a87a7..8759fc28533 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -257,8 +257,8 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 works with submod
 	test_commit -C submodule mycommit &&
 
 	test_create_repo src_with_sub &&
-	test_config -C src_with_sub uploadpack.allowfilter 1 &&
-	test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
+	git -C src_with_sub config uploadpack.allowfilter 1 &&
+	git -C src_with_sub config uploadpack.allowanysha1inwant 1 &&
 
 	test_config_global protocol.file.allow always &&
 
@@ -270,6 +270,12 @@ test_expect_success 'partial clone with transfer.fsckobjects=1 works with submod
 	test_when_finished rm -rf dst
 '
 
+test_expect_success 'lazily fetched .gitmodules works' '
+	git clone --filter="blob:none" --no-checkout "file://$(pwd)/src_with_sub" dst &&
+	git -C dst fetch &&
+	test_when_finished rm -rf dst
+'
+
 test_expect_success 'partial clone with transfer.fsckobjects=1 uses index-pack --fsck-objects' '
 	git init src &&
 	test_commit -C src x &&

base-commit: 6640c2d06d112675426cf436f0594f0e8c614848
-- 
gitgitgadget

^ permalink raw reply related

* Re: Git question rewarding git merge and its exit codes
From: Iván Expósito @ 2023-06-26 17:35 UTC (permalink / raw)
  To: rsbecker; +Cc: git
In-Reply-To: <004c01d9a842$77e75ee0$67b61ca0$@nexbridge.com>

Thanks so much for the suggestions. I already thought on the first
one, comparing the SHA's, but not always same SHA's will ensure the
merge will have changes to be made (ideological would be the correct,
but some workflows won't ensure it). Will take a look using
-no--commit and take a look with git status and the porcelain flag.
That may be easier and more secure.

Thanks for the answers.

Ivan

El lun, 26 jun 2023 a las 17:25, <rsbecker@nexbridge.com> escribió:
>
> On Monday, June 26, 2023 8:15 AM, Iván Expósito wrote:
> >Recently, we have been working on some automations for Git, especially auto-
> >merging some branches. Just noticed that when using: git merge --commit --no-ff -m
> >"test message", and no changes are needed, git returns  "Already up-to-date" with
> >exit code 0. Is this correct? Git hasn't done anything, so not sure how correct is to
> >return 0 for success when nothing has been done. We have here a problem because
> >the only way we can detect if a commit has been made or not is to check the return
> >text, which is not the best idea for future-proof, or changes in the return text.
> >
> >Is this exit code as defined, or maybe is something we would need to look into for
> >future improvements? Is there any other alternatives to detect what has happened,
> >not comparing the standard output text?
>
> If you want to script this, use --no-commit instead of --commit. After the merge runs, use git status --porcelain to determine whether merge performed any actions involving staging to unstaged (conflicts) files. This removes the need to use the completion code.
>
> --Randall
>
> --
> Brief whoami: NonStop&UNIX developer since approximately
> UNIX(421664400)
> NonStop(211288444200000000)
> -- In real life, I talk too much.
>
>
>

^ permalink raw reply

* Re: [PATCH v0 0/4] Remove obsolete Cygwin support from git-gui
From: Mark Levedahl @ 2023-06-26 16:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, adam, me, johannes.schindelin
In-Reply-To: <xmqqsfae5igi.fsf@gitster.g>


On 6/26/23 11:52, Junio C Hamano wrote:
> Mark Levedahl <mlevedahl@gmail.com> writes:
>
>> I had originally organized as you suggest, no problem doing so
>> again. What gave me pause was this paragraph I originally wrote for
>> the cover letter:
>>
>> Patches 1/2 cause git-gui to function as it has for the last decade on
>> Cygwin, but with Cygwin being detected. However, the browsing and
>> shortcut creation menu items, removed in 2012 then re-added when is_Cygwin
>> was fixed, do not work, and shortcut creation will crash git-gui if used.
>> These are fixed in patches 3 / 4.
> As you are removing (ancient) Cygwin specific code that did not work
> with modern Cygwin at all in step [2/4], it is not so unexpected
> that some stuff does still not work after that step.  I am not sure
> what your reservation exactly is, but if you are wondering if code
> to disable browsing and shortcut creation on Cygwin temporarily
> needs to be there in the same step (instead of crashing or not
> working), it may make sense if and only if it is done with minimal
> changes.
>
> Thanks.
>
Timely response ... yes, that was my concern. I resolved this by making 
the cover letter and patch 2 commit message explicit that broken code 
remains.
Thank you,
Mark

^ permalink raw reply

* [PATCH v1 4/4] git-gui - use mkshortcut on Cygwin
From: Mark Levedahl @ 2023-06-26 16:53 UTC (permalink / raw)
  To: mdl123, git
  Cc: adam, me, johannes.schindelin, gitster, sunshine, Mark Levedahl
In-Reply-To: <20230626165305.37488-1-mlevedahl@gmail.com>

git-gui enables the "Repository->Create Desktop Icon" item on Cygwin,
offering to create a shortcut that starts git-gui on the current
repository. The code in do_cygwin_shortcut invokes function
win32_create_lnk to create the shortcut. This latter function is shared
between Cygwin and Git For Windows and expects Windows rather than unix
pathnames, though do_cygwin_shortcut provides unix pathnames. Also, this
function tries to invoke the Windows Script Host to run a javascript
snippet, but this fails under Cygwin's Tcl. So, win32_create_lnk just
does not support Cygwin.

However, Cygwin's default installation provides /bin/mkshortcut for
creating desktop shortcuts. This is compatible with exec under Cygwin's
Tcl, understands Cygwin's unix pathnames, and avoids the need for shell
escapes to encode troublesome paths. So, teach git-gui to use mkshortcut
on Cygwin, leaving win32_create_lnk unchanged and for exclusive use by
Git For Windows.

Notes: "CHERE_INVOKING=1" is recognized by Cygwin's /etc/profile and
prevents a "chdir $HOME", leaving the shell in the working directory
specified by the shortcut. That directory is written directly by
mkshortcut eliminating any problems with shell escapes and quoting.

The code being replaced includes the full pathname of the git-gui
creating the shortcut, but that git-gui might not be compatible with the
git found after /etc/profile sets the path, and might have a pathname
that defies encoding using shell escapes that can survive the multiple
incompatible interpreters involved in the chain of creating and using
this shortcut.  The new code uses bare "git gui" as the command to
execute, thus using the system git to launch the system git-gui, and
avoiding both issues.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
changes since v0
 -- assumes no changes to shortcut creation code in prior patches,
    so changes in this patch are easier to review.
 -- changed to use long option names for mkshortcut, better conforming
    to practice in git-gui overall.

 lib/shortcut.tcl | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/lib/shortcut.tcl b/lib/shortcut.tcl
index 97d1d7a..674a41f 100644
--- a/lib/shortcut.tcl
+++ b/lib/shortcut.tcl
@@ -27,13 +27,10 @@ proc do_windows_shortcut {} {
 }
 
 proc do_cygwin_shortcut {} {
-	global argv0 _gitworktree
+	global argv0 _gitworktree oguilib
 
 	if {[catch {
 		set desktop [exec cygpath \
-			--windows \
-			--absolute \
-			--long-name \
 			--desktop]
 		}]} {
 			set desktop .
@@ -48,19 +45,19 @@ proc do_cygwin_shortcut {} {
 			set fn ${fn}.lnk
 		}
 		if {[catch {
-				set sh [exec cygpath \
-					--windows \
-					--absolute \
-					/bin/sh.exe]
-				set me [exec cygpath \
-					--unix \
-					--absolute \
-					$argv0]
-				win32_create_lnk $fn [list \
-					$sh -c \
-					"CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
-					] \
-					[file normalize $_gitworktree]
+				set repodir [file normalize $_gitworktree]
+				set shargs {-c \
+					"CHERE_INVOKING=1 \
+					source /etc/profile; \
+					git gui"}
+				exec /bin/mkshortcut.exe \
+					--arguments $shargs \
+					--desc "git-gui on $repodir" \
+					--icon $oguilib/git-gui.ico \
+					--name $fn \
+					--show min \
+					--workingdir $repodir \
+					/bin/sh.exe
 			} err]} {
 			error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
 		}
-- 
2.41.0.99.19


^ permalink raw reply related

* [PATCH v1 3/4] git-gui - use cygstart to browse on Cygwin
From: Mark Levedahl @ 2023-06-26 16:53 UTC (permalink / raw)
  To: mdl123, git
  Cc: adam, me, johannes.schindelin, gitster, sunshine, Mark Levedahl
In-Reply-To: <20230626165305.37488-1-mlevedahl@gmail.com>

git-gui enables the "Repository->Explore Working Copy" menu on Cygwin,
offering to open a Windows graphical file browser at the root of the
working directory. This code, shared with Git For Windows support,
depends upon use of Windows pathnames. However, git gui on Cygwin uses
unix pathnames, so this shared code will not work on Cygwin.

A base install of Cygwin provides the /bin/cygstart utility that runs
a registered Windows application based upon the file type, after
translating unix pathnames to Windows.  Adding the --explore option
guarantees that the Windows file explorer is opened, regardless of the
supplied pathname's file type and avoiding possibility of some other
action being taken.

So, teach git-gui to use cygstart --explore on Cygwin, restoring the
pre-2012 behavior of opening a Windows file explorer for browsing. This
separates the Git For Windows and Cygwin code paths. Note that
is_Windows is never true on Cygwin, and is_Cygwin is never true on Git
for Windows, though this is not obvious by examining the code for those
independent functions.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
changes since v0
 -- assumes the if/else tree being modified is untouched by prior
    patches making the changes minimal and easier to review.

 git-gui.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/git-gui.sh b/git-gui.sh
index 3f7c31e..8bc8892 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2274,7 +2274,9 @@ proc do_git_gui {} {
 
 # Get the system-specific explorer app/command.
 proc get_explorer {} {
-	if {[is_Cygwin] || [is_Windows]} {
+	if {[is_Cygwin]} {
+		set explorer "/bin/cygstart.exe --explore"
+	} elseif {[is_Windows]} {
 		set explorer "explorer.exe"
 	} elseif {[is_MacOSX]} {
 		set explorer "open"
-- 
2.41.0.99.19


^ permalink raw reply related

* [PATCH v1 2/4] git-gui - remove obsolete Cygwin specific code
From: Mark Levedahl @ 2023-06-26 16:53 UTC (permalink / raw)
  To: mdl123, git
  Cc: adam, me, johannes.schindelin, gitster, sunshine, Mark Levedahl
In-Reply-To: <20230626165305.37488-1-mlevedahl@gmail.com>

In the current git release, git-gui runs on Cygwin without enabling any
of git-gui's Cygwin specific code.  This happens as the Cygwin specific
code in git-gui was (mostly) written in 2007-2008 to work with Cygwin's
then supplied Tcl/Tk which was an incompletely ported variant of the
8.4.1 Windows Tcl/Tk code.  In March, 2012, that 8.4.1 package was
replaced with a full port based upon the upstream unix/X11 code,
since maintained up to date. The two Tcl/Tk packages are completely
incompatible, and have different signatures.

When Cygwin's Tcl/Tk signature changed in 2012, git-gui no longer
detected Cygwin, so did not enable Cygwin specific code, and the POSIX
environment provided by Cygwin since 2012 supported git-gui as a generic
unix. Thus, no-one apparently noticed the existence of incompatible
Cygwin specific code.

However, since commit c5766eae6f in the git-gui source tree
(https://github.com/prati0100/git-gui, master at a5005ded), and not yet
pulled into the git repository, the is_Cygwin function does detect
Cygwin using the unix/X11 Tcl/Tk.  The Cygwin specific code is enabled,
causing use of Windows rather than unix pathnames, and enabling
incorrect warnings about environment variables that were relevant only
to the old Tcl/Tk.  The end result is that (upstream) git-gui is now
incompatible with Cygwin.

So, delete Cygwin specific code (code protected by "if is_Cygwin") that
is not needed in any form to work with the unix/X11 Tcl/Tk.

Cygwin specific code required to enable file browsing and shortcut
creation is not addressed in this patch, does not currently work, and
invocation of those items may leave git-gui in a confused state.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
changes since v0
 -- do not touch any code fixed in patches 3/4, meaning the browsing
    and shortcut creating menu items do not work.

 git-gui.sh                | 114 ++------------------------------------
 lib/choose_repository.tcl |  27 +--------
 2 files changed, 7 insertions(+), 134 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index cb92bba..3f7c31e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -84,14 +84,7 @@ proc _which {what args} {
 	global env _search_exe _search_path
 
 	if {$_search_path eq {}} {
-		if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
-			set _search_path [split [exec cygpath \
-				--windows \
-				--path \
-				--absolute \
-				$env(PATH)] {;}]
-			set _search_exe .exe
-		} elseif {[is_Windows]} {
+		if {[is_Windows]} {
 			set gitguidir [file dirname [info script]]
 			regsub -all ";" $gitguidir "\\;" gitguidir
 			set env(PATH) "$gitguidir;$env(PATH)"
@@ -342,14 +335,7 @@ proc gitexec {args} {
 		if {[catch {set _gitexec [git --exec-path]} err]} {
 			error "Git not installed?\n\n$err"
 		}
-		if {[is_Cygwin]} {
-			set _gitexec [exec cygpath \
-				--windows \
-				--absolute \
-				$_gitexec]
-		} else {
-			set _gitexec [file normalize $_gitexec]
-		}
+		set _gitexec [file normalize $_gitexec]
 	}
 	if {$args eq {}} {
 		return $_gitexec
@@ -364,14 +350,7 @@ proc githtmldir {args} {
 			# Git not installed or option not yet supported
 			return {}
 		}
-		if {[is_Cygwin]} {
-			set _githtmldir [exec cygpath \
-				--windows \
-				--absolute \
-				$_githtmldir]
-		} else {
-			set _githtmldir [file normalize $_githtmldir]
-		}
+		set _githtmldir [file normalize $_githtmldir]
 	}
 	if {$args eq {}} {
 		return $_githtmldir
@@ -1318,9 +1297,6 @@ if {$_gitdir eq "."} {
 	set _gitdir [pwd]
 }
 
-if {![file isdirectory $_gitdir] && [is_Cygwin]} {
-	catch {set _gitdir [exec cygpath --windows $_gitdir]}
-}
 if {![file isdirectory $_gitdir]} {
 	catch {wm withdraw .}
 	error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
@@ -1332,11 +1308,7 @@ apply_config
 
 # v1.7.0 introduced --show-toplevel to return the canonical work-tree
 if {[package vcompare $_git_version 1.7.0] >= 0} {
-	if { [is_Cygwin] } {
-		catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]}
-	} else {
-		set _gitworktree [git rev-parse --show-toplevel]
-	}
+	set _gitworktree [git rev-parse --show-toplevel]
 } else {
 	# try to set work tree from environment, core.worktree or use
 	# cdup to obtain a relative path to the top of the worktree. If
@@ -1561,24 +1533,8 @@ proc rescan {after {honor_trustmtime 1}} {
 	}
 }
 
-if {[is_Cygwin]} {
-	set is_git_info_exclude {}
-	proc have_info_exclude {} {
-		global is_git_info_exclude
-
-		if {$is_git_info_exclude eq {}} {
-			if {[catch {exec test -f [gitdir info exclude]}]} {
-				set is_git_info_exclude 0
-			} else {
-				set is_git_info_exclude 1
-			}
-		}
-		return $is_git_info_exclude
-	}
-} else {
-	proc have_info_exclude {} {
-		return [file readable [gitdir info exclude]]
-	}
+proc have_info_exclude {} {
+	return [file readable [gitdir info exclude]]
 }
 
 proc rescan_stage2 {fd after} {
@@ -3112,10 +3068,6 @@ if {[is_MacOSX]} {
 set doc_path [githtmldir]
 if {$doc_path ne {}} {
 	set doc_path [file join $doc_path index.html]
-
-	if {[is_Cygwin]} {
-		set doc_path [exec cygpath --mixed $doc_path]
-	}
 }
 
 if {[file isfile $doc_path]} {
@@ -4087,60 +4039,6 @@ set file_lists($ui_workdir) [list]
 wm title . "[appname] ([reponame]) [file normalize $_gitworktree]"
 focus -force $ui_comm
 
-# -- Warn the user about environmental problems.  Cygwin's Tcl
-#    does *not* pass its env array onto any processes it spawns.
-#    This means that git processes get none of our environment.
-#
-if {[is_Cygwin]} {
-	set ignored_env 0
-	set suggest_user {}
-	set msg [mc "Possible environment issues exist.
-
-The following environment variables are probably
-going to be ignored by any Git subprocess run
-by %s:
-
-" [appname]]
-	foreach name [array names env] {
-		switch -regexp -- $name {
-		{^GIT_INDEX_FILE$} -
-		{^GIT_OBJECT_DIRECTORY$} -
-		{^GIT_ALTERNATE_OBJECT_DIRECTORIES$} -
-		{^GIT_DIFF_OPTS$} -
-		{^GIT_EXTERNAL_DIFF$} -
-		{^GIT_PAGER$} -
-		{^GIT_TRACE$} -
-		{^GIT_CONFIG$} -
-		{^GIT_(AUTHOR|COMMITTER)_DATE$} {
-			append msg " - $name\n"
-			incr ignored_env
-		}
-		{^GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)$} {
-			append msg " - $name\n"
-			incr ignored_env
-			set suggest_user $name
-		}
-		}
-	}
-	if {$ignored_env > 0} {
-		append msg [mc "
-This is due to a known issue with the
-Tcl binary distributed by Cygwin."]
-
-		if {$suggest_user ne {}} {
-			append msg [mc "
-
-A good replacement for %s
-is placing values for the user.name and
-user.email settings into your personal
-~/.gitconfig file.
-" $suggest_user]
-		}
-		warn_popup $msg
-	}
-	unset ignored_env msg suggest_user name
-}
-
 # -- Only initialize complex UI if we are going to stay running.
 #
 if {[is_enabled transport]} {
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index af1fee7..d23abed 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -174,9 +174,6 @@ constructor pick {} {
 			-foreground blue \
 			-underline 1
 		set home $::env(HOME)
-		if {[is_Cygwin]} {
-			set home [exec cygpath --windows --absolute $home]
-		}
 		set home "[file normalize $home]/"
 		set hlen [string length $home]
 		foreach p $sorted_recent {
@@ -374,18 +371,6 @@ proc _objdir {path} {
 		return $objdir
 	}
 
-	if {[is_Cygwin]} {
-		set objdir [file join $path .git objects.lnk]
-		if {[file isfile $objdir]} {
-			return [win32_read_lnk $objdir]
-		}
-
-		set objdir [file join $path objects.lnk]
-		if {[file isfile $objdir]} {
-			return [win32_read_lnk $objdir]
-		}
-	}
-
 	return {}
 }
 
@@ -623,12 +608,6 @@ method _do_clone2 {} {
 	}
 
 	set giturl $origin_url
-	if {[is_Cygwin] && [file isdirectory $giturl]} {
-		set giturl [exec cygpath --unix --absolute $giturl]
-		if {$clone_type eq {shared}} {
-			set objdir [exec cygpath --unix --absolute $objdir]
-		}
-	}
 
 	if {[file exists $local_path]} {
 		error_popup [mc "Location %s already exists." $local_path]
@@ -668,11 +647,7 @@ method _do_clone2 {} {
 				fconfigure $f_cp -translation binary -encoding binary
 				cd $objdir
 				while {[gets $f_in line] >= 0} {
-					if {[is_Cygwin]} {
-						puts $f_cp [exec cygpath --unix --absolute $line]
-					} else {
-						puts $f_cp [file normalize $line]
-					}
+					puts $f_cp [file normalize $line]
 				}
 				close $f_in
 				close $f_cp
-- 
2.41.0.99.19


^ permalink raw reply related

* [PATCH v1 0/4] Remove obsolete Cygwin support from git-gui
From: Mark Levedahl @ 2023-06-26 16:53 UTC (permalink / raw)
  To: mdl123, git
  Cc: adam, me, johannes.schindelin, gitster, sunshine, Mark Levedahl
In-Reply-To: <20230624212347.179656-1-mlevedahl@gmail.com>

=== This is an update, incorporating responses to Junio's and Eric's
comments:
  -- clarified what the "upstream" git-gui branch is
  -- Removed some changes from patch 2 as requested by Junio, reducing
     changes in patch 3 and patch 4
       All code is fixed only after applying patch 4
       Differences in patch 3 and 4 are minimimized
   -- updated comments to clarify G4w dedicated code.
   -- updated all comments to (hopefully) clarify points of confusion
===

git-gui has many snippets of code guarded by an is_Cygwin test, all of
which target a problematic hybrid Cygwin/Windows 8.4.1 Tcl/Tk removed
from the Cygwin project in March 2012. That is when Cygwin switched to a
well-supported unix/X11 Tcl/Tk package.  64-bit Cygwin was released
later so has always had the unix/X11 package.  git-gui runs as-is on
more recent Cygwin, treating it as a Linux variant, though two functions
are disabled.

The old Tcl/Tk understands Windows pathnames but has incomplete support
for unix pathnames (for instance, all pathnames output by that Tcl are
Windows, not unix). The Cygwin git executables all use unix pathnames
(though like all Cygwin executables have some capability to accept
Windows pathnames). git-gui's Cygwin specific code causes git-gui to use
Windows pathnames everywhere.  The unix/X11 Tcl/Tk requires use of unix
pathname, so none of the Cygwin specific code is compatible.

git-gui is maintained at https://github.com/prati0100/git-gui. The
git-gui in Junio's tree corresponds to commit c0698df057, behind the
current git-gui master which is a5005ded.

Fortunately, the git-gui/is_Cygwin function in Junio's tree relies upon
the old Tcl/Tk that outputs Windows pathnames.  As this fails to detect
Cygwin, git-gui treats Cygwin as a unix variant with no platform
specific code enabled and git-gui currently runs on Cygwin.

But, commit c5766eae6f on the git-gui master branch fixes is_Cygwin to
work with the new Tcl/Tk's signature (which is not that of a Windows
Tcl/Tk). Thus, Cygwin is detected, the incompatible Cygwin code is
enabled, and git-gui no longer runs on Cygwin.

Also, there is Cygwin specific code in the Makefile, intended to allow a
completely unsupported configuration with a Windows Tcl/Tk.  However,
the Makefile code mis-identifies the unix/X11 Tcl/Tk as Windows,
triggering insertion of a hardcoded Windows path to the library
directory into git-gui making it non-portable. The Cygwin git maintainer
comments this code out, but the code should be removed as it is
demonstrated to be incompatible with Cygwin and targets a configuration
Cygwin does not support.

The existing code for file browsing and creating a desktop icon is
shared with Git For Windows support, and supports only Windows
pathnames. This code does not work on Cygwin and needs replacement or
update.  The menu items for these functions are enabled by is_Cygwin, so
appear only after is_Cygwin is fixed as discussed above.

patch 1 removes the obsolete Makefile code
patch 2 removes obsolete git-gui.sh code, wrapped in is_Cygwin
     except for code fixed in patches 3 and 4
patch 3 implements Cygwin specific file browsing support
patch 4 implements Cygwin specific desktop icon support

The end result is that git-gui on Cygwin is restored to the full
capabilities existing prior to the Tcl/Tk switch in 2012. Also, the
remaining Cygwin specific code, updated in patches 3 and 4, no longer
overlaps with Git For Windows support.

Any argument for keeping the old Cygwin code must address who is going
to test and maintain that code, on what platform, and who the target
audience is. The old Tcl/Tk was only on 32-bit Cygwin and only supported
for the Insight debugger, 32-bit Cygwin is no longer supported, git-gui
is not supported on 8.4.1 Tcl/Tk, and the Windows versions targeted by
2012'ish 32-bit Cygwin are no longer supported.

Mark Levedahl (4):
  git gui Makefile - remove Cygwin modifications
  git-gui - remove obsolete Cygwin specific code
  git-gui - use cygstart to browse on Cygwin
  git-gui - use mkshortcut on Cygwin

 Makefile                  |  21 +------
 git-gui.sh                | 118 +++-----------------------------------
 lib/choose_repository.tcl |  27 +--------
 lib/shortcut.tcl          |  31 +++++-----
 4 files changed, 27 insertions(+), 170 deletions(-)

-- 
2.41.0.99.19


^ permalink raw reply

* [PATCH v1 1/4] git gui Makefile - remove Cygwin modifications
From: Mark Levedahl @ 2023-06-26 16:53 UTC (permalink / raw)
  To: mdl123, git
  Cc: adam, me, johannes.schindelin, gitster, sunshine, Mark Levedahl
In-Reply-To: <20230626165305.37488-1-mlevedahl@gmail.com>

git-gui's Makefile hardcodes the absolute Windows path of git-gui's libraries
into git-gui, destroying the ability to package git-gui on one machine and
distribute to others. The intent is to do this only if a non-Cygwin Tcl/Tk is
installed, but the test for this is wrong with the unix/X11 Tcl/Tk shipped
since 2012. Also, Cygwin does not support a non-Cygwin Tcl/Tk.

The Cygwin git maintainer disables this code, so this code is definitely
not in use in the Cygwin distribution.

The simplest fix is to just delete the Cygwin specific code,
allowing the Makefile to work out of the box on Cygwin. Do so.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 Makefile | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index a0d5a4b..3f80435 100644
--- a/Makefile
+++ b/Makefile
@@ -138,25 +138,10 @@ GITGUI_SCRIPT   := $$0
 GITGUI_RELATIVE :=
 GITGUI_MACOSXAPP :=
 
-ifeq ($(uname_O),Cygwin)
-	GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
-
-	# Is this a Cygwin Tcl/Tk binary?  If so it knows how to do
-	# POSIX path translation just like cygpath does and we must
-	# keep libdir in POSIX format so Cygwin packages of git-gui
-	# work no matter where the user installs them.
-	#
-	ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
-		gg_libdir_sed_in := $(gg_libdir)
-	else
-		gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
-	endif
-else
-	ifeq ($(exedir),$(gg_libdir))
-		GITGUI_RELATIVE := 1
-	endif
-	gg_libdir_sed_in := $(gg_libdir)
+ifeq ($(exedir),$(gg_libdir))
+	GITGUI_RELATIVE := 1
 endif
+gg_libdir_sed_in := $(gg_libdir)
 ifeq ($(uname_S),Darwin)
 	ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
 		GITGUI_MACOSXAPP := YesPlease
-- 
2.41.0.99.19


^ permalink raw reply related

* Re: Clean up stale .gitignore and .gitattribute patterns
From: Sebastian Schuberth @ 2023-06-26 16:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Git Mailing List
In-Reply-To: <xmqqo7l25ibw.fsf@gitster.g>

On Mon, Jun 26, 2023 at 5:55 PM Junio C Hamano <gitster@pobox.com> wrote:

> > PS: As a future idea, it might be good if "git mv" gives a hint about
> > updating .gitattributes if files matching .gitattributes pattern are
> > moved.
>
> Interesting.  "git mv hello.jpg hello.jpeg" would suggest updating
> a "*.jpg <list of attribute definitions>" line in the .gitattributes
> to begin with "*.jpeg"?

Yes, right. Or as a simpler variant to start with (as patterns might
match files in different directories, and not all of the matching
files might be moved), just say that a specific .gitattributes line
needs updating (or needs to be duplicated / generalized in case files
in both the old and new location match).

-- 
Sebastian Schuberth

^ permalink raw reply

* [PATCH v3 17/24] completion: complete --output
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ec2e4c9e711..a34432796bf 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1759,6 +1759,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch --no-patch --cc --combined-all-paths
 			--anchored= --compact-summary --ignore-matching-lines=
 			--irreversible-delete --line-prefix --no-stat
+			--output=
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 11/24] completion: complete --ignore-matching-lines
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2610a55487b..b4d0643b049 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1756,7 +1756,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--indent-heuristic --no-indent-heuristic
 			--textconv --no-textconv --break-rewrites
 			--patch --no-patch --cc --combined-all-paths
-			--anchored= --compact-summary
+			--anchored= --compact-summary --ignore-matching-lines=
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 21/24] completion: move --pickaxe-{all,regex} to __git_diff_common_options
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

The options --pickaxe-all and --pickaxe-regex are listed in
__git_diff_difftool_options and repeated in _git_log. Move them to
__git_diff_common_options instead, which makes them available
automatically in the completion of other commands referencing this
variable.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9de33ed05da..5b8e7b810c8 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1763,10 +1763,12 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--irreversible-delete --line-prefix --no-stat
 			--output= --output-indicator-context=
 			--output-indicator-new= --output-indicator-old=
+			--ws-error-highlight=
+			--pickaxe-all --pickaxe-regex
 "
 
 # Options for diff/difftool
-__git_diff_difftool_options="--cached --staged --pickaxe-all --pickaxe-regex
+__git_diff_difftool_options="--cached --staged
 			--base --ours --theirs --no-index --merge-base
 			--ita-invisible-in-index --ita-visible-in-index
 			$__git_diff_common_options"
@@ -2115,7 +2117,6 @@ _git_log ()
 			--expand-tabs --expand-tabs= --no-expand-tabs
 			$merge
 			$__git_diff_common_options
-			--pickaxe-all --pickaxe-regex
 			"
 		return
 		;;
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 24/24] diff.c: mention completion above add_diff_options
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Add a comment on top of add_diff_options, where common diff options are
listed, mentioning __git_diff_common_options in the completion script,
in the hope that contributors update it when they add new diff flags.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 diff.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/diff.c b/diff.c
index 3c88c37908d..64c93c0f0e2 100644
--- a/diff.c
+++ b/diff.c
@@ -5491,6 +5491,10 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int uns
 	return 0;
 }
 
+/*
+ * Consider adding new flags to __git_diff_common_options
+ * in contrib/completion/git-completion.bash
+ */
 struct option *add_diff_options(const struct option *opts,
 				struct diff_options *options)
 {
-- 
gitgitgadget

^ permalink raw reply related

* [PATCH v3 23/24] completion: complete --remerge-diff
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

--remerge-diff only makes sense for 'git log' and 'git show', so add it
to __git_log_show_options which is referenced in the completion for
these two commands.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8688f7c433c..11f2edf47be 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2042,7 +2042,7 @@ __git_log_shortlog_options="
 "
 # Options accepted by log and show
 __git_log_show_options="
-	--diff-merges --diff-merges= --no-diff-merges
+	--diff-merges --diff-merges= --no-diff-merges --remerge-diff
 "
 
 __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 22/24] completion: complete --diff-merges, its options and --no-diff-merges
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

The flags --[no-]diff-merges only make sense for 'git log' and 'git
show', so add a new variable __git_log_show_options for options only
relevant to these two commands, and add them there. Also add
__git_diff_merges_opts and list the accepted values for --diff-merges,
and use it in _git_log and _git_show.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 5b8e7b810c8..8688f7c433c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2040,6 +2040,12 @@ __git_log_shortlog_options="
 	--author= --committer= --grep=
 	--all-match --invert-grep
 "
+# Options accepted by log and show
+__git_log_show_options="
+	--diff-merges --diff-merges= --no-diff-merges
+"
+
+__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
 
 __git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd"
 __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:"
@@ -2096,11 +2102,16 @@ _git_log ()
 		__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
 		return
 		;;
+	--diff-merges=*)
+                __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
+                return
+                ;;
 	--*)
 		__gitcomp "
 			$__git_log_common_options
 			$__git_log_shortlog_options
 			$__git_log_gitk_options
+			$__git_log_show_options
 			--root --topo-order --date-order --reverse
 			--follow --full-diff
 			--abbrev-commit --no-abbrev-commit --abbrev=
@@ -3015,10 +3026,15 @@ _git_show ()
 		__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
 		return
 		;;
+	--diff-merges=*)
+                __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}"
+                return
+                ;;
 	--*)
 		__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
 			--oneline --show-signature
 			--expand-tabs --expand-tabs= --no-expand-tabs
+			$__git_log_show_options
 			$__git_diff_common_options
 			"
 		return
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 20/24] completion: complete --ws-error-highlight
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Add --ws-error-highlight= to the list in __git_diff_common_options, and
add the accepted values in a new list __git_ws_error_highlight_opts.

Use __git_ws_error_highlight_opts in _git_diff, _git_log and _git_show
to offer the accepted values.

As noted in fd0bc17557 (completion: add diff --color-moved[-ws],
2020-02-21), there is no easy way to offer completion for several
comma-separated values, so this is limited to completing a single
value.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7babd95d844..9de33ed05da 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1733,6 +1733,8 @@ __git_color_moved_opts="no default plain blocks zebra dimmed-zebra"
 __git_color_moved_ws_opts="no ignore-space-at-eol ignore-space-change
 			ignore-all-space allow-indentation-change"
 
+__git_ws_error_highlight_opts="context old new all default"
+
 # Options for the diff machinery (diff, log, show, stash, range-diff, ...)
 __git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch-with-stat --name-only --name-status --color
@@ -1790,6 +1792,10 @@ _git_diff ()
 		__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
 		return
 		;;
+	--ws-error-highlight=*)
+		__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
+		return
+		;;
 	--*)
 		__gitcomp "$__git_diff_difftool_options"
 		return
@@ -2080,6 +2086,10 @@ _git_log ()
 		__gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
 		return
 		;;
+	--ws-error-highlight=*)
+		__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
+		return
+		;;
 	--no-walk=*)
 		__gitcomp "sorted unsorted" "" "${cur##--no-walk=}"
 		return
@@ -3000,6 +3010,10 @@ _git_show ()
 		__gitcomp "$__git_color_moved_ws_opts" "" "${cur##--color-moved-ws=}"
 		return
 		;;
+	--ws-error-highlight=*)
+		__gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}"
+		return
+		;;
 	--*)
 		__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
 			--oneline --show-signature
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 04/24] completion: complete --combined-all-paths
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b61c54e37f7..58ce64de9e2 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--submodule --submodule= --ignore-submodules
 			--indent-heuristic --no-indent-heuristic
 			--textconv --no-textconv --break-rewrites
-			--patch --no-patch --cc
+			--patch --no-patch --cc --combined-all-paths
 			--anchored=
 "
 
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 03/24] completion: complete --cc
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f07b00b9c68..b61c54e37f7 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1754,7 +1754,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--submodule --submodule= --ignore-submodules
 			--indent-heuristic --no-indent-heuristic
 			--textconv --no-textconv --break-rewrites
-			--patch --no-patch
+			--patch --no-patch --cc
 			--anchored=
 "
 
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 18/24] completion: complete --output-indicator-{context,new,old}
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a34432796bf..a69421cd740 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1759,7 +1759,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch --no-patch --cc --combined-all-paths
 			--anchored= --compact-summary --ignore-matching-lines=
 			--irreversible-delete --line-prefix --no-stat
-			--output=
+			--output= --output-indicator-context=
+			--output-indicator-new= --output-indicator-old=
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 06/24] completion: complete --default-prefix
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4c43d13eef4..6af04932a0a 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1750,7 +1750,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--raw --word-diff --word-diff-regex=
 			--dirstat --dirstat= --dirstat-by-file
 			--dirstat-by-file= --cumulative
-			--diff-algorithm=
+			--diff-algorithm= --default-prefix
 			--submodule --submodule= --ignore-submodules
 			--indent-heuristic --no-indent-heuristic
 			--textconv --no-textconv --break-rewrites
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 12/24] completion: complete --irreversible-delete
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b4d0643b049..e74636ebe86 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1757,6 +1757,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--textconv --no-textconv --break-rewrites
 			--patch --no-patch --cc --combined-all-paths
 			--anchored= --compact-summary --ignore-matching-lines=
+			--irreversible-delete
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


^ permalink raw reply related

* [PATCH v3 16/24] completion: complete --no-stat
From: Philippe Blain via GitGitGadget @ 2023-06-26 16:24 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine, Philippe Blain, Philippe Blain
In-Reply-To: <pull.1543.v3.git.1687796688.gitgitgadget@gmail.com>

From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f4e773cb997..ec2e4c9e711 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1758,7 +1758,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--textconv --no-textconv --break-rewrites
 			--patch --no-patch --cc --combined-all-paths
 			--anchored= --compact-summary --ignore-matching-lines=
-			--irreversible-delete --line-prefix
+			--irreversible-delete --line-prefix --no-stat
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox