From f54c2a2bac7931fd72e629a56bfad0e6869d0251 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 1 Oct 2021 15:49:12 -0400 Subject: [PATCH] move_mrs: Disable our commit hook during the move As GNU indent version can be different on the user system, we see some differences during migration thas causes conflicts. Making cherry-pick difficults to recover without breaking the style temporily. Note that cherry-pick continuation does not allow passing the -n option to skip the hooks. Part-of: --- scripts/git-hooks/multi-pre-commit.hook | 6 ++++++ scripts/move_mrs_to_monorepo.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/scripts/git-hooks/multi-pre-commit.hook b/scripts/git-hooks/multi-pre-commit.hook index a77d0da21f..a5ccf1fd27 100755 --- a/scripts/git-hooks/multi-pre-commit.hook +++ b/scripts/git-hooks/multi-pre-commit.hook @@ -20,6 +20,12 @@ HOOKS="scripts/git-hooks/pre-commit.hook scripts/git-hooks/pre-commit-python.hoo # exit on error set -e +if [ "$GST_DISABLE_PRE_COMMIT_HOOKS" = "1" ] +then + echo "Pre-commits hooks disabled by env GST_DISABLE_PRE_COMMIT_HOOKS." + exit 0 +fi + echo $PWD for hook in $HOOKS diff --git a/scripts/move_mrs_to_monorepo.py b/scripts/move_mrs_to_monorepo.py index bd1ed8e631..379f672a85 100755 --- a/scripts/move_mrs_to_monorepo.py +++ b/scripts/move_mrs_to_monorepo.py @@ -334,6 +334,11 @@ class GstMRMover: self.gl = self.connect() self.gl.auth() + # Skip pre-commit hooks when migrating. Some users may have a + # different version of gnu indent and that can lead to cherry-pick + # failing. + os.environ["GST_DISABLE_PRE_COMMIT_HOOKS"] = "1" + try: prevbranch = self.git( "rev-parse", "--abbrev-ref", "HEAD", can_fail=True).strip()