diff mbox series

Allow '.git' to be a file for worktrees

Message ID 20210621204335.1627303-1-robh@kernel.org (mailing list archive)
State New, archived
Headers show
Series Allow '.git' to be a file for worktrees | expand

Commit Message

Rob Herring June 21, 2021, 8:43 p.m. UTC
With multiple git worktrees, '.git' can be a file pointing to the real
'.git' directory, so the current check for a directory is too strict.

Signed-off-by: Rob Herring <robh@kernel.org>
---
Turns out I had 2 issues and didn't notice you fixed the first one when 
I rebased. With the first one fixed, it's the same issue with worktrees 
I recently fixed in the kernel.

 b4/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Konstantin Ryabitsev June 22, 2021, 7:15 p.m. UTC | #1
On Mon, 21 Jun 2021 14:43:35 -0600, Rob Herring wrote:
> With multiple git worktrees, '.git' can be a file pointing to the real
> '.git' directory, so the current check for a directory is too strict.

Applied, thanks!

[1/1] Allow '.git' to be a file for worktrees
      commit: c0dd194bdd9318107d187878a7a3b21c6eaf9b3b

Best regards,
diff mbox series

Patch

diff --git a/b4/__init__.py b/b4/__init__.py
index 53eaf2757e2a..2bb789e2eaf9 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1834,7 +1834,7 @@  def git_run_command(gitdir: Optional[str], args: List[str], stdin: Optional[byte
                     logstderr: bool = False) -> Tuple[int, str]:
     cmdargs = ['git', '--no-pager']
     if gitdir:
-        if os.path.isdir(os.path.join(gitdir, '.git')):
+        if os.path.exists(os.path.join(gitdir, '.git')):
             gitdir = os.path.join(gitdir, '.git')
         cmdargs += ['--git-dir', gitdir]
     cmdargs += args