{"thread":{"id":"48230","subject":"Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","startedAt":"2018-04-05T19:51:18Z","lastAt":"2018-04-06T20:28:29Z","messageCount":6,"participants":["Thierry Moreau","Bryan Turner","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"343894","messageId":"5AC67C43.9080500@connotech.com","threadId":"48230","inReplyTo":null,"subject":"Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Thierry Moreau","fromEmail":"thierry.moreau@connotech.com","sentAt":"2018-04-05T19:42:59Z","receivedAt":"2018-04-05T19:51:18Z","isPatch":false,"sender":{"key":"thierry.moreau@connotech.com","avatar":null},"body":"Dear GIT enthusiasts!\n\nThis ends up with a \"git checkout\" command aborting. A bit frustrating \nat the early stage of GIT learning curve.\n\nMy first goal is to clone repositories locally in order to explore the \nvarious linux kernel versions, with the rich GIT metadata.\n\nThus, I clone:\n\n$  git clone --branch linux-4.16.y \nhttps://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git \nlinux-stable\n$  git -C linux-stable/ branch\n* linux-4.16.y\n\nSo far so good. Then, I want to extract an earlier kernel version into a \ntmp dir:\n\n$  mkdir tmp\n$  git -C linux-stable/ --work-tree $PWD/tmp/ checkout linux-4.15.y\n$  git -C linux-stable/ branch\n* linux-4.15.y\n   linux-4.16.y\n\nI got my extracted 4.15 version but the source repository (index? ...?) \nhas somehow changed. Let me try something silly:\n\n$  git -C linux-stable/ --work-tree $PWD/tmp/ checkout linux-4.14.y\n$  git -C linux-stable/ branch\n* linux-4.14.y\n   linux-4.15.y\n   linux-4.16.y\n\nI indeed switched my extracted version from 4.15 to 4.14, but I am \npuzzled that the local source repository (linux-stable) is modified. \nThen I try to bring it back closer to its original state, just to keep \nthings tidy:\n\n$  git -C linux-stable/ checkout linux-4.16.y\n\nAnd this command aborts, both with Git versions 2.01 and 2.17. Here is \nthe truncated command output:\n\nerror: Your local changes to the following files would be overwritten by \ncheckout:\n\t.gitignore\n\t.mailmap\n\tDocumentation/00-INDEX\n\tDocumentation/ABI/obsolete/sysfs-gpio\n\tDocumentation/ABI/stable/sysfs-bus-vmbus\n\tDocumentation/ABI/stable/sysfs-devices\n\t[... ...]\n\tDocumentation/devicetree/bindings/arm/mediatek/mediatek,vencsys.txt\n\tDocumentation/devicetree/bindings/arm/omap/crossbar.txt\n\tDocumentation/devicetree/bindings/arm/omap/ctrl.txt\n\tDocumentation/devicetree/bindings/arm/realtek.txt\n\tDocumentation/devicetree/bindings/arm/rock\nerror: The following untracked working tree files would be overwritten \nby checkout:\n\tDocumentation/RCU/Design/Memory-Ordering/Tree-RCU-Diagram.html\n\tDocumentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.html\n\tDocumentation/RCU/Design/Memory-Ordering/TreeRCU-callback-invocation.svg\n\tDocumentation/RCU/Design/Memory-Ordering/TreeRCU-callback-registry.svg\n\tDocumentation/RCU/Design/Memory-Ordering/TreeRCU-dyntick.svg\n\t[... ...]\n\tarch/riscv/include/asm/smp.h\n\tarch/riscv/include/asm/spinlock.h\n\tarch/riscv/include/asm/spinlock_types.h\n\tarch/riscv/include/asm/string.h\n\tarch/riscv/include/\nAborting\n\nQuestions:\n=========\n\nIs there a GIT tutorial that begins with my stated goal of an \nextract-only usage of cloned GIT repositories? (Maybe the root cause is \nmy reluctance to learn the more involved GIT usages.)\n\nDoes the above reproducible abort deserve attention?\n\nAny suggestion for my stated goal?\n\nThanks in advance,\n\n- Thierry Moreau\n"},{"id":"343918","messageId":"CAGyf7-E9=Mm1oJdhwHTmg2byrOxMRFVEjmYHCFGqqP8pvK=vJg@mail.gmail.com","threadId":"48230","inReplyTo":"5AC67C43.9080500@connotech.com","subject":"Re: Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2018-04-05T23:18:23Z","receivedAt":"2018-04-05T23:18:29Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Thu, Apr 5, 2018 at 12:42 PM, Thierry Moreau\n<thierry.moreau@connotech.com> wrote:\n> Dear GIT enthusiasts!\n>\n> This ends up with a \"git checkout\" command aborting. A bit frustrating at\n> the early stage of GIT learning curve.\n>\n> My first goal is to clone repositories locally in order to explore the\n> various linux kernel versions, with the rich GIT metadata.\n>\n> Thus, I clone:\n>\n> $  git clone --branch linux-4.16.y\n> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git\n> linux-stable\n> $  git -C linux-stable/ branch\n> * linux-4.16.y\n>\n> So far so good. Then, I want to extract an earlier kernel version into a tmp\n> dir:\n>\n> $  mkdir tmp\n> $  git -C linux-stable/ --work-tree $PWD/tmp/ checkout linux-4.15.y\n> $  git -C linux-stable/ branch\n> * linux-4.15.y\n>   linux-4.16.y\n\nThe documentation for --work-tree says:\n\n--work-tree=<path>\n\nSet the path to the working tree. It can be an absolute path or a path\nrelative to the current working directory. This can also be controlled\nby setting the GIT_WORK_TREE environment variable and the\ncore.worktree configuration variable (see core.worktree in\ngit-config(1) for a more detailed discussion).\n\nSo passing --work-tree tells Git where to store your _files_, but it's\nstill using the same .git directory.\n\nIf your goal is to have worktrees for various versions, that implies\nthe git worktree [1] command might be more along the lines of what\nyou're looking for. An invocation based on above might look like this:\n$ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y\n\nThat should leave linux-4.16.y checked out in linux-stable, while\ncreating a full work tree in $PWD/tmp that has 4.15.y checked out.\n\nNote that worktree is a newer git command. 2.17 has it, but old\nversions like 2.1 won't.\n\n[1] https://git-scm.com/docs/git-worktree\n\nHope this helps!\nBryan\n"},{"id":"343920","messageId":"CAGyf7-GZgTpYXt4s+NURABYLBr8HQAZWxsrpLLVKnsOf2SYcBQ@mail.gmail.com","threadId":"48230","inReplyTo":"CAGyf7-E9=Mm1oJdhwHTmg2byrOxMRFVEjmYHCFGqqP8pvK=vJg@mail.gmail.com","subject":"Re: Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2018-04-05T23:34:45Z","receivedAt":"2018-04-05T23:34:51Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Thu, Apr 5, 2018 at 4:18 PM, Bryan Turner <bturner@atlassian.com> wrote:\n> On Thu, Apr 5, 2018 at 12:42 PM, Thierry Moreau\n> <thierry.moreau@connotech.com> wrote:\n>> Dear GIT enthusiasts!\n>>\n>> This ends up with a \"git checkout\" command aborting. A bit frustrating at\n>> the early stage of GIT learning curve.\n>>\n>> My first goal is to clone repositories locally in order to explore the\n>> various linux kernel versions, with the rich GIT metadata.\n>>\n>> Thus, I clone:\n>>\n>> $  git clone --branch linux-4.16.y\n>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git\n>> linux-stable\n>> $  git -C linux-stable/ branch\n>> * linux-4.16.y\n>>\n>> So far so good. Then, I want to extract an earlier kernel version into a tmp\n>> dir:\n>>\n>> $  mkdir tmp\n>> $  git -C linux-stable/ --work-tree $PWD/tmp/ checkout linux-4.15.y\n>> $  git -C linux-stable/ branch\n>> * linux-4.15.y\n>>   linux-4.16.y\n>\n> The documentation for --work-tree says:\n>\n> --work-tree=<path>\n>\n> Set the path to the working tree. It can be an absolute path or a path\n> relative to the current working directory. This can also be controlled\n> by setting the GIT_WORK_TREE environment variable and the\n> core.worktree configuration variable (see core.worktree in\n> git-config(1) for a more detailed discussion).\n>\n> So passing --work-tree tells Git where to store your _files_, but it's\n> still using the same .git directory.\n>\n> If your goal is to have worktrees for various versions, that implies\n> the git worktree [1] command might be more along the lines of what\n> you're looking for. An invocation based on above might look like this:\n> $ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y\n\nApologies, I didn't mean to have the \"checkout\" in that.\n$ git -C linux-stable/ worktree add $PWD/tmp/ linux-4.15.y\n\n>\n> That should leave linux-4.16.y checked out in linux-stable, while\n> creating a full work tree in $PWD/tmp that has 4.15.y checked out.\n>\n> Note that worktree is a newer git command. 2.17 has it, but old\n> versions like 2.1 won't.\n>\n> [1] https://git-scm.com/docs/git-worktree\n>\n> Hope this helps!\n> Bryan\n"},{"id":"343923","messageId":"5AC6C460.7060005@connotech.com","threadId":"48230","inReplyTo":"CAGyf7-GZgTpYXt4s+NURABYLBr8HQAZWxsrpLLVKnsOf2SYcBQ@mail.gmail.com","subject":"Re: Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Thierry Moreau","fromEmail":"thierry.moreau@connotech.com","sentAt":"2018-04-06T00:50:40Z","receivedAt":"2018-04-06T00:51:47Z","isPatch":false,"sender":{"key":"thierry.moreau@connotech.com","avatar":null},"body":"On 05/04/18 11:34 PM, Bryan Turner wrote:\n> On Thu, Apr 5, 2018 at 4:18 PM, Bryan Turner <bturner@atlassian.com> wrote:\n>>\n>> So passing --work-tree tells Git where to store your _files_, but it's\n>> still using the same .git directory.\n>>\n>> If your goal is to have worktrees for various versions, that implies\n>> the git worktree [1] command might be more along the lines of what\n>> you're looking for. An invocation based on above might look like this:\n>> $ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y\n>\n> Apologies, I didn't mean to have the \"checkout\" in that.\n> $ git -C linux-stable/ worktree add $PWD/tmp/ linux-4.15.y\n>\n>>\n>> That should leave linux-4.16.y checked out in linux-stable, while\n>> creating a full work tree in $PWD/tmp that has 4.15.y checked out.\n>>\n>> Note that worktree is a newer git command. 2.17 has it, but old\n>> versions like 2.1 won't.\n>>\n>> [1] https://git-scm.com/docs/git-worktree\n>>\n>> Hope this helps!\n\nFor sure, it helps! Thanks.\n\n- Thierry\n\n"},{"id":"343999","messageId":"20180406195659.GD11450@sigill.intra.peff.net","threadId":"48230","inReplyTo":"CAGyf7-E9=Mm1oJdhwHTmg2byrOxMRFVEjmYHCFGqqP8pvK=vJg@mail.gmail.com","subject":"Re: Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-04-06T19:56:59Z","receivedAt":"2018-04-06T19:57:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 05, 2018 at 04:18:23PM -0700, Bryan Turner wrote:\n\n> The documentation for --work-tree says:\n> \n> --work-tree=<path>\n> \n> Set the path to the working tree. It can be an absolute path or a path\n> relative to the current working directory. This can also be controlled\n> by setting the GIT_WORK_TREE environment variable and the\n> core.worktree configuration variable (see core.worktree in\n> git-config(1) for a more detailed discussion).\n> \n> So passing --work-tree tells Git where to store your _files_, but it's\n> still using the same .git directory.\n> \n> If your goal is to have worktrees for various versions, that implies\n> the git worktree [1] command might be more along the lines of what\n> you're looking for. An invocation based on above might look like this:\n> $ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y\n\nEverything you've said here is completely accurate. But the original\nreport does make me wonder if we've set up users for failure by\noverloading the term \"worktree\". Clearly it means two very different\nthings in:\n\n  git --work-tree=foo\n\nand\n\n  git worktree add foo\n\nI'm not sure what to do about it at this point, though. :(\n\n-Peff\n"},{"id":"344004","messageId":"5AC7D82A.8050806@connotech.com","threadId":"48230","inReplyTo":"20180406195659.GD11450@sigill.intra.peff.net","subject":"Re: Self-inflicted \"abort\" in a newbie attempt at read-only exploration of a cloned repository?","fromName":"Thierry Moreau","fromEmail":"thierry.moreau@connotech.com","sentAt":"2018-04-06T20:27:22Z","receivedAt":"2018-04-06T20:28:29Z","isPatch":false,"sender":{"key":"thierry.moreau@connotech.com","avatar":null},"body":"On 06/04/18 07:56 PM, Jeff King wrote:\n> On Thu, Apr 05, 2018 at 04:18:23PM -0700, Bryan Turner wrote:\n>\n>> The documentation for --work-tree says:\n>>\n>> --work-tree=<path>\n>>\n>> Set the path to the working tree. It can be an absolute path or a path\n>> relative to the current working directory. This can also be controlled\n>> by setting the GIT_WORK_TREE environment variable and the\n>> core.worktree configuration variable (see core.worktree in\n>> git-config(1) for a more detailed discussion).\n>>\n>> So passing --work-tree tells Git where to store your _files_, but it's\n>> still using the same .git directory.\n>>\n>> If your goal is to have worktrees for various versions, that implies\n>> the git worktree [1] command might be more along the lines of what\n>> you're looking for. An invocation based on above might look like this:\n>> $ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y\n>\n> Everything you've said here is completely accurate. But the original\n> report does make me wonder if we've set up users for failure by\n> overloading the term \"worktree\". Clearly it means two very different\n> things in:\n>\n>    git --work-tree=foo\n>\n> and\n>\n>    git worktree add foo\n>\n> I'm not sure what to do about it at this point, though. :(\n>\n\nThe documentation for 'git worktree add' was adequate for my problem \nsolving process. My difficulty occurred because I used an earlier GIT \nversion. The terminology overloading might not be a big issue.\n\nRegards,\n\n- Thierry\n\n"}]}