Web lists-archives.com

Re: Regression in git-subtree.sh, introduced in 2.20.1, after 315a84f9aa0e2e629b0680068646b0032518ebed




On Mon, Dec 31, 2018 at 01:31:21PM +0100, Marc Balmer wrote:
> 
> 
> > Am 31.12.2018 um 12:36 schrieb Duy Nguyen <pclouds@xxxxxxxxx>:
> > 
> > On Mon, Dec 31, 2018 at 6:24 PM Marc Balmer <marc@xxxxxxx> wrote:
> >> In a (private) Email to me, he indicated that had no time for a fix.  Maybe he can speak up here?
> > 
> > Well, I guess Junio will revert when he's back after the holidays
> > then. Meanwhile..
> > 
> >> In any case, if I can help testing, I am in.  I just don't know the inner workings of git-subtree.sh (I am a mere user of it...)
> > 
> > If the repo you're facing the problem is publicly available, that
> > would be great so some of us could try reproduce.
> 
> Unfortunately it is not.
> 
> > 
> > Otherwise we'll need your help to track this problem down. in
> > git-subtree script line 640 (or somewhere close)
> > 
> >    progress "$revcount/$revmax ($createcount) [$extracount]"
> > 
> > could you update it to show $parents and $rev as well, e.g.
> > 
> >    progress "$revcount/$revmax ($createcount) [$extracount] ($parents) ($rev)"
> 
> I did add this, plus changed progress to output a linefeed, and now just before the crash, the output looks like this:
> 
> 436/627 (2013) [1649] (6e54a90a29e4e01fa2d6a42c232e02e08e912b2d) (2ca7b24e731ff91c94c9abf214686cb29cdc367e)
> 436/627 (2014) [1650] (1ef866e5a18012e80eed36315deb932c2b66d34a) (6e54a90a29e4e01fa2d6a42c232e02e08e912b2d)
> 436/627 (2015) [1651] (c8585f441548dd43f113a96ba48f6fa70363d388) (1ef866e5a18012e80eed36315deb932c2b66d34a)
> 436/627 (2016) [1652] (663bb110a58decfe889cf7c6b766f1d0c032ba39) (c8585f441548dd43f113a96ba48f6fa70363d388)
> 436/627 (2017) [1653] (edbdd28e009e52c8001bb54e53a56b059167e07d) (663bb110a58decfe889cf7c6b766f1d0c032ba39)
> 436/627 (2018) [1654] (c47739713912ae6e94714b9a1a6732407b236932) (edbdd28e009e52c8001bb54e53a56b059167e07d)
> 436/627 (2019) [1655] (d444823b97d9a8e53c4e721a44e4c49619d0b372) (c47739713912ae6e94714b9a1a6732407b236932)
> 436/627 (2020) [1656] (15a7ccecb2ca8bc47c77a997f8c74e7ac3b13325) (d444823b97d9a8e53c4e721a44e4c49619d0b372)
> 436/627 (2021) [1657] (b9bc5c9b33b100b57e23626ff422dac73f94384e) (15a7ccecb2ca8bc47c77a997f8c74e7ac3b13325)
> 436/627 (2022) [1658] (eec0f28c6fe5f7d664c41a913883d64cdf53c111) (b9bc5c9b33b100b57e23626ff422dac73f94384e)
> 436/627 (2023) [1659] (e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94) (eec0f28c6fe5f7d664c41a913883d64cdf53c111)
> 436/627 (2024) [1660] (27b96988847caf3bfd71df2d7f58cbe6ba78208a) (e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94)
> 436/627 (2025) [1661] (11e5861e50f88237ce362b6c7531e4e90bac86ac) (27b96988847caf3bfd71df2d7f58cbe6ba78208a)
> /usr/libexec/git-core/git-subtree: line 751: 122202 Done                    eval "$grl"
>      122203 Segmentation fault      (core dumped) | while read rev parents; do
>     process_split_commit "$rev" "$parents" 0;
> done
> 
> 
> > 
> > Then please run these commands and post the output here
> > 
> >    git rev-parse <that-rev>^@
> 
> Did that with the last three lines:
> 
> $ git rev-parse 27b96988847caf3bfd71df2d7f58cbe6ba78208a^@
> 11e5861e50f88237ce362b6c7531e4e90bac86ac
> $ git rev-parse e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94^@
> 27b96988847caf3bfd71df2d7f58cbe6ba78208a
> $ git rev-parse eec0f28c6fe5f7d664c41a913883d64cdf53c111^@
> e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94
> 
> > 
> > and
> > 
> >    git show -s --pretty=%P <that-rev>
> 
> $ git show -s --pretty=%P 27b96988847caf3bfd71df2d7f58cbe6ba78208a
> 11e5861e50f88237ce362b6c7531e4e90bac86ac
> $ git show -s --pretty=%P e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94
> 27b96988847caf3bfd71df2d7f58cbe6ba78208a
> $ git show -s --pretty=%P eec0f28c6fe5f7d664c41a913883d64cdf53c111
> e0ddd9c60f71283996cfb169f1dbb77e8f7c4b94
> 

Hmm.. I'm not that familiar with git-subtree.sh, so here's one last
blind shot.

There's a format change between git-show and git-rev-parse. The former
separates commits by spaces while the latter by newlines. Will this
help?

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 147201dc6c..23f570beee 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -633,7 +633,7 @@ process_split_commit () {
 	else
 		# processing commit without normal parent information;
 		# fetch from repo
-		parents=$(git rev-parse "$rev^@")
+		parents=$(git rev-parse "$rev^@" | tr '\n' ' ')
 		extracount=$(($extracount + 1))
 	fi
 
--
Duy