{"thread":{"id":"43797","subject":"[PATCH] git-subtree: compare file names by absolute paths","startedAt":"2016-08-12T15:56:31Z","lastAt":"2016-08-12T18:30:20Z","messageCount":3,"participants":["Ivan Oleynikov","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"298857","messageId":"20160812154942.GA27294@metrotek.spb.ru","threadId":"43797","inReplyTo":null,"subject":"[PATCH] git-subtree: compare file names by absolute paths","fromName":"Ivan Oleynikov","fromEmail":"io@metrotek.spb.ru","sentAt":"2016-08-12T15:49:42Z","receivedAt":"2016-08-12T15:56:31Z","isPatch":true,"sender":{"key":"io@metrotek.spb.ru","avatar":null},"body":"This commit removes false positive assertion fails of `git subtree split` when\nthe --prefix argument is not in a particular form produced by `git ls-tree`.\n\nFor example, typical usage of the command could be:\n\n  git subtree split -b split --prefix=some/relative/path\n\nBut\n\n  git subtree split -b split --prefix=./some/relative/path\n\nWould fail with multiple assertion errors. This commit makes the latter command\nwork without errors.\n\nSigned-off-by: Ivan Oleynikov <io@metrotek.spb.ru>\n---\n\nNotes:\n    The bug fixed by this commit can be reproduced like this:\n    \n    $ git init\n    Initialized empty Git repository in /tmp/test/.git/\n    $ mkdir a b\n    $ touch a/file b/file\n    $ git add a\n    $ git commit -m a\n    [master (root-commit) b42584a] a\n     1 file changed, 0 insertions($), 0 deletions(-)\n     create mode 100644 a/file\n    $ git add b\n    $ git commit -m b\n    [master 5114301] b\n     1 file changed, 0 insertions($), 0 deletions(-)\n     create mode 100644 b/file\n    $ git subtree split -b split_a --prefix=a\n    Created branch 'split_a'\n    e9f5d81efacb33ab6cf67fe9ff376b33a483a92f\n    $ git subtree split -b split_b --prefix=./b\n    assertion failed:  [ b = ./b ]\n    No new revisions were found\n    \n    When the commit is applied `git subtree split` works as expected:\n    \n    $ git init\n    Initialized empty Git repository in /tmp/test/.git/\n    $ mkdir a b\n    $ touch a/file b/file\n    $ git add a\n    $ git commit -m a\n    [master (root-commit) bc80f36] a\n     1 file changed, 0 insertions($), 0 deletions(-)\n     create mode 100644 a/file\n    $ git add b\n    $ git commit -m b\n    [master e59c446] b\n     1 file changed, 0 insertions($), 0 deletions(-)\n     create mode 100644 b/file\n    $ git subtree split -b split_a --prefix=a\n    Created branch 'split_a'\n    d542e9cd2de5956dd7ca77b169dba1c8418fa03a\n    $ git subtree split -b split_b --prefix=./b\n    Created branch 'split_b'\n    3ae7854c0c395413c807b2bc4e75b651adc63f8c\n\n contrib/subtree/git-subtree.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex b567eae..d9351b9 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -411,7 +411,7 @@ subtree_for_commit()\n \tdir=\"$2\"\n \tgit ls-tree \"$commit\" -- \"$dir\" |\n \twhile read mode type tree name; do\n-\t\tassert [ \"$name\" = \"$dir\" ]\n+\t\tassert [ \"$(readlink -f $name)\" = \"$(readlink -f $dir)\" ]\n \t\tassert [ \"$type\" = \"tree\" -o \"$type\" = \"commit\" ]\n \t\t[ \"$type\" = \"commit\" ] && continue  # ignore submodules\n \t\techo $tree\n-- \n2.1.4\n\n\n-- \nIvan Oleynikov\nSTC Metrotek\nSt.Petersburg\n"},{"id":"298875","messageId":"20160812174730.GA28761@metrotek.spb.ru","threadId":"43797","inReplyTo":"20160812154942.GA27294@metrotek.spb.ru","subject":"Re: [PATCH] git-subtree: compare file names by absolute paths","fromName":"Ivan Oleynikov","fromEmail":"io@metrotek.spb.ru","sentAt":"2016-08-12T17:47:30Z","receivedAt":"2016-08-12T17:47:40Z","isPatch":true,"sender":{"key":"io@metrotek.spb.ru","avatar":null},"body":"quote on Fri, Aug 12, 2016 at 06:49:42PM +0300 (Ivan Oleynikov):\n\nBTW, this patch should be applied to `maint` branch. The similar change also\nworks if applied to master (patch for master must be a bit different).\n\n-- \nIvan Oleynikov\nSTC Metrotek\nSt.Petersburg\n"},{"id":"298881","messageId":"xmqqwpjlx2ks.fsf@gitster.mtv.corp.google.com","threadId":"43797","inReplyTo":"20160812154942.GA27294@metrotek.spb.ru","subject":"Re: [PATCH] git-subtree: compare file names by absolute paths","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-12T18:30:11Z","receivedAt":"2016-08-12T18:30:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ivan Oleynikov <io@metrotek.spb.ru> writes:\n\n> Cc: git@vger.kernel.org,  dvh@metrotek.spb.ru,  apenwarr@gmail.com\n\nI think Avery no longer actively works on this script; Dave Greene\nhas been helping it move forward by reviewing, so let's ask him to\nlend his eyes.\n\n> This commit removes false positive assertion fails of `git subtree split` when\n> the --prefix argument is not in a particular form produced by `git ls-tree`.\n>\n> For example, typical usage of the command could be:\n>\n>   git subtree split -b split --prefix=some/relative/path\n>\n> But\n>\n>   git subtree split -b split --prefix=./some/relative/path\n>\n> Would fail with multiple assertion errors. This commit makes the latter command\n> work without errors.\n>\n> Signed-off-by: Ivan Oleynikov <io@metrotek.spb.ru>\n> ---\n>\n> Notes:\n>     The bug fixed by this commit can be reproduced like this:\n>     \n>     $ git init\n>     Initialized empty Git repository in /tmp/test/.git/\n>     $ mkdir a b\n>     $ touch a/file b/file\n>     $ git add a\n>     $ git commit -m a\n>     [master (root-commit) b42584a] a\n>      1 file changed, 0 insertions($), 0 deletions(-)\n>      create mode 100644 a/file\n>     $ git add b\n>     $ git commit -m b\n>     [master 5114301] b\n>      1 file changed, 0 insertions($), 0 deletions(-)\n>      create mode 100644 b/file\n>     $ git subtree split -b split_a --prefix=a\n>     Created branch 'split_a'\n>     e9f5d81efacb33ab6cf67fe9ff376b33a483a92f\n>     $ git subtree split -b split_b --prefix=./b\n>     assertion failed:  [ b = ./b ]\n>     No new revisions were found\n>     \n>     When the commit is applied `git subtree split` works as expected:\n>     \n>     $ git init\n>     Initialized empty Git repository in /tmp/test/.git/\n>     $ mkdir a b\n>     $ touch a/file b/file\n>     $ git add a\n>     $ git commit -m a\n>     [master (root-commit) bc80f36] a\n>      1 file changed, 0 insertions($), 0 deletions(-)\n>      create mode 100644 a/file\n>     $ git add b\n>     $ git commit -m b\n>     [master e59c446] b\n>      1 file changed, 0 insertions($), 0 deletions(-)\n>      create mode 100644 b/file\n>     $ git subtree split -b split_a --prefix=a\n>     Created branch 'split_a'\n>     d542e9cd2de5956dd7ca77b169dba1c8418fa03a\n>     $ git subtree split -b split_b --prefix=./b\n>     Created branch 'split_b'\n>     3ae7854c0c395413c807b2bc4e75b651adc63f8c\n>\n>  contrib/subtree/git-subtree.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index b567eae..d9351b9 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -411,7 +411,7 @@ subtree_for_commit()\n>  \tdir=\"$2\"\n>  \tgit ls-tree \"$commit\" -- \"$dir\" |\n>  \twhile read mode type tree name; do\n> -\t\tassert [ \"$name\" = \"$dir\" ]\n> +\t\tassert [ \"$(readlink -f $name)\" = \"$(readlink -f $dir)\" ]\n>  \t\tassert [ \"$type\" = \"tree\" -o \"$type\" = \"commit\" ]\n>  \t\t[ \"$type\" = \"commit\" ] && continue  # ignore submodules\n>  \t\techo $tree\n> -- \n> 2.1.4\n"}]}