Skip to content

Commit

Permalink
Check .github/ghstack_direct to decide if using direct by default (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezyang authored Aug 13, 2024
1 parent 600e9c8 commit a53b4fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Empty file added .github/ghstack_direct
Empty file.
14 changes: 12 additions & 2 deletions ghstack/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,18 @@ 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_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)

# ~~~~~~~~~~~~~~~~~~~~~~~~
# The main algorithm
Expand Down Expand Up @@ -667,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.)
Expand Down

0 comments on commit a53b4fe

Please sign in to comment.