{"thread":{"id":"11959","subject":"StGIT: Trouble adding files to non-topmost patch","startedAt":"2008-02-08T04:30:24Z","lastAt":"2008-02-08T08:33:55Z","messageCount":2,"participants":["Matt McCutchen","Karl Hasselström"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"67891","messageId":"1202445024.27753.54.camel@localhost","threadId":"11959","inReplyTo":null,"subject":"StGIT: Trouble adding files to non-topmost patch","fromName":"Matt McCutchen","fromEmail":"matt@mattmccutchen.net","sentAt":"2008-02-08T04:30:24Z","receivedAt":"2008-02-08T04:30:24Z","isPatch":false,"sender":{"key":"matt@mattmccutchen.net","avatar":"https://avatars.githubusercontent.com/u/8885753?v=4"},"body":"I keep a copy of the Eclipse source code checked out from CVS, and I use\nStGIT to manage both long-term and short-term local changes to the\nsource.  (StGIT is so much nicer than shuffling patches by hand!)  My\nStGIT patch stack is based on an empty tree; the bottom-most patch\n(named \"origin\") contains the original Eclipse source and the others\ncontain my changes.  I use \"cvs up\" to pull updates from Eclipse's\nrepository, a custom script to load the updates into the git index, and\n\"stg refresh -p origin\" to load them into the patch stack.\n\nHowever, when the Eclipse developers create new files, I can't seem to\nadd them to \"origin\" this way.  After my index-updating script runs,\n\"git status\" shows that the new files have been added to the index,\nbut ﻿\"stg refresh -p origin\" doesn't change \"origin\" and the new files\nshow as untracked again.  Some investigation revealed that the problem\nis that, whenever StGIT pops a patch (including as part of \"stg refresh\n-p\"), it resets the index.  Here's the relevant code in git.py:\n\n        def switch(tree_id, keep = False):\n            \"\"\"Switch the tree to the given id\n            \"\"\"\n            if keep:\n                # only update the index while keeping the local changes\n                GRun('read-tree', tree_id).run()\n\nThis behavior doesn't affect changes and deletions since StGIT\nautomatically adds them back to the index, but it completely controverts\nadditions.  Please provide a direct way to add files to non-topmost\npatches.\n\nOne could argue that my setup is bad.  I could work around the problem\nby loading updates using a separate tree holding a clean CVS checkout,\nbut then it is less convenient to check out additional modules.  I could\ndownload and import the entire CVS history with git-cvsimport, but that\nwould take an enormous amount of time and disk space.  I'm open to\npractical suggestions for a better setup, but I do hope the problem with\nStGIT gets fixed.\n\n[I am off-list; please include me in replies.]\n\nMatt\n"},{"id":"67910","messageId":"20080208083355.GA8854@diana.vm.bytemark.co.uk","threadId":"11959","inReplyTo":"1202445024.27753.54.camel@localhost","subject":"Re: StGIT: Trouble adding files to non-topmost patch","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-08T08:33:55Z","receivedAt":"2008-02-08T08:33:55Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-07 23:30:24 -0500, Matt McCutchen wrote:\n\n> I keep a copy of the Eclipse source code checked out from CVS, and I\n> use StGIT to manage both long-term and short-term local changes to\n> the source. (StGIT is so much nicer than shuffling patches by hand!)\n> My StGIT patch stack is based on an empty tree; the bottom-most\n> patch (named \"origin\") contains the original Eclipse source and the\n> others contain my changes. I use \"cvs up\" to pull updates from\n> Eclipse's repository, a custom script to load the updates into the\n> git index, and \"stg refresh -p origin\" to load them into the patch\n> stack.\n>\n> However, when the Eclipse developers create new files, I can't seem\n> to add them to \"origin\" this way. After my index-updating script\n> runs, \"git status\" shows that the new files have been added to the\n> index, but ???\"stg refresh -p origin\" doesn't change \"origin\" and\n> the new files show as untracked again. Some investigation revealed\n> that the problem is that, whenever StGIT pops a patch (including as\n> part of \"stg refresh -p\"), it resets the index. Here's the relevant\n> code in git.py:\n>\n>     def switch(tree_id, keep = False):\n>         \"\"\"Switch the tree to the given id\n>         \"\"\"\n>         if keep:\n>             # only update the index while keeping the local changes\n>             GRun('read-tree', tree_id).run()\n>\n> This behavior doesn't affect changes and deletions since StGIT\n> automatically adds them back to the index, but it completely\n> controverts additions. Please provide a direct way to add files to\n> non-topmost patches.\n\nThanks for the detailed bug report!\n\nUnfortunately, I don't have time to fix it immediately, so I put it in\nthe bug tracker: https://gna.org/bugs/index.php?11009.\n\n> One could argue that my setup is bad. I could work around the\n> problem by loading updates using a separate tree holding a clean CVS\n> checkout, but then it is less convenient to check out additional\n> modules. I could download and import the entire CVS history with\n> git-cvsimport, but that would take an enormous amount of time and\n> disk space. I'm open to practical suggestions for a better setup,\n> but I do hope the problem with StGIT gets fixed.\n\nWhat I'd do if I were you is to have a regular git branch just for\nimporting the upstream, and make a new commit there whenever I run\n'cvs up'. And then rebase my local StGit patch stack on top of that\nbranch. Which would conveniently side-step the StGit bug ... ;-)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}