{"thread":{"id":"39052","subject":"Finding leaf nodes.","startedAt":"2015-04-12T04:04:59Z","lastAt":"2015-04-13T16:32:05Z","messageCount":3,"participants":["Jason Pyeron","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"259248","messageId":"038FFBDD688D4EC6B0B42A339DF246B0@black","threadId":"39052","inReplyTo":null,"subject":"Finding leaf nodes.","fromName":"Jason Pyeron","fromEmail":"jpyeron@pdinc.us","sentAt":"2015-04-12T04:04:59Z","receivedAt":"2015-04-12T04:04:59Z","isPatch":false,"sender":{"key":"jpyeron@pdinc.us","avatar":"https://gravatar.com/avatar/c2e53452caa53d940768a1ffc9cf76196d851b9b534b7a39cd39852a70a0508f?d=mp&s=160"},"body":"I am trying to find all the unmerged commits [5].\n\nI can find, as a human, all the commits by git log --oneline --graph --all [1] but I am looking for a scripted way.\n\nBut git show-branch  -a --independent misses some [2]\n\nfind .git/refs/ -type f -exec cat '{}' ';' | sort -u; finds too much [3].\n\nThe closest I get is with refs=`git show-ref -s`; git log --format=%H $refs --not $(echo \"$refs\" | sed 's/$/^/') but it too [4] gives me extra, but I am really not sure why. \n\n* | a54a4fb \n* | a0d2e63 \n* | dd4400d \n| | *   68ea2c8\n| | |\\\n| |/ /\n|/| |\n| | * c74d3c5 ??? Why is this the only extra commit listed ???\n| |/\n|/|\n* | 9c87570 \n* | 717e33d \n* | 159799f \n\n\nWhat should I do to automate this?\n\n\n\n1:\n0748f668b7fe0cba7a0edf1684ae84ddf87104ee\n13916782bebe690149bfd1c3fb31d6d08942585b\n383f3ae77393c2e303b3c32ef7dee122f0b623be\n473093c214ba578cd7aecb6e2e5caaad70d173e4\n4d0579c438e9d750f158124284bd740a5a0e0e26\n68ea2c83978a7c023d76ebe438dd7d98fb1fd074\n6900b076d790593a909bc84a1d062217e4a32941\n9802bc44da0a35e4c7a917cd23468c387897cccd\n982243cfde0dc6dfb1733d8e95748b7e687f57b8\nc197b7f71cd6d601b99adbe0a5cf5bf6bc749b6e\nc4bc3c4eb0015c73b50ea280a4a380e3cffc5160\nc5234422373d0425fa9cd610cb0848b7c33fe436\nd6af1c103b0cdeb7e7d45ffce2a838fa7a287aea\neb50b82c6f3f55b66693482a913a5c1cfc19a03d\nf9c41c1a17df4358558a23a7c45bc2c60bf97e27\nFb962761aa2ce6fbf77e4769c9e418bbe6f9f47f\n\n2:\n4d0579c438e9d750f158124284bd740a5a0e0e26\n68ea2c83978a7c023d76ebe438dd7d98fb1fd074\n982243cfde0dc6dfb1733d8e95748b7e687f57b8\nC4bc3c4eb0015c73b50ea280a4a380e3cffc5160\n\n3:\n00ea00e8e6a23a4243316f860aa07ed59203ab97\n144eb9f673f14010c600766762b99cba1a64cc6e\n2250af4ad29b92b07365320c5ccb7a22c17f588e\n26bdfdfe71f7ceb4e0954bc5ab6c198481a280ae\n283be0f77477fcd8c8bc878c602538f8a3451403\n2f47330df8fb0357ef4e4d605d5c402150892a18\n3ec60ab0dbdc63760429187605ede4549d7b2bad\n43813b0fc44f7c41d2cdd4573145dbeb1aae1aee\n4d5b52d440d3a64953a6d7ef3cbb81c8d289e392\n556a5c2d759b51080e3bfe07a89b67e927749328\n6fe0b6db2718625e5eeb3cbadeb58aa858ab4f1b\n717e33d67ad3297a15cb432d3f70f7c12d353fa3\n7587a45658aa689cc774d7253007be3feb2eec23\nad9b5fa90c8f52b3ca31dd433c2c4b408e5f2a8f\nb3d7623b74dd75cc4f965d6b37dc461d2786f912\nc19fc45c87de85122952d63d28a0c7d3a18b79d5\ne8529e95d89d3f519a31ef7de5bd7f0d0d318e8c\nf2e86371e7fe3391023adccd61856d088db773dd\nfceca0050ceee8c4996a5740f7122e96c4948dd8\n\n4:\nc74d3c5cda60d8be7f38f1ec89c554a1346d57f8\n\n5: My remotes:\nhttps://github.com/CipherShed/CipherShed.git\nhttps://github.com/pdinc-oss/CipherShed.git\nhttps://github.com/discnl/CipherShed.git\nhttps://github.com/eaglgenes101/CipherShed.git\nhttps://github.com/erkinalp/CipherShed.git\nhttps://github.com/GigabyteProductions/CipherShed.git\nhttps://github.com/jeffallen/CipherShed.git\nhttps://github.com/kaydiechii/CipherShed.git\nhttps://github.com/srguglielmo/CipherShed.git\n\n--\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n-                                                               -\n- Jason Pyeron                      PD Inc. http://www.pdinc.us -\n- Principal Consultant              10 West 24th Street #100    -\n- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -\n-                                                               -\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nThis message is copyright PD Inc, subject to license 20080407P00.\n"},{"id":"259291","messageId":"552BD154.6040609@drmicha.warpmail.net","threadId":"39052","inReplyTo":"038FFBDD688D4EC6B0B42A339DF246B0@black","subject":"Re: Finding leaf nodes.","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-04-13T14:23:16Z","receivedAt":"2015-04-13T14:23:16Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jason Pyeron venit, vidit, dixit 12.04.2015 06:04:\n> I am trying to find all the unmerged commits [5].\n\n\"Unmerged\" to which branch?\n\nIt's not clear to me which commits you are looking for. By \"leaf node\" I\nwould describe a commit without child commits. \"unmerged\" can only be\nunderstood relative to a specific branch.\n\nMaybe you are looking for commits from remote refs which are not on any\nlocal branch?\n\n> I can find, as a human, all the commits by git log --oneline --graph --all [1] but I am looking for a scripted way.\n> \n> But git show-branch  -a --independent misses some [2]\n\nThis finds refs which are not \"contained in\" (can be reached from) any\nof the other refs. If a remote ref is contained in another remore ref it\nis not listed.\n\n> find .git/refs/ -type f -exec cat '{}' ';' | sort -u; finds too much [3].\n\nThis finds all refs.\n\n> The closest I get is with refs=`git show-ref -s`; git log --format=%H $refs --not $(echo \"$refs\" | sed 's/$/^/') but it too [4] gives me extra, but I am really not sure why. \n\nThis finds all commits which are on some ref (branch/tag/..), excluding\nthose which are next to the tip or higher up from those refs.\n\n> \n> * | a54a4fb \n> * | a0d2e63 \n> * | dd4400d \n> | | *   68ea2c8\n> | | |\\\n> | |/ /\n> |/| |\n> | | * c74d3c5 ??? Why is this the only extra commit listed ???\n\nBecause it is not \"next to the tip\", more specifically: not a first\nparent (foo^) of a referenced commit, and neither a predecessor of one.\n\n> | |/\n> |/|\n> * | 9c87570 \n> * | 717e33d \n> * | 159799f \n> \n> \n> What should I do to automate this?\n> \n\nPlease try and restate what you mean by \"unmerged commits\". Maybe remote\ncommits not on any local branch, or remote commits not on master?\n\n> \n> \n> 1:\n> 0748f668b7fe0cba7a0edf1684ae84ddf87104ee\n> 13916782bebe690149bfd1c3fb31d6d08942585b\n> 383f3ae77393c2e303b3c32ef7dee122f0b623be\n> 473093c214ba578cd7aecb6e2e5caaad70d173e4\n> 4d0579c438e9d750f158124284bd740a5a0e0e26\n> 68ea2c83978a7c023d76ebe438dd7d98fb1fd074\n> 6900b076d790593a909bc84a1d062217e4a32941\n> 9802bc44da0a35e4c7a917cd23468c387897cccd\n> 982243cfde0dc6dfb1733d8e95748b7e687f57b8\n> c197b7f71cd6d601b99adbe0a5cf5bf6bc749b6e\n> c4bc3c4eb0015c73b50ea280a4a380e3cffc5160\n> c5234422373d0425fa9cd610cb0848b7c33fe436\n> d6af1c103b0cdeb7e7d45ffce2a838fa7a287aea\n> eb50b82c6f3f55b66693482a913a5c1cfc19a03d\n> f9c41c1a17df4358558a23a7c45bc2c60bf97e27\n> Fb962761aa2ce6fbf77e4769c9e418bbe6f9f47f\n> \n> 2:\n> 4d0579c438e9d750f158124284bd740a5a0e0e26\n> 68ea2c83978a7c023d76ebe438dd7d98fb1fd074\n> 982243cfde0dc6dfb1733d8e95748b7e687f57b8\n> C4bc3c4eb0015c73b50ea280a4a380e3cffc5160\n> \n> 3:\n> 00ea00e8e6a23a4243316f860aa07ed59203ab97\n> 144eb9f673f14010c600766762b99cba1a64cc6e\n> 2250af4ad29b92b07365320c5ccb7a22c17f588e\n> 26bdfdfe71f7ceb4e0954bc5ab6c198481a280ae\n> 283be0f77477fcd8c8bc878c602538f8a3451403\n> 2f47330df8fb0357ef4e4d605d5c402150892a18\n> 3ec60ab0dbdc63760429187605ede4549d7b2bad\n> 43813b0fc44f7c41d2cdd4573145dbeb1aae1aee\n> 4d5b52d440d3a64953a6d7ef3cbb81c8d289e392\n> 556a5c2d759b51080e3bfe07a89b67e927749328\n> 6fe0b6db2718625e5eeb3cbadeb58aa858ab4f1b\n> 717e33d67ad3297a15cb432d3f70f7c12d353fa3\n> 7587a45658aa689cc774d7253007be3feb2eec23\n> ad9b5fa90c8f52b3ca31dd433c2c4b408e5f2a8f\n> b3d7623b74dd75cc4f965d6b37dc461d2786f912\n> c19fc45c87de85122952d63d28a0c7d3a18b79d5\n> e8529e95d89d3f519a31ef7de5bd7f0d0d318e8c\n> f2e86371e7fe3391023adccd61856d088db773dd\n> fceca0050ceee8c4996a5740f7122e96c4948dd8\n> \n> 4:\n> c74d3c5cda60d8be7f38f1ec89c554a1346d57f8\n> \n> 5: My remotes:\n> https://github.com/CipherShed/CipherShed.git\n> https://github.com/pdinc-oss/CipherShed.git\n> https://github.com/discnl/CipherShed.git\n> https://github.com/eaglgenes101/CipherShed.git\n> https://github.com/erkinalp/CipherShed.git\n> https://github.com/GigabyteProductions/CipherShed.git\n> https://github.com/jeffallen/CipherShed.git\n> https://github.com/kaydiechii/CipherShed.git\n> https://github.com/srguglielmo/CipherShed.git\n> \n> --\n> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n> -                                                               -\n> - Jason Pyeron                      PD Inc. http://www.pdinc.us -\n> - Principal Consultant              10 West 24th Street #100    -\n> - +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -\n> -                                                               -\n> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n> This message is copyright PD Inc, subject to license 20080407P00.\n> \n"},{"id":"259304","messageId":"4657569730954D20A9498BDCA66E1C30@black","threadId":"39052","inReplyTo":"552BD154.6040609@drmicha.warpmail.net","subject":"RE: Finding leaf nodes.","fromName":"Jason Pyeron","fromEmail":"jpyeron@pdinc.us","sentAt":"2015-04-13T16:32:05Z","receivedAt":"2015-04-13T16:32:05Z","isPatch":false,"sender":{"key":"jpyeron@pdinc.us","avatar":"https://gravatar.com/avatar/c2e53452caa53d940768a1ffc9cf76196d851b9b534b7a39cd39852a70a0508f?d=mp&s=160"},"body":"> -----Original Message-----\n> From: Michael J Gruber \n> Sent: Monday, April 13, 2015 10:23\n> \n> Jason Pyeron venit, vidit, dixit 12.04.2015 06:04:\n> > I am trying to find all the unmerged commits [5].\n> \n> \"Unmerged\" to which branch?\n\nAll. I was atempting to describe a leaf node.\n\n> \n> It's not clear to me which commits you are looking for. By \n> \"leaf node\" I\n> would describe a commit without child commits. \"unmerged\" can only be\n\nThat is exactly what I meant.\n\n> understood relative to a specific branch.\n> \n> Maybe you are looking for commits from remote refs which are \n> not on any\n> local branch?\n\nAnywhere, that I know about. If the commit does not have a child, then that commit needs to be in the list, I do not care about the branches.\n\n> \n> > I can find, as a human, all the commits by git log \n> --oneline --graph --all [1] but I am looking for a scripted way.\n> > \n> > But git show-branch  -a --independent misses some [2]\n> \n> This finds refs which are not \"contained in\" (can be reached from) any\n> of the other refs. If a remote ref is contained in another \n> remore ref it\n> is not listed.\n\nYour description is logical, but how can a commit be included in \"another remote ref\"?\n\n> \n> > find .git/refs/ -type f -exec cat '{}' ';' | sort -u; finds \n> too much [3].\n> \n> This finds all refs.\n\nI know, the issue is I do not know how to filter it.\n\n> \n> > The closest I get is with refs=`git show-ref -s`; git log \n> --format=%H $refs --not $(echo \"$refs\" | sed 's/$/^/') but it \n> too [4] gives me extra, but I am really not sure why. \n> \n> This finds all commits which are on some ref (branch/tag/..), \n> excluding\n> those which are next to the tip or higher up from those refs.\n> \n> > \n> > * | a54a4fb \n> > * | a0d2e63 \n> > * | dd4400d \n> > | | *   68ea2c8\n> > | | |\\\n> > | |/ /\n> > |/| |\n> > | | * c74d3c5 ??? Why is this the only extra commit listed ???\n> \n> Because it is not \"next to the tip\", more specifically: not a first\n> parent (foo^) of a referenced commit, and neither a \n> predecessor of one.\n\nI need to think on what you just said for this one.\n\n> \n> > | |/\n> > |/|\n> > * | 9c87570 \n> > * | 717e33d \n> > * | 159799f \n> > \n> > \n> > What should I do to automate this?\n> > \n> \n> Please try and restate what you mean by \"unmerged commits\". \n> Maybe remote\n> commits not on any local branch, or remote commits not on master?\n\nRegardless of branch references, I need to list all commits which do not have any child commits.\n\n> \n> > \n> > \n> > 1:\n\nSee: yellow lines at http://client.pdinc.us/git-leaf-nodes-334e98c075877ce78b1ef959cb1155f7.html\n\n> > \n> > 2:\n> > 4d0579c438e9d750f158124284bd740a5a0e0e26\n> > 68ea2c83978a7c023d76ebe438dd7d98fb1fd074\n> > 982243cfde0dc6dfb1733d8e95748b7e687f57b8\n> > C4bc3c4eb0015c73b50ea280a4a380e3cffc5160\n> > \n> > 3:\n> > 00ea00e8e6a23a4243316f860aa07ed59203ab97\n> > 144eb9f673f14010c600766762b99cba1a64cc6e\n> > 2250af4ad29b92b07365320c5ccb7a22c17f588e\n> > 26bdfdfe71f7ceb4e0954bc5ab6c198481a280ae\n> > 283be0f77477fcd8c8bc878c602538f8a3451403\n> > 2f47330df8fb0357ef4e4d605d5c402150892a18\n> > 3ec60ab0dbdc63760429187605ede4549d7b2bad\n> > 43813b0fc44f7c41d2cdd4573145dbeb1aae1aee\n> > 4d5b52d440d3a64953a6d7ef3cbb81c8d289e392\n> > 556a5c2d759b51080e3bfe07a89b67e927749328\n> > 6fe0b6db2718625e5eeb3cbadeb58aa858ab4f1b\n> > 717e33d67ad3297a15cb432d3f70f7c12d353fa3\n> > 7587a45658aa689cc774d7253007be3feb2eec23\n> > ad9b5fa90c8f52b3ca31dd433c2c4b408e5f2a8f\n> > b3d7623b74dd75cc4f965d6b37dc461d2786f912\n> > c19fc45c87de85122952d63d28a0c7d3a18b79d5\n> > e8529e95d89d3f519a31ef7de5bd7f0d0d318e8c\n> > f2e86371e7fe3391023adccd61856d088db773dd\n> > fceca0050ceee8c4996a5740f7122e96c4948dd8\n> > \n> > 4:\n> > c74d3c5cda60d8be7f38f1ec89c554a1346d57f8\n> > \n> > 5: My remotes:\n> > https://github.com/CipherShed/CipherShed.git\n> > https://github.com/pdinc-oss/CipherShed.git\n> > https://github.com/discnl/CipherShed.git\n> > https://github.com/eaglgenes101/CipherShed.git\n> > https://github.com/erkinalp/CipherShed.git\n> > https://github.com/GigabyteProductions/CipherShed.git\n> > https://github.com/jeffallen/CipherShed.git\n> > https://github.com/kaydiechii/CipherShed.git\n> > https://github.com/srguglielmo/CipherShed.git\n\n--\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n-                                                               -\n- Jason Pyeron                      PD Inc. http://www.pdinc.us -\n- Principal Consultant              10 West 24th Street #100    -\n- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -\n-                                                               -\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nThis message is copyright PD Inc, subject to license 20080407P00. \n"}]}