Teach Checkout() to append to the reflog#395
Conversation
|
I worked a lot on the HEAD with this amend. I tried various ways to checkout the current HEAD and implement these corner cases the same way as The most difficult case was So to make it work, I introduced an empty class If anyone has a better idea... |
Maybe we can differ from git.git in that case, and just skip logging that. It seems there is no added value to add a line to the reflog in such a case, or am I missing something? |
|
This is 💎 ! |
I'd tend to agree with @yorah on this. @haacked @dahlbyk @spraints @KindDragon @cmn What's your opinion on this? Do you see any issue with not logging "moving from master to master"? /cc @peff |
|
Yeah, if |
|
Ok, I got the message... 😃 |
Ping me when you're done 0️⃣ 0️⃣ 7️⃣ |
|
Done! It's a lot more concise this way. Now, any |
When no user information exists in the configuration, a dummy signature is created to value the reflog entry.
|
This is the final push I hope... As the various ways of checking out HEAD were not covered, I added some specific tests for that and correct minor bugs. @spraints |
|
🤘 |
|
I completely agree! 😃 |
|
Merged! ✨ 💖 🤘 |
|
Thanks! |

This PR covers part of issue #389.
Any
Repository.Checkout()call is now appending an entry in the reflog, respectinggit.exebehavior.In particular, I tested it when checking out on branches, commits and with revparse syntax.
To make it work with revparse syntax, I corrected the
Checkout()current implementation to cope with it first.I also added a trick : as a
ReflogEntryneeds aComitter, it usually builds aSignaturefrom the git config options. In case there is no such configuration,git.execreates a dummy user withuser.name = "unknown"anduser.email = "{machine_user_name}@{machine_user_domain_name}". I added the same kind of behavior inConfigurationclass to append the reflog on checkout.