Context-Encoded Code Change Representation for Automated Commit Message Generation

Thanh Trong Vu, Thanh-Dat Do, Hieu Dinh Vo · International Journal of Software Engineering and Knowledge Engineering · 2023

Changes in source code are an inevitable part of software development. They are the results of indispensable activities such as fixing bugs or improving functionality. Descriptions for code changes (commit messages) help people better understand the changes. However, due to the lack of motivation and time pressure, writing high-quality commit messages remains reluctantly considered. Several methods have been proposed with the aim of automated commit message generation. However, the existing methods are still limited because they only utilize either the changed codes or the changed codes combined with their surrounding statements. This paper proposes a method to represent code changes by combining the changed codes and the unchanged codes which have program dependence on the changed codes. Specifically, we first create program dependence graphs (PDGs) of source code before and after the change. After that, slices related to the changed code from these PDGs are extracted. These slices are then merged to represent the change. This method overcomes the limitations of current representations while improving the performance of 5/6 of state-of-the-art commit message generation methods by up to 15% in METEOR, 14% in ROUGE-L, and 10% in BLEU-4.

Read the paper · More papers on PaperTik