All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] core.abbrev <off|false|no> disables abbreviations
@ 2020-09-01  7:43 Eric Wong
  2020-09-01 12:14 ` Derrick Stolee
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Wong @ 2020-09-01  7:43 UTC (permalink / raw)
  To: git; +Cc: brian m. carlson

These allows users to write hash-agnostic scripts and configs to
disable abbreviations.  Using "-c core.abbrev=40" will be
insufficient with SHA-256, and "-c core.abbrev=64" won't work
with SHA-1 repos today.

Signed-off-by: Eric Wong <e@80x24.org>
---
  I kinda wanted to allow a value of "max", but I figured the existing
  boolean falsiness words might make more sense with `--no-abbrev' in
  for some commands...  Naming is hard :x

 config.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/config.c b/config.c
index 2bdff4457b..f2e09c72ca 100644
--- a/config.c
+++ b/config.c
@@ -1217,6 +1217,10 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
 			return config_error_nonbool(var);
 		if (!strcasecmp(value, "auto"))
 			default_abbrev = -1;
+		else if (!strcasecmp(value, "false") ||
+			 !strcasecmp(value, "no") ||
+			 !strcasecmp(value, "off"))
+			default_abbrev = the_hash_algo->hexsz;
 		else {
 			int abbrev = git_config_int(var, value);
 			if (abbrev < minimum_abbrev || abbrev > the_hash_algo->hexsz)

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-12-23 20:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01  7:43 [PATCH] core.abbrev <off|false|no> disables abbreviations Eric Wong
2020-09-01 12:14 ` Derrick Stolee
2020-09-01 14:43   ` Eric Wong
2020-09-01 14:59     ` Derrick Stolee
2020-12-22 19:42     ` Junio C Hamano
2020-12-22 23:17       ` Eric Wong
2020-12-22 23:24         ` Junio C Hamano
2020-12-23  0:10           ` Junio C Hamano
2020-12-23 14:38             ` Derrick Stolee
2020-12-23 20:21             ` brian m. carlson
2020-09-01 15:49   ` Junio C Hamano
2020-09-01 19:14     ` Junio C Hamano
2020-09-01 23:37     ` brian m. carlson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.