@@ -406,7 +406,18 @@ def __post_init__(self) -> None:
406406 default_branch = repo ["default_branch" ]
407407
408408 object .__setattr__ (self , "base" , default_branch )
409- object .__setattr__ (self , "direct" , bool (self .direct_opt ))
409+
410+ # Check if direct should be used, if the user didn't explicitly
411+ # specify an option
412+ direct = self .direct_opt
413+ if direct is None :
414+ direct_r = self .sh .git (
415+ "cat-file" , "-e" , "HEAD:.github/ghstack_direct" , exitcode = True
416+ )
417+ assert isinstance (direct_r , bool )
418+ direct = direct_r
419+
420+ object .__setattr__ (self , "direct" , direct )
410421
411422 # ~~~~~~~~~~~~~~~~~~~~~~~~
412423 # The main algorithm
@@ -667,7 +678,6 @@ def prepare_updates(
667678 commits_to_submit : List [ghstack .git .CommitHeader ],
668679 commits_to_rebase : List [ghstack .git .CommitHeader ],
669680 ) -> Tuple [Dict [GitCommitHash , DiffMeta ], Dict [GitCommitHash , GitCommitHash ]]:
670-
671681 # Prepare diffs in reverse topological order.
672682 # (Reverse here is important because we must have processed parents
673683 # first.)
0 commit comments