Git development
 help / color / mirror / Atom feed
* [PATCH] push: add push.showProgress config option
@ 2026-04-23 12:30 Harald Nordgren via GitGitGadget
  0 siblings, 0 replies; only message in thread
From: Harald Nordgren via GitGitGadget @ 2026-04-23 12:30 UTC (permalink / raw)
  To: git; +Cc: Harald Nordgren, Harald Nordgren

From: Harald Nordgren <haraldnordgren@gmail.com>

Add a `push.showProgress` boolean config that sets the default for
progress reporting during `git push`. Setting it to `false` suppresses
the pack-objects progress output (Enumerating/Counting/Compressing/
Writing objects) without silencing the ref update summary line the
way `--quiet` does. An explicit `--progress` or `--no-progress` on the
command line still overrides the config.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
    push: add showProgress config option
    
    The amount of output shown for each push is excessive in my opinion.
    
    It can be silenced by '-q', but this has the bad side-effect that the
    success message is not shown. '--no-progress' exists, so would make
    sense to allow this to be always be turned on.
    
    Enumerating objects: 17, done.
    Counting objects: 100% (17/17), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (9/9), done.
    Writing objects: 100% (9/9), 1.32 KiB | 1.32 MiB/s, done.
    Total 9 (delta 8), reused 0 (delta 0), pack-reused 0 (from 0)
    remote: Resolving deltas: 100% (8/8), completed with 8 local objects.
    To github.com:HaraldNordgren/git.git
     + 3b9fc3aac6...6d326b0098 push-use-progress-config -> push-use-progress-config (forced update)
    

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2279%2FHaraldNordgren%2Fpush-use-progress-config-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2279/HaraldNordgren/push-use-progress-config-v1
Pull-Request: https://github.com/git/git/pull/2279

 Documentation/config/push.adoc |  8 ++++++++
 builtin/push.c                 |  3 +++
 t/t5523-push-upstream.sh       | 23 +++++++++++++++++++++++
 3 files changed, 34 insertions(+)

diff --git a/Documentation/config/push.adoc b/Documentation/config/push.adoc
index d9112b2260..92f22c8ec3 100644
--- a/Documentation/config/push.adoc
+++ b/Documentation/config/push.adoc
@@ -137,3 +137,11 @@ This will result in only b (a and c are cleared).
 	If set to `false`, disable use of bitmaps for `git push` even if
 	`pack.useBitmaps` is `true`, without preventing other git operations
 	from using bitmaps. Default is `true`.
+
+`push.showProgress`::
+	If set to `false`, suppress progress reporting during `git push`,
+	equivalent to passing `--no-progress` on the command line. If set
+	to `true`, force progress reporting, equivalent to `--progress`.
+	If unset, progress is reported when standard error is connected to
+	a terminal. An explicit `--progress` or `--no-progress` on the
+	command line overrides this configuration.
diff --git a/builtin/push.c b/builtin/push.c
index 7100ffba5d..d35f816740 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -539,6 +539,9 @@ static int git_push_config(const char *k, const char *v,
 		else
 			*flags &= ~TRANSPORT_PUSH_FORCE_IF_INCLUDES;
 		return 0;
+	} else if (!strcmp(k, "push.showprogress")) {
+		progress = git_config_bool(k, v);
+		return 0;
 	}
 
 	return git_default_config(k, v, ctx, NULL);
diff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh
index 22d3e1162c..27aa87ee01 100755
--- a/t/t5523-push-upstream.sh
+++ b/t/t5523-push-upstream.sh
@@ -120,6 +120,29 @@ test_expect_success TTY 'push --no-progress suppresses progress' '
 	test_grep ! "Writing objects" err
 '
 
+test_expect_success TTY 'push.showProgress=false suppresses progress' '
+	ensure_fresh_upstream &&
+
+	test_terminal git -c push.showProgress=false push -u upstream main \
+		>out 2>err &&
+	test_grep ! "Writing objects" err
+'
+
+test_expect_success 'push.showProgress=true forces progress on non-tty' '
+	ensure_fresh_upstream &&
+
+	git -c push.showProgress=true push -u upstream main >out 2>err &&
+	test_grep "Writing objects" err
+'
+
+test_expect_success TTY '--progress overrides push.showProgress=false' '
+	ensure_fresh_upstream &&
+
+	test_terminal git -c push.showProgress=false push -u --progress \
+		upstream main >out 2>err &&
+	test_grep "Writing objects" err
+'
+
 test_expect_success TTY 'quiet push' '
 	ensure_fresh_upstream &&
 

base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-23 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 12:30 [PATCH] push: add push.showProgress config option Harald Nordgren via GitGitGadget

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