From: Philippe Blain <levraiphilippeblain@gmail.com>
To: tools@linux.kernel.org
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Subject: b4 can't diff a series with a file renamed, then modified
Date: Wed, 26 Oct 2022 09:01:58 -0400 [thread overview]
Message-ID: <e759026c-4f49-cc2a-7885-10b88212d20e@gmail.com> (raw)
Hi Konstantin,
I'm hitting a bug when running 'b4 diff' on https://lore.kernel.org/git/pull.1321.v2.git.git.1666297238.gitgitgadget@gmail.com/.
Here is a reproducer in a clone of git.git:
git checkout 9bf691b78c # the base commit of v1
b4 am -v 1 -o- https://lore.kernel.org/git/pull.1321.v2.git.git.1666297238.gitgitgadget@gmail.com | git am # apply v1 to get the necessary blobs
b4 -d diff -C -n https://lore.kernel.org/git/pull.1321.v2.git.git.1666297238.gitgitgadget@gmail.com/
This is on b4's 2a16f70 (am: ignore base-commit info if commit not present, 2022-10-19).
The 'b4 diff' command errors like so:
Looking at [PATCH 3/6] t5617: drop references to remote-tracking branches
ERROR: some patches do not have indexes
unable to create a fake-am range
Running git --no-pager worktree remove --force /var/folders/lr/r6n2057j0dzd4gdb614fp0740000gp/T/tmp7hpz_ac1
---
Could not create fake-am range for lower series v1
I looked through the code and found that LoreMessage::get_indexes
is not ready for rename patches, since the "rename" lines in the 'git diff' output
is placed between the 'diff --git' line and the 'index' line, which the code does
not account for. This seems to help:
diff --git a/b4/__init__.py b/b4/__init__.py
index 4456414..fb618c7 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1517,7 +1517,7 @@ class LoreMessage:
if line.find('diff ') != 0 and line.find('index ') != 0:
continue
matches = re.search(r'^diff\s+--git\s+\w/(.*)\s+\w/(.*)$', line)
- if matches and matches.groups()[0] == matches.groups()[1]:
+ if matches:
curfile = matches.groups()[0]
continue
matches = re.search(r'^index\s+([\da-f]+)\.\.[\da-f]+.*$', line)
With this change, the 'b4 diff' command goes a little further, but still fails:
Running git --no-pager write-tree
Running git --no-pager commit-tree 565d875b4fdf449501853a9bcbe608e4374d9eed^{tree} -F -
Running git --no-pager reset --hard 1149ea03d905ba0a51d1c80e6352361cf34feee1
Running git --no-pager am .__git-am__
ERROR: Could not fake-am version 1
Running git --no-pager worktree remove --force /var/folders/lr/r6n2057j0dzd4gdb614fp0740000gp/T/tmp1h_x78kk
---
Could not create fake-am range for lower series v1
I ran the 'git am' command manually in the temporary worktree, and this is what it outputs:
$ git am .__git-am__
Applying: clone: teach --detach option
warning: t/t5601-clone.sh has type 100644, expected 100755
Applying: repo-settings: add submodule_propagate_branches
Applying: t5617: drop references to remote-tracking branches
warning: t/t5617-clone-submodules-remote.sh has type 100644, expected 100755
error: t/t5617-clone-submodules.sh: already exists in index
Patch failed at 0003 t5617: drop references to remote-tracking branches
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
It aborts at 3/6 because t/t5617-clone-submodules.sh (the new name of the renamed file)
already exists in the index. From what I understand of LoreSeries::make_fake_am_range, this
is because it gets added to the index when preparing the initial fake commit because
6/6 modifies it.
Thanks,
Philippe.
next reply other threads:[~2022-10-26 13:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-26 13:01 Philippe Blain [this message]
2022-10-26 18:11 ` [RFC PATCH] Fix 'LoreSeries::make_fake_am_range' with renamed, then modified file Philippe Blain
2022-10-31 19:51 ` Konstantin Ryabitsev
2022-11-07 13:40 ` [PATCH b4] " Philippe Blain
2022-11-28 18:07 ` Philippe Blain
2022-11-29 18:42 ` 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=e759026c-4f49-cc2a-7885-10b88212d20e@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.