Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty merges not recorded #198

Open
krlmlr opened this issue May 31, 2023 · 0 comments
Open

Empty merges not recorded #198

krlmlr opened this issue May 31, 2023 · 0 comments

Comments

@krlmlr
Copy link
Member

krlmlr commented May 31, 2023

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", "[email protected]")

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 <[email protected]>
#> 2 3b57c500961b530159cc34ca6e3735e0ac2d3acc Donald Duck <[email protected]>
#> 3 4fc8e328ab9f41bc65b6c70491afd67b5f518127 Donald Duck <[email protected]>
#>                  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

Created on 2023-05-31 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant