Comments (3)
Sketch of the functional change I am proposing:
diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c
index 28186b30f548..35ab7f34ca15 100644
--- a/builtin/for-each-repo.c
+++ b/builtin/for-each-repo.c
@@ -32,6 +32,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
{
static const char *config_key = NULL;
+ int stop_on_error = 0;
int i, result = 0;
const struct string_list *values;
int err;
@@ -39,6 +40,8 @@ int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
const struct option options[] = {
OPT_STRING(0, "config", &config_key, N_("config"),
N_("config key storing a list of repository paths")),
+ OPT_BOOL(0, "stop-on-error", &stop_on_error,
+ N_("stop at the first repository where the operation failed")),
OPT_END()
};
@@ -55,8 +58,9 @@ int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
else if (err)
return 0;
- for (i = 0; !result && i < values->nr; i++)
- result = run_command_on_repo(values->items[i].string, argc, argv);
+ for (i = 0; (!stop_on_error || !result) && i < values->nr; i++)
+ if (run_command_on_repo(values->items[i].string, argc, argv))
+ result = 1;
return result;
}
from git.
The first non-existent repo stopped the loop.
This is indeed the case 😞:
https://github.com/git/git/blob/v2.43.0/builtin/for-each-repo.c#L58-L59
It would probably make sense to retain the ability to stop on the first failure, but make that an option, by default continuing (but of course still exiting with an error if the operation failed in at least one repository).
from git.
Sketch of the functional change I am proposing:
That would be the backwards-compatible fix. The other approach would be to change behavior by attempting all repos and returning success only if every repo succeeded. But Git doesn't typically do backwards-incompatible things. Who knows who depends on this early termination behavior?
Please also update the background maintenance schedule to include --stop-on-error
on its use of for-each-repo
to auto-heal users when they reconfigure background maintenance.
from git.
Related Issues (20)
- git-maintenance doesn't work with git-credential-manager & pass HOT 4
- Steps when a scalar repo becomes corrupted
- Broken link in README
- git commit take a long time
- microsoft-git version 2.44.0.vfs.0.1 is broken on Mac HOT 4
- microsoft/git: review use of homebrew libintl.a
- winget deployment error (as of v2.44.0.vfs.0.2) HOT 4
- Release for v2.44.0.vfs.0.3 ? Patch for sparse-checkout crashes HOT 3
- Some scalar clones are putting GVFS packs in local object dir instead of shared object dir HOT 6
- Git reset --mixed HEAD~1 does not leave modified files in working tree
- update-git-for-windows seems to be broken on 2.45.2.vfs.0.0 HOT 10
- `git update-git-for-windows` fails with curl error in v2.45.2.vfs.0.0 HOT 1
- git difftool with visual editor takes 4.5 seconds to open next file HOT 1
- status: Hydration percentage not printed when gvfs status cache is used HOT 2
- Scalar/GVFS not working on latest MacOS (Sequoia) HOT 7
- WSL: Ubuntu 20.04: Broken install for git 2.45.2.vfs.0.2 - missing libc dependency on clean install HOT 6
- v2.45.2.vfs.0.2: performance regression in pathspec checkouts HOT 1
- multi-pack-index expiration ineffective due to many pack-files keeping small object counts HOT 4
- Git reset --mixed HEAD~1 still losing track of some files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git.