From 76d2812076fb21c82b4c96198158fce7b309d457 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 10 Aug 2024 16:29:17 -0400 Subject: [PATCH 1/2] Update [ghstack-poisoned] --- .github/ghstack_direct | 0 ghstack/submit.py | 9 ++++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .github/ghstack_direct diff --git a/.github/ghstack_direct b/.github/ghstack_direct new file mode 100644 index 0000000..e69de29 diff --git a/ghstack/submit.py b/ghstack/submit.py index 806c7a8..d26207d 100644 --- a/ghstack/submit.py +++ b/ghstack/submit.py @@ -406,7 +406,14 @@ def __post_init__(self) -> None: default_branch = repo["default_branch"] object.__setattr__(self, "base", default_branch) - object.__setattr__(self, "direct", bool(self.direct_opt)) + + # Check if direct should be used, if the user didn't explicitly + # specify an option + direct = self.direct_opt + if direct is None: + direct = self.sh.git("cat-file", "-e", "HEAD:.github/ghstack_direct", exitcode=True) + + object.__setattr__(self, "direct", direct) # ~~~~~~~~~~~~~~~~~~~~~~~~ # The main algorithm From 2431761306355d3e54b28451d13f080db3cce30d Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 12 Aug 2024 16:42:04 -0400 Subject: [PATCH 2/2] Update [ghstack-poisoned] --- ghstack/submit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghstack/submit.py b/ghstack/submit.py index d26207d..59b8835 100644 --- a/ghstack/submit.py +++ b/ghstack/submit.py @@ -411,7 +411,11 @@ def __post_init__(self) -> None: # specify an option direct = self.direct_opt if direct is None: - direct = self.sh.git("cat-file", "-e", "HEAD:.github/ghstack_direct", exitcode=True) + direct_r = self.sh.git( + "cat-file", "-e", "HEAD:.github/ghstack_direct", exitcode=True + ) + assert isinstance(direct_r, bool) + direct = direct_r object.__setattr__(self, "direct", direct) @@ -674,7 +678,6 @@ def prepare_updates( commits_to_submit: List[ghstack.git.CommitHeader], commits_to_rebase: List[ghstack.git.CommitHeader], ) -> Tuple[Dict[GitCommitHash, DiffMeta], Dict[GitCommitHash, GitCommitHash]]: - # Prepare diffs in reverse topological order. # (Reverse here is important because we must have processed parents # first.)