When I ask git_merge(), my expectation is that a merge commit is created even if the merge doesn't change any files, at least with the default squash = FALSE. Should there be an argument to control that?
# Init repo
gert::git_init("test")
setwd("test")
gert::git_config_set("user.name", "Donald Duck")
gert::git_config_set("user.email", "donald@duck.com")
writeLines(character(), ".gitignore")
gert::git_add(".gitignore")
#> file status staged
#> 1 .gitignore new TRUE
gert::git_commit("initial")
#> [1] "4fc8e328ab9f41bc65b6c70491afd67b5f518127"
# Create test-branch
gert::git_branch_create("test-branch")
gert::git_branch_checkout("test-branch")
#> <git repository>: /private/var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpsGahGN/reprex-12ae94e3d20a5-gaudy-geese/test[@test-branch]
writeLines("a", "a.txt")
gert::git_add("a.txt")
#> file status staged
#> 1 a.txt new TRUE
gert::git_commit_all("Create a.txt")
#> [1] "3b57c500961b530159cc34ca6e3735e0ac2d3acc"
unlink("a.txt")
gert::git_commit_all("Remove a.txt")
#> [1] "956e9280e279ccc295768c471b156a7c5f54ed60"
gert::git_log()
#> commit author
#> 1 956e9280e279ccc295768c471b156a7c5f54ed60 Donald Duck <donald@duck.com>
#> 2 3b57c500961b530159cc34ca6e3735e0ac2d3acc Donald Duck <donald@duck.com>
#> 3 4fc8e328ab9f41bc65b6c70491afd67b5f518127 Donald Duck <donald@duck.com>
#> time files merge message
#> 1 2023-05-31 05:58:46 1 FALSE Remove a.txt\n
#> 2 2023-05-31 05:58:46 1 FALSE Create a.txt\n
#> 3 2023-05-31 05:58:46 1 FALSE initial\n
# Merge
gert::git_branch_checkout("main")
#> <git repository>: /private/var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpsGahGN/reprex-12ae94e3d20a5-gaudy-geese/test[@main]
gert::git_merge("test-branch")
#> Merge did not result in any changes
#> NULL
gert::git_merge("test-branch")
#> Merge did not result in any changes
#> NULL
When I ask
git_merge()
, my expectation is that a merge commit is created even if the merge doesn't change any files, at least with the defaultsquash = FALSE
. Should there be an argument to control that?Created on 2023-05-31 with reprex v2.0.2