All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: "Kernel.org Tools" <tools@linux.kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	 Philippe Blain <levraiphilippeblain@gmail.com>
Subject: [PATCH] ez: allow remote-tracking branches as 'base-branch'
Date: Sun, 19 Feb 2023 19:45:42 -0500	[thread overview]
Message-ID: <20230219-allow-remote-branches-as-base-v1-1-a1cf7948b2cc@gmail.com> (raw)

Since 83b185a (ez: support enrolling branches using tags, 2022-08-16),
we use 'git show-ref --heads' to check if the argument given to
'--enroll-base' is a branch, so that the alternate code path can be
taken for tags. This means that since that commit, using a
remote-tracking branch as argument to '--enroll-base' does not work
well, because such branches are not shown by 'git show-ref --heads'. The
code path for tags is taken instead, and this usually leads to a
"Multiple branches contain object" error (since several local branches
are often based on the same remote-tracking branch).

Pass a fully-qualified ref 'refs/heads/<enroll_base>' as pattern to 'git
show-ref', and also pass it a second second pattern
'refs/remotes/<enroll_base>' to allow both local and remote-tracking
branches.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 b4/ez.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b4/ez.py b/b4/ez.py
index 74afddc..9cafe0c 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -370,7 +370,7 @@ def start_new_series(cmdargs: argparse.Namespace) -> None:
         slug = re.sub(r'\W+', '-', branchname).strip('-').lower()
         enroll_base = cmdargs.enroll_base
         # Is it a branch?
-        gitargs = ['show-ref', '--heads', enroll_base]
+        gitargs = ['show-ref', f'refs/heads/{enroll_base}', f'refs/remotes/{enroll_base}']
         lines = b4.git_get_command_lines(None, gitargs)
         if lines:
             try:

---
base-commit: a3281834d6d5dec44f58071fca2d22e04a97fe18
change-id: 20230219-allow-remote-branches-as-base-1ccdeb741f0c
--
b4 


             reply	other threads:[~2023-02-20  0:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20  0:45 Philippe Blain [this message]
2023-02-24 14:57 ` [PATCH] ez: allow remote-tracking branches as 'base-branch' Philippe Blain
2023-03-06 18:02 ` [PATCH v2 0/4] ez: allow remote-tracking branches as ENROLL_BASE Philippe Blain
2023-03-06 18:02   ` [PATCH v2 1/4] " Philippe Blain
2023-03-06 18:02   ` [PATCH v2 2/4] ez: also check remote-tracking branches when ENROLL_BASE is not a branch Philippe Blain
2023-03-06 18:02   ` [PATCH v2 3/4] ez: allow '@{upstream}' as ENROLL_BASE Philippe Blain
2023-03-06 18:02   ` [PATCH v2 4/4] ez: let ENROLL_BASE default to '@{upstream}' Philippe Blain
2023-03-10 19:59   ` [PATCH v2 0/4] ez: allow remote-tracking branches as ENROLL_BASE 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=20230219-allow-remote-branches-as-base-v1-1-a1cf7948b2cc@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.