Cynnexis/Commity

๐Ÿ› Cannot get all commits of feature branch if it has a sub-feature branch

Closed this issue ยท 1 comments

The following is the representation of the git testing repo:

                            * commit 11 (change-first-lorem-paragraph)
                            |     ๐Ÿ“ Update first paragraph of lorem text
                            |
        commit 10 (lorem) * |
          Add lorem again | |
                          | /
                          |/
                       |  * commit 9 (lorem)
                          |     โœจ Add more lorem!
                       |  |
                          * commit 8 (lorem)
                       |  |     โœจ Add lorem
                         /
                       |/
                       |
                       * commit 7 (master)
                       |     ๐Ÿ“ Update README
 commit 6 (license) *  |
   Add LICENSE      |  |
                     \ |
                      \|
                       * commit 5 (HEAD -> master)
                       |\    Merge getting-started -> master
                       | \
                       |  |
                       |  * commit 4 (getting-started)
                       |  |     ๐Ÿ“ Add more content in Getting Started
                       |  |
                       |  * commit 3 (getting-started)
                       |  |     ๐Ÿ“ Add Getting Started section
                       | /
                       |/
                       |
                       * commit 2 (master) (tag: v1.0)
                       |     ๐Ÿ“ Add description
                       |
                       * commit 1 (master)
                             ๐ŸŽ‰ First commit

If we call commity.py on the branch lorem (pointing on commit 10), then only the commit 10 is returned, whereas 10, 9 and 8 were expected. This is caused by the algorithm, that stops when a commit with more than 1 child is encountered. This method doesn't work with sub-feature branch such as change-first-lorem-paragraph in this example.

A possible solution would be to get all the commit of the parent of the branch we analyze (here master) and go down the feature branch until one of the parent's commit is encountered.

To detect the parent of the branch, one must not assume that it is master (if we want to get all commits from change-first-lorem-paragraph, its parent is lorem and not master), and must create a second graph, showing this time not the dependencies between commits, but between branches.