public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
From: Dave Marquardt <davemarq@linux.ibm.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: "Kernel.org Tools" <tools@kernel.org>
Subject: Re: [PATCH RESEND v2] Make edit_in_editor use temporary file in Git repository
Date: Tue, 24 Feb 2026 15:59:51 -0600	[thread overview]
Message-ID: <87zf4x246g.fsf@linux.ibm.com> (raw)
In-Reply-To: <177196128601.4027376.7838697675997419538@lemur> (Konstantin Ryabitsev's message of "Tue, 24 Feb 2026 14:28:06 -0500")

Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:

> On Tue, 18 Nov 2025 15:34:25 -0600, Dave Marquardt <davemarq@linux.ibm.com> wrote:
>> diff --git a/src/b4/__init__.py b/src/b4/__init__.py
>> index 7689550..cc7623a 100644
>> --- a/src/b4/__init__.py
>> +++ b/src/b4/__init__.py
>> @@ -4575,8 +4575,16 @@ def edit_in_editor(bdata: bytes, filehint: str = 'COMMIT_EDITMSG') -> bytes:
>>      corecfg = get_config_from_git(r'core\..*', {'editor': os.environ.get('EDITOR', 'vi')})
>>      editor = corecfg.get('editor')
>>      logger.debug('editor=%s', editor)
>> +
>> +    topdir = git_get_toplevel()
>> +    if topdir is not None:
>> +        p = Path(topdir)
>> +        p = p / '.git' / 'b4'
>
> Hardcoding `.git` will break when b4 is run inside a git worktree,
> where `.git` is a file rather than a directory.  This will cause
> `p.mkdir()` below to raise NotADirectoryError.
>
> The existing code in mbox.py:395 already solves this correctly:
>
>     gitargs = ['rev-parse', '--git-dir']
>     ecode, out = b4.git_run_command(topdir, gitargs, logstderr=True)
>
> Consider using `git rev-parse --git-dir` to obtain the actual git
> directory and then creating a `b4/` subdirectory under it.

The current code in the b4 tree includes my changes from Nov. 19, commit
ab9639a7685a0e488f7d32783d55aaa2101acc68, and that code doesn't do what
is shown here. I think there were more iterations. I'm not sure why
we're discussing this old thread.

-Dave


  reply	other threads:[~2026-02-24 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 21:34 [PATCH RESEND v2] Make edit_in_editor use temporary file in Git repository Dave Marquardt via B4 Relay
2025-11-18 22:41 ` Dave Marquardt
2026-02-24 19:28 ` Konstantin Ryabitsev
2026-02-24 21:59   ` Dave Marquardt [this message]
2026-02-24 22:12     ` Konstantin Ryabitsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zf4x246g.fsf@linux.ibm.com \
    --to=davemarq@linux.ibm.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox