{"thread":{"id":"58921","subject":"Re: [PATCH v3 0/2] worktree: Support `--orphan` when creating new worktrees","startedAt":"2022-12-08T21:41:44Z","lastAt":"2022-12-12T00:38:11Z","messageCount":3,"participants":["Jacob Abel","rsbecker@nexbridge.com","'Jacob Abel'"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"468801","messageId":"20221208214110.bdu5n65c3fvcxjom@phi","threadId":"58921","inReplyTo":null,"subject":"Re: [PATCH v3 0/2] worktree: Support `--orphan` when creating new worktrees","fromName":"Jacob Abel","fromEmail":"jacobabel@nullpo.dev","sentAt":"2022-12-08T21:41:27Z","receivedAt":"2022-12-08T21:41:44Z","isPatch":true,"sender":{"key":"jacobabel@nullpo.dev","avatar":"https://avatars.githubusercontent.com/u/9424043?v=4"},"body":"Apologies for the delay on the v4 patch. Some unexpected personal stuff has kept\nme away from working on this. I expect v4 to be out in the next few days.\n\nAdditionally, I've been doing some reading after writing this reply [1]. I've\nrealised I had a misunderstanding about how HEAD is managed. I don't think it\nchanges the conclusion of the reply (which is that rolling `--orphan` into DWYM\ncould lead to confusing behavior for users) however I think some additional\nchanges might be warranted:\n\n* Add some additional text output to `worktree add` when we DWYM to make it\n  clearer what action we end up making. Could possibly be hidden under a\n  \"verbose\" flag.\n* Annotate what HEAD we are looking at (worktree HEAD vs git repo HEAD) in\n  conditions where this could matter.\n* Expanding HEAD when it's an invalid ref (instead of just `invalid ref: HEAD`).\n* Add a hint when using `worktree add`, with a bare git repo, HEAD points to an\n  invalid ref, not in a worktree, and other branches exist in the repo. The hint\n  would suggest using `git branch -m <branch>` to change the HEAD to an existing\n  branch.\n* Add a hint when there are no local branches and the user is trying to create a\n  worktree off a local branch which has a remote counterpart.\n\nI don't necessarily think any of these changes should hold up this patchset but\nI think they could be worthwhile changes for the future.\n\nAnd in the meantime, below are the anticipated changes for the next revision. Let\nme know if it looks like I've forgotten anything.\n\nAnticipated changes from v3:\n  * Fix mistake in SYNOPSIS and `--help`. Patch for this change can be found\n    in [2], by courtesy of Ævar Arnfjörð Bjarmason.\n  * Collapsed sequential if statements into if-else chain & simplified\n    conditions as requested in [2].\n  * Simplified tests for mutually exclusive options and removed duplicate\n    `-B/--detach` test case. Patch for this change can be found in [3],\n    by courtesy of Ævar Arnfjörð Bjarmason.\n  * Remove references to `git-switch`. Behavior is now explained fully in docs\n    instead. Changes to the docs suggested in [4], by courtesy of Eric Sunshine.\n  * Updated test case to use `test_path_is_missing` instead of `! test -d` [5].\n  * Updated signature for `make_worktree_orphan()` and changed\n    `const char *orphan_branch` in `struct add_opts` to `int orphan` (boolean)\n    to simplify the patch and maintain consistency with other flags [6].\n  * Added `advise()` to common cases where `--orphan` is desired [7] to address\n    concerns brought up in [8][9]. Slight change from `HEAD` to `branch` as\n    `HEAD` causes existing behavior to break.\n  * Added tests to verify `--lock` and `--reason` work properly with\n    the newly added `--orphan` flag.\n  * Added tests to verify that the orphan advise [7] is emitted only at the\n    proper times.\n  * Added the new advice to the docs, advice.c/h, and switched to use\n    `advise_if_enabled()` as requested in [10].\n  * Added tests to verify the changes [7] do not interfere with existing\n    behavior. ex: creating a worktree from a remote branch when HEAD is\n    an orphan.\n\n1. https://lore.kernel.org/git/20221123042052.t42jmsqjxgx2k3th@phi/\n2. https://lore.kernel.org/git/221115.86edu3kfqz.gmgdl@evledraar.gmail.com/\n3. https://lore.kernel.org/git/221116.86a64rkdcj.gmgdl@evledraar.gmail.com/\n4. https://lore.kernel.org/git/CAPig+cQiyd9yGE_XpPZmzLQnNDMypnrEgkV7nqRZZn3j6E0APQ@mail.gmail.com/\n5. https://lore.kernel.org/git/221115.86iljfkjjo.gmgdl@evledraar.gmail.com/\n6. https://lore.kernel.org/git/20221119025701.syuscuoqjuqhqsoz@phi/\n7. https://lore.kernel.org/git/20221119034728.m4kxh4tdpof7us7j@phi/\n8. https://lore.kernel.org/git/CAPig+cTTn764ObHJuw8epOtBdTUwocVRV=tLieCa4zf-PGCegw@mail.gmail.com/\n9. https://lore.kernel.org/git/221117.86sfihj3mw.gmgdl@evledraar.gmail.com/\n10. https://lore.kernel.org/git/221123.86a64ia6bx.gmgdl@evledraar.gmail.com/\n\n"},{"id":"468802","messageId":"007001d90b50$8ee3c000$acab4000$@nexbridge.com","threadId":"58921","inReplyTo":"20221208214110.bdu5n65c3fvcxjom@phi","subject":"RE: [PATCH v3 0/2] worktree: Support `--orphan` when creating new worktrees","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2022-12-08T22:00:53Z","receivedAt":"2022-12-08T22:03:04Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On December 8, 2022 4:41 PM, Jacob Abel wrote:\n>Subject: Re: [PATCH v3 0/2] worktree: Support `--orphan` when creating new\n>worktrees\n>\n>Apologies for the delay on the v4 patch. Some unexpected personal stuff has kept\n>me away from working on this. I expect v4 to be out in the next few days.\n>\n>Additionally, I've been doing some reading after writing this reply [1]. I've realised\n>I had a misunderstanding about how HEAD is managed. I don't think it changes the\n>conclusion of the reply (which is that rolling `--orphan` into DWYM could lead to\n>confusing behavior for users) however I think some additional changes might be\n>warranted:\n>\n>* Add some additional text output to `worktree add` when we DWYM to make it\n>  clearer what action we end up making. Could possibly be hidden under a\n>  \"verbose\" flag.\n>* Annotate what HEAD we are looking at (worktree HEAD vs git repo HEAD) in\n>  conditions where this could matter.\n>* Expanding HEAD when it's an invalid ref (instead of just `invalid ref: HEAD`).\n>* Add a hint when using `worktree add`, with a bare git repo, HEAD points to an\n>  invalid ref, not in a worktree, and other branches exist in the repo. The hint\n>  would suggest using `git branch -m <branch>` to change the HEAD to an existing\n>  branch.\n>* Add a hint when there are no local branches and the user is trying to create a\n>  worktree off a local branch which has a remote counterpart.\n>\n>I don't necessarily think any of these changes should hold up this patchset but I\n>think they could be worthwhile changes for the future.\n>\n>And in the meantime, below are the anticipated changes for the next revision. Let\n>me know if it looks like I've forgotten anything.\n>\n>Anticipated changes from v3:\n>  * Fix mistake in SYNOPSIS and `--help`. Patch for this change can be found\n>    in [2], by courtesy of Ævar Arnfjörð Bjarmason.\n>  * Collapsed sequential if statements into if-else chain & simplified\n>    conditions as requested in [2].\n>  * Simplified tests for mutually exclusive options and removed duplicate\n>    `-B/--detach` test case. Patch for this change can be found in [3],\n>    by courtesy of Ævar Arnfjörð Bjarmason.\n>  * Remove references to `git-switch`. Behavior is now explained fully in docs\n>    instead. Changes to the docs suggested in [4], by courtesy of Eric Sunshine.\n>  * Updated test case to use `test_path_is_missing` instead of `! test -d` [5].\n>  * Updated signature for `make_worktree_orphan()` and changed\n>    `const char *orphan_branch` in `struct add_opts` to `int orphan` (boolean)\n>    to simplify the patch and maintain consistency with other flags [6].\n>  * Added `advise()` to common cases where `--orphan` is desired [7] to address\n>    concerns brought up in [8][9]. Slight change from `HEAD` to `branch` as\n>    `HEAD` causes existing behavior to break.\n>  * Added tests to verify `--lock` and `--reason` work properly with\n>    the newly added `--orphan` flag.\n>  * Added tests to verify that the orphan advise [7] is emitted only at the\n>    proper times.\n>  * Added the new advice to the docs, advice.c/h, and switched to use\n>    `advise_if_enabled()` as requested in [10].\n>  * Added tests to verify the changes [7] do not interfere with existing\n>    behavior. ex: creating a worktree from a remote branch when HEAD is\n>    an orphan.\n>\n>1. https://lore.kernel.org/git/20221123042052.t42jmsqjxgx2k3th@phi/\n>2. https://lore.kernel.org/git/221115.86edu3kfqz.gmgdl@evledraar.gmail.com/\n>3. https://lore.kernel.org/git/221116.86a64rkdcj.gmgdl@evledraar.gmail.com/\n>4.\n>https://lore.kernel.org/git/CAPig+cQiyd9yGE_XpPZmzLQnNDMypnrEgkV7nqRZZn\n>3j6E0APQ@mail.gmail.com/\n>5. https://lore.kernel.org/git/221115.86iljfkjjo.gmgdl@evledraar.gmail.com/\n>6. https://lore.kernel.org/git/20221119025701.syuscuoqjuqhqsoz@phi/\n>7. https://lore.kernel.org/git/20221119034728.m4kxh4tdpof7us7j@phi/\n>8.\n>https://lore.kernel.org/git/CAPig+cTTn764ObHJuw8epOtBdTUwocVRV=tLieCa4zf-\n>PGCegw@mail.gmail.com/\n>9. https://lore.kernel.org/git/221117.86sfihj3mw.gmgdl@evledraar.gmail.com/\n>10. https://lore.kernel.org/git/221123.86a64ia6bx.gmgdl@evledraar.gmail.com/\n\nI am not sure this is entirely related, but there is a gap in worktree configuration, specifically includeIf that I was working on, but suspended waiting for worktree code to stabilize. Do you have a sense as to whether this might run into this topic?\n\nRegards,\nRandall\n\n"},{"id":"468872","messageId":"20221212003509.t4pucrlxxl5htj62@phi","threadId":"58921","inReplyTo":"007001d90b50$8ee3c000$acab4000$@nexbridge.com","subject":"Re: [PATCH v3 0/2] worktree: Support `--orphan` when creating new worktrees","fromName":"'Jacob Abel'","fromEmail":"jacobabel@nullpo.dev","sentAt":"2022-12-12T00:38:00Z","receivedAt":"2022-12-12T00:38:11Z","isPatch":true,"sender":{"key":"jacobabel@nullpo.dev","avatar":"https://avatars.githubusercontent.com/u/9424043?v=4"},"body":"On 22/12/08 05:00PM, rsbecker@nexbridge.com wrote:\n>\n> I am not sure this is entirely related, but there is a gap in worktree\n> configuration, specifically includeIf that I was working on, but suspended\n> waiting for worktree code to stabilize. Do you have a sense as to whether this\n> might run into this topic?\n>\n> Regards,\n> Randall\n\nI may be mistaken as I'm still pretty new with respect to contributing to git\nbut I don't believe the two should conflict.\n\n"}]}