Skip to content

Commit

Permalink
Fix regex when filtering out spaces and change data frame assignment
Browse files Browse the repository at this point in the history
Fix the regex that removes spaces at the end of a commit message.
Change the assignment of the 'commit.message.data' data frame such that
no new data frame is instantiated anymore.

See #193

Signed-off-by: Niklas Schneider <[email protected]>
  • Loading branch information
nlschn committed Feb 1, 2021
1 parent c63a25a commit e1e1ba8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions util-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ read.commit.messages = function(data.path) {
## remove spaces before first line
lines = gsub("^\\s+", "", lines)
## remove spaces at the end of the message
lines = gsub("$\\s+", "", lines)
lines = gsub("\\s+$", "", lines)

## set title and message empty in case there was no actual commit message or it was consisting of spaces only
title = ""
Expand All @@ -504,13 +504,10 @@ read.commit.messages = function(data.path) {
message.split.df = data.table::rbindlist(message.split.df)

## create a data frame containing all four necessary columns
commit.message.data = data.frame(commit.message.data[["commit.id"]], # commit.id
commit.message.data[["hash"]], # hash
message.split.df[["title"]], # title
message.split.df[["message"]]) # message

## set all the column names
colnames(commit.message.data) = COMMIT.MESSAGE.LIST.COLUMNS
commit.message.data["title"] = message.split.df[["title"]] # title
commit.message.data["message"] = message.split.df[["message"]] # message
## reorder columns because they are added alphabetically
commit.message.data = commit.message.data[, COMMIT.MESSAGE.LIST.COLUMNS]

## Make commit.id have numeric type and set row names
commit.message.data[["commit.id"]] = format.commit.ids(commit.message.data[["commit.id"]])
Expand Down

0 comments on commit e1e1ba8

Please sign in to comment.