Repository: VirtusLab/git-machete
Pull request #1441 (2025-05-21 12:34:05)

Release v3.35.1


Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 9a23928..a87dd3f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -39,26 +39,13 @@ jobs:
           command: |
             set -x
             python --version
-
             pip3 install tox
 
-            # For completion tests
-
-            # `add-apt-repository` was getting stuck on CI for some reason
-            echo 'deb     https://ppa.launchpadcontent.net/fish-shell/release-3/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list
-            echo 'deb-src https://ppa.launchpadcontent.net/fish-shell/release-3/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list
-            sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 59FDA1CE1B84B3FAD89366C027557F056DC33CA5
-            sudo apt-get update
-            sudo apt-get install fish
-            fish --version
-
-            sudo apt-get install zsh
-
             # For enforce-shell-scripts-pass-shellcheck.sh
             sudo apt-get install shellcheck
 
             # For enforce-links-correct.sh
-            npm install --global remark-cli remark-lint-no-dead-urls remark-validate-links
+            npm install --global remark-cli remark-validate-links
       - run:
           name: Perform general checks
           command: ci/checks/run-all-checks.sh
@@ -71,6 +58,28 @@ jobs:
       - store_artifacts:
           path: docs/html/
           destination: docs
+
+  "completion tests":
+    executor: ubuntu_executor
+    steps:
+      - checkout
+      - run:
+          name: Install dependencies
+          # language=sh
+          command: |
+            set -x
+            python --version
+            pip3 install tox
+
+            # `add-apt-repository` was getting stuck on CI for some reason
+            echo 'deb     https://ppa.launchpadcontent.net/fish-shell/release-3/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list
+            echo 'deb-src https://ppa.launchpadcontent.net/fish-shell/release-3/ubuntu jammy main' | sudo tee -a /etc/apt/sources.list
+            sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 59FDA1CE1B84B3FAD89366C027557F056DC33CA5
+            sudo apt-get update
+            sudo apt-get install fish
+            fish --version
+
+            sudo apt-get install zsh
       - run:
           name: Test shell completions
           command: tox -e test-completions -- -vv
@@ -283,6 +292,7 @@ jobs:
 # they're just to introduce reusable anchors to be referenced further down the line.
 test_jobs: &test_jobs
   - general checks
+  - completion tests
   - python 3_6 git 1_8_0
   - python 3_7 git 2_7_6
   - python 3_8 git 2_25_0
@@ -312,6 +322,7 @@ workflows:
   build:
     jobs:
       - general checks
+      - completion tests
       - python 3_6 git 1_8_0
       - python 3_7 git 2_7_6
       - python 3_8 git 2_25_0
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 7c97e68..bc1abda 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,9 @@
 # Release notes
 
+## New in git-machete 3.35.1
+
+- fixed: `git machete git{hub,lab} update-{pr,mr}-descriptions --related` could not update the current PR/MR in default intro style
+
 ## New in git-machete 3.35.0
 
 - added: `git machete traverse --sync-github-prs`/`--sync-gitlab-mrs` suggests creating PRs/MRs for branches without one (suggested by @bradneuman and @tir38)
diff --git a/ci/checks/enforce-links-correct.sh b/ci/checks/enforce-links-correct.sh
index 9d135a2..32eba4c 100755
--- a/ci/checks/enforce-links-correct.sh
+++ b/ci/checks/enforce-links-correct.sh
@@ -3,6 +3,3 @@
 set -e -o pipefail -u
 
 remark . --ignore-path=.gitignore --use=remark-validate-links --frail
-# The check for dead URLs has a relatively low importance, and turned out to be very flaky.
-# Let's make it non-blocking.
-remark . --ignore-path=.gitignore --use=remark-lint-no-dead-urls
diff --git a/ci/checks/run-all-checks.sh b/ci/checks/run-all-checks.sh
index 25ba6da..5efb188 100755
--- a/ci/checks/run-all-checks.sh
+++ b/ci/checks/run-all-checks.sh
@@ -16,10 +16,10 @@ enforce-consistent-style-for-gitlab.sh
 enforce-correct-shebangs.sh
 enforce-indent-two-spaces-outside-python.sh
 enforce-issue-number-for-todos.sh
-if [[ $0 != *.git/hooks/pre-commit ]]; then
-  # This one needs to connect to the linked websites and can potentially run long,
-  # let's skip it when this script is executed as git pre-commit hook.
+if [[ $CI ]] || command -v remark; then
   enforce-links-correct.sh
+else
+  echo 'Warning: remark CLI not installed, link check will be skipped. Use `npm install remark-cli remark-validate-links`'
 fi
 enforce-mocking-only-whitelisted-methods.sh
 enforce-newline-at-eof.sh
diff --git a/ci/tox/build-context/requirements.txt b/ci/tox/build-context/requirements.txt
index a31a961..f2d1b67 100644
--- a/ci/tox/build-context/requirements.txt
+++ b/ci/tox/build-context/requirements.txt
@@ -5,8 +5,9 @@ build==1.2.2.post1; python_version >= '3.8'
 setuptools==59.6.0; python_version <= '3.6'
 setuptools==68.0.0; python_version >= '3.7' and python_version < '3.8'
 setuptools==75.3.0; python_version >= '3.8' and python_version < '3.9'
-setuptools==80.4.0; python_version >= '3.9'
+setuptools==80.7.1; python_version >= '3.9'
 
 tox==3.28.0; python_version <= '3.6'
 tox==4.8.0; python_version >= '3.7' and python_version < '3.8'
-tox==4.25.0; python_version >= '3.8'
+tox==4.25.0; python_version >= '3.8' and python_version < '3.9'
+tox==4.26.0; python_version >= '3.9'
diff --git a/docs/man/git-machete.1 b/docs/man/git-machete.1
index fab6fe4..578b7f1 100644
--- a/docs/man/git-machete.1
+++ b/docs/man/git-machete.1
@@ -27,9 +27,9 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
 ..
-.TH "GIT-MACHETE" "1" "May 13, 2025" "" "git-machete"
+.TH "GIT-MACHETE" "1" "May 19, 2025" "" "git-machete"
 .SH NAME
-git-machete \- git-machete 3.35.0
+git-machete \- git-machete 3.35.1
 .sp
 git machete is a robust tool that \fBsimplifies your git workflows\fP\&.
 .sp
diff --git a/git_machete/__init__.py b/git_machete/__init__.py
index 7637d8d..b0ddbd1 100644
--- a/git_machete/__init__.py
+++ b/git_machete/__init__.py
@@ -1,1 +1,1 @@
-__version__ = '3.35.0'
+__version__ = '3.35.1'
diff --git a/git_machete/client/with_code_hosting.py b/git_machete/client/with_code_hosting.py
index b02d4ef..9ca114c 100644
--- a/git_machete/client/with_code_hosting.py
+++ b/git_machete/client/with_code_hosting.py
@@ -762,6 +762,7 @@ class MacheteClientWithCodeHosting(MacheteClient):
             related_to = None
         applicable_prs: List[PullRequest] = self._get_applicable_pull_requests(
             all=all, by=current_user if mine else by, related_to=related_to)
+        debug("applicable PRs: " + ", ".join(pr.display_text() for pr in applicable_prs))
 
         for pr in applicable_prs:
             new_description = self._get_updated_pull_request_description(pr)
@@ -935,9 +936,10 @@ class MacheteClientWithCodeHosting(MacheteClient):
             return result
         elif related_to:
             style = self.__get_pr_description_into_style_from_config()
-            result = []
             if style in (PRDescriptionIntroStyle.FULL, PRDescriptionIntroStyle.FULL_NO_BRANCHES):
-                result += reversed(self.__get_upwards_path_including_pr(related_to))
+                result = list(reversed(self.__get_upwards_path_including_pr(related_to)))
+            else:
+                result = [related_to]
             result += [pr_ for pr_, _ in self.__get_downwards_tree_excluding_pr(related_to)]
             return result
 
diff --git a/git_machete/utils.py b/git_machete/utils.py
index 7119dee..5eb65cf 100644
--- a/git_machete/utils.py
+++ b/git_machete/utils.py
@@ -4,6 +4,7 @@ import os
 import re
 import subprocess
 import sys
+import textwrap
 import time
 from typing import (Any, Callable, Dict, Iterable, List, NamedTuple, Optional,
                     Set, Tuple, TypeVar)
@@ -113,16 +114,18 @@ def debug(msg: str) -> None:
         function_name = bold(inspect.stack()[1].function)
         args, _, _, values_original = inspect.getargvalues(inspect.stack()[1].frame)
         # Do not write over the original values!
-        # Since Python 3.13, this keeps a map of local variables that the code actually sees,
-        # so overwriting a key in values_original actually changes the local variable.
-        values = dict(values_original)
+        # Since Python 3.13, the result of `getargvalues` keeps a map of local variables
+        # that the Python runtime actually keeps on the stack,
+        # so overwriting a key in values_original changes the local variable.
+        values: Dict[str, Any] = dict(values_original)
 
         args_to_be_redacted = {'access_token', 'password', 'secret', 'token'}
         for arg, value in values.items():
             if arg in args_to_be_redacted or any(value_ in str(value) for value_ in CODE_HOSTING_TOKEN_PREFIXES):
                 values[arg] = '***'
-            if type(values[arg]) is dict:
-                values[arg] = compact_dict(values[arg])
+            elif type(value) is dict:
+                values[arg] = compact_dict(value)
+            values[arg] = textwrap.shorten(str(values[arg]), width=50, placeholder="...")
 
         args_and_values_list = [arg + '=' + str(values[arg]) for arg in excluding(args, {'self'})]
         args_and_values_str = ', '.join(args_and_values_list)
diff --git a/requirements/pypi-publish.txt b/requirements/pypi-publish.txt
index 3ee7cc7..03f4e3b 100644
--- a/requirements/pypi-publish.txt
+++ b/requirements/pypi-publish.txt
@@ -1,4 +1,4 @@
 build==1.2.2.post1
-setuptools==80.4.0
+setuptools==80.7.1
 twine==6.1.0
 wheel==0.45.1


Test patch:
diff --git a/tests/test_github_update_pr_descriptions.py b/tests/test_github_update_pr_descriptions.py
index 9c2a6f9..b012fdb 100644
--- a/tests/test_github_update_pr_descriptions.py
+++ b/tests/test_github_update_pr_descriptions.py
@@ -119,6 +119,7 @@ class TestGitHubUpdatePRDescriptions(BaseTest):
             """
         )
 
+        check_out('chore/redundant_checks')
         assert_success(
             ['github', 'update-pr-descriptions', '--related'],
             """