* 'pu' branch for StGIT @ 2007-08-07 2:20 Karl Hasselström 2007-08-07 2:38 ` Shawn O. Pearce 2007-08-08 5:03 ` Pavel Roskin 0 siblings, 2 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-07 2:20 UTC (permalink / raw) To: git; +Cc: Pavel Roskin, Catalin Marinas, Yann Dirson So I finally got my act together and published a 'pu'-like branch for StGIT. Get it at git://repo.or.cz/stgit/kha.git; gitweb at http://repo.or.cz/w/stgit/kha.git. The idea is that I grab the StGIT patches that are posted to the list, put each series in its own topic branch (based on Catalin's master), and publish a merge of them. _After_ having made sure that the test suite passes, naturally. It then becomes much easier for everyone to test these patches. This should lessen the pressure on Catalin to include patches in his master branch as soon as possible, which should in turn reduce the number of reverts in the official history. Here's what's currently in there: Karl Hasselström (8): Teach StGIT about core.excludesfile New test: make sure that popping doesn't change patch order Verify patch status during the test Make use of the get_patch() utility function Compute patch appliedness from commit DAG Test the new DAG appliedness machinery Fix bash completion after the DAG appliedness patch Speed up the appliedness test Pavel Roskin (1): Add support for SMTP over Transport Layer Security (TLS) Yann Dirson (7): Include contrib scripts in the release tarball. Improve stg-fold-files-from doc. New contrib scripts: stg-dispatch and stg-show. Add -O flag to stg-fold-files-from. Add a no-act flag to stg-dispatch and stg-fold-file-from. Provide file completion for add/resolved/refresh based on status. Fixed completion function hardcoding .git/. (Does anyone know the incantation for Junio's status mails, with topic branches grouped nicely?) NOTE: The DAG appliedness patch series is in there. They will upgrade the format of any stgit branch they touch, and there's no convenient way to change it back if you change your mind. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-07 2:20 'pu' branch for StGIT Karl Hasselström @ 2007-08-07 2:38 ` Shawn O. Pearce 2007-08-08 5:03 ` Pavel Roskin 1 sibling, 0 replies; 28+ messages in thread From: Shawn O. Pearce @ 2007-08-07 2:38 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Pavel Roskin, Catalin Marinas, Yann Dirson Karl Hasselstrm <kha@treskal.com> wrote: > (Does anyone know the incantation for Junio's status mails, with topic > branches grouped nicely?) Look at his todo branch; one of those scripts does the magic. Start with todo:WC, apparently it calls todo:git-topic.perl. Junio checks out the todo branch in a Meta/ subdirectory. :-) -- Shawn. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-07 2:20 'pu' branch for StGIT Karl Hasselström 2007-08-07 2:38 ` Shawn O. Pearce @ 2007-08-08 5:03 ` Pavel Roskin 2007-08-08 9:20 ` Karl Hasselström 1 sibling, 1 reply; 28+ messages in thread From: Pavel Roskin @ 2007-08-08 5:03 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Catalin Marinas, Yann Dirson On Tue, 2007-08-07 at 04:20 +0200, Karl Hasselström wrote: > So I finally got my act together and published a 'pu'-like branch for > StGIT. Get it at git://repo.or.cz/stgit/kha.git; gitweb at > http://repo.or.cz/w/stgit/kha.git. Just a word of warning. This version converts all branches to version 3, so that the standard StGIT won't work with them anymore. Also, "stg import" commits the patch, which seems wrong to me. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-08 5:03 ` Pavel Roskin @ 2007-08-08 9:20 ` Karl Hasselström 2007-08-08 21:39 ` Karl Hasselström 0 siblings, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-08 9:20 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-08 01:03:53 -0400, Pavel Roskin wrote: > On Tue, 2007-08-07 at 04:20 +0200, Karl Hasselström wrote: > > > So I finally got my act together and published a 'pu'-like branch > > for StGIT. Get it at git://repo.or.cz/stgit/kha.git; gitweb at > > http://repo.or.cz/w/stgit/kha.git. > > Just a word of warning. This version converts all branches to > version 3, so that the standard StGIT won't work with them anymore. I believe I said (or tried to say) as much towards the end of my mail. Thanks for trying it out though! It seems my evil master plan is working. :-) > Also, "stg import" commits the patch, which seems wrong to me. Hmm, I hadn't noticed. That would be an unintended side-effect of the DAG patches, presumably. I'll look into it tonight. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-08 9:20 ` Karl Hasselström @ 2007-08-08 21:39 ` Karl Hasselström 2007-08-08 22:18 ` Pavel Roskin 0 siblings, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-08 21:39 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-08 11:20:27 +0200, Karl Hasselström wrote: > On 2007-08-08 01:03:53 -0400, Pavel Roskin wrote: > > > Also, "stg import" commits the patch, which seems wrong to me. > > Hmm, I hadn't noticed. That would be an unintended side-effect of > the DAG patches, presumably. I'll look into it tonight. I can't reproduce. (Using master of git://repo.or.cz/stgit/kha.git.) The last subtest of t1800 actually tests that a mailbox was imported as a series of patches, and that works fine for me (the other subtests don't make sure that a patch was created; they just verify that we got the right tree). Furthermore, the following works for me: kha@yoghurt:~/stgit/t> ./t1800-import.sh * ok 1: Initialize the StGIT repository * ok 2: Apply a patch created with "git diff" * ok 3: Apply a patch created with GNU diff * ok 4: Apply a patch created with "stg export" * ok 5: Apply a patch from an 8bit-encoded e-mail * ok 6: Apply a patch from a QP-encoded e-mail * ok 7: Apply several patches from an mbox file * passed all 7 test(s) kha@yoghurt:~/stgit/t> cd trash/ kha@yoghurt:~/stgit/t/trash> ls foo.txt kha@yoghurt:~/stgit/t/trash> PATH=/home/kha/stgit:$PATH stg series -d kha@yoghurt:~/stgit/t/trash> PATH=/home/kha/stgit:$PATH stg import -m ../t1800-import/email-qp Checking for changes in the working directory ... done Finding uninteresting commits ... done Importing patch "email-qp" ... done Now at patch "email-qp" kha@yoghurt:~/stgit/t/trash> PATH=/home/kha/stgit:$PATH stg series -d > email-qp | test patch So a patch is definitely created. Could you describe in more detail exactly what you do to make it fail? -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-08 21:39 ` Karl Hasselström @ 2007-08-08 22:18 ` Pavel Roskin 2007-08-08 23:23 ` Karl Hasselström 0 siblings, 1 reply; 28+ messages in thread From: Pavel Roskin @ 2007-08-08 22:18 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Catalin Marinas, Yann Dirson Hello, Karl! On Wed, 2007-08-08 at 23:39 +0200, Karl Hasselström wrote: > > Hmm, I hadn't noticed. That would be an unintended side-effect of > > the DAG patches, presumably. I'll look into it tonight. > > I can't reproduce. OK, it's trickier. There are some bad patch names that don't get imported properly. In particular, patches ending with ".diff" are committed after import. Try changing this in the testsuite: diff --git a/t/t1800-import.sh b/t/t1800-import.sh index 8c8c9a0..6cd3cdb 100755 --- a/t/t1800-import.sh +++ b/t/t1800-import.sh @@ -15,7 +15,7 @@ test_expect_success \ test_expect_success \ 'Apply a patch created with "git diff"' \ ' - stg import ../t1800-import/git-diff && + stg import -n git.diff ../t1800-import/git-diff && [ $(git cat-file -p $(stg id) \ | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && stg delete .. And now run the test $ ./t1800-import.sh -i -v ... Importing patch "git.diff" ... done No patches applied The mainline StGIT is OK. -- Regards, Pavel Roskin ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-08 22:18 ` Pavel Roskin @ 2007-08-08 23:23 ` Karl Hasselström 2007-08-09 0:10 ` Pavel Roskin 0 siblings, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-08 23:23 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-08 18:18:34 -0400, Pavel Roskin wrote: > On Wed, 2007-08-08 at 23:39 +0200, Karl Hasselström wrote: > > > I can't reproduce. > > OK, it's trickier. There are some bad patch names that don't get > imported properly. In particular, patches ending with ".diff" are > committed after import. Ah, sneaky. And it turns out to be not a problem with import, but a problem with dots in patch names. It's just that import is the only place those are typically created. It was all due to a sloppy regexp. This is the fix: diff --git a/stgit/stack.py b/stgit/stack.py index 4186ba9..c403f51 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -391,11 +391,11 @@ def read_refs(branch): given branch. The patches are listed by name; the branch head is None.""" refs = {} - patchpat = re.compile(r'^refs/patches/%s/([^\.]+)$' % branch) + patchpat = re.compile(r'^refs/patches/%s/(.+)$' % branch) for line in git._output_lines('git-show-ref'): sha1, ref = line.split() m = re.match(patchpat, ref) - if m: + if m and not m.group(1).endswith('.log'): refs[m.group(1)] = sha1 elif ref == 'refs/heads/%s' % branch: refs[None] = sha1 Thanks for taking the time to track this down -- with the detailed symptoms you gave, I found it in no time. I've pushed an updated series (as well as the other patches I've posted tonight) to git://repo.or.cz/stgit/kha.git. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-08 23:23 ` Karl Hasselström @ 2007-08-09 0:10 ` Pavel Roskin 2007-08-09 7:38 ` Karl Hasselström 0 siblings, 1 reply; 28+ messages in thread From: Pavel Roskin @ 2007-08-09 0:10 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Catalin Marinas, Yann Dirson Quoting Karl Hasselström <kha@treskal.com>: > It was all due to a sloppy regexp. This is the fix: Thank you! And by the way, please fix the description of the commit where you added --smtp-server option. You added it to "stg mail", not to "stg add". -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 0:10 ` Pavel Roskin @ 2007-08-09 7:38 ` Karl Hasselström 2007-08-09 13:24 ` Pavel Roskin 0 siblings, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-09 7:38 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-08 20:10:03 -0400, Pavel Roskin wrote: > Quoting Karl Hasselström <kha@treskal.com>: > > > It was all due to a sloppy regexp. This is the fix: > > Thank you! You did all the work on this one. > And by the way, please fix the description of the commit where you > added --smtp-server option. You added it to "stg mail", not to "stg > add". Mmm, thanks. Will fix tonight. I take it this all means you're actually using my branch? What's your opinion on its usefulness? -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 7:38 ` Karl Hasselström @ 2007-08-09 13:24 ` Pavel Roskin 2007-08-09 14:18 ` Karl Hasselström 2007-08-09 21:31 ` 'pu' branch for StGIT Catalin Marinas 0 siblings, 2 replies; 28+ messages in thread From: Pavel Roskin @ 2007-08-09 13:24 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Catalin Marinas, Yann Dirson On Thu, 2007-08-09 at 09:38 +0200, Karl Hasselström wrote: > I take it this all means you're actually using my branch? What's your > opinion on its usefulness? Well, I tried it, and then ran a script to update all local repositories. It converted everything to "version 3", so I'm sort of stuck with it. If the "version 3" code is not committed to the mainline StGIT, I'll have to convert my repositories back or even re-fetch them. I have noticed two problems so far, but I cannot tell is they are specific to the "pu" branch. 1) Undead patches. StGIT finds a patch I deleted long ago and shows it as unapplied. It cannot be deleted by "stg delete" because some files are missing. $ stg delete at76_usb Traceback (most recent call last): File "/home/proski/bin/stg", line 43, in <module> main() File "home/proski/lib/python2.5/site-packages/stgit/main.py", line 284, in main File "home/proski/lib/python2.5/site-packages/stgit/commands/delete.py", line 76, in func File "home/proski/lib/python2.5/site-packages/stgit/stack.py", line 1227, in delete_patch File "home/proski/lib/python2.5/site-packages/stgit/stack.py", line 1209, in delete_patch_data File "home/proski/lib/python2.5/site-packages/stgit/stack.py", line 160, in delete OSError: [Errno 2] No such file or directory: '.git/patches/wireless-dev/patches/at76_usb' That's Linux repository, and I'm on wireless-dev branch. There is a file .git/patches/wireless-dev/trash/at76_usb containing "None". There are two other files in that directory, but they have some SHA1 hashes. There is also a file .git/patches/wireless-dev/patchorder, which contains "at76_usb". I was updating the repository by "stg pull", there were two patches, "at76_usb" being first. It couldn't be merged, so I deleted it. I deleted the other patch as well, since I new it was applied upstream. After another "stg pull" at76_usb became "undead". I cannot reproduce it on another repository. 2) Invisible branches. StGIT stopped showing other branches. It's always showing the same branch, although it can switch to other branches: [proski@dv linux-2.6]$ stg branch --list Available branches: > s wireless-dev | [proski@dv linux-2.6]$ stg branch wireless-2.6 Checking for changes in the working directory ... done Switching to branch "wireless-2.6" ... done [proski@dv linux-2.6]$ stg branch --list Available branches: s wireless-dev | [proski@dv linux-2.6]$ stg branch linus Checking for changes in the working directory ... done Switching to branch "linus" ... done [proski@dv linux-2.6]$ stg branch --list Available branches: s wireless-dev | [proski@dv linux-2.6]$ stg init stg init: linus already initialized [proski@dv linux-2.6]$ -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 13:24 ` Pavel Roskin @ 2007-08-09 14:18 ` Karl Hasselström 2007-08-09 14:24 ` Karl Hasselström 2007-08-09 16:33 ` Pavel Roskin 2007-08-09 21:31 ` 'pu' branch for StGIT Catalin Marinas 1 sibling, 2 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-09 14:18 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-09 09:24:43 -0400, Pavel Roskin wrote: > On Thu, 2007-08-09 at 09:38 +0200, Karl Hasselström wrote: > > > I take it this all means you're actually using my branch? What's > > your opinion on its usefulness? > > Well, I tried it, and then ran a script to update all local > repositories. It converted everything to "version 3", so I'm sort of > stuck with it. If the "version 3" code is not committed to the > mainline StGIT, I'll have to convert my repositories back or even > re-fetch them. Thanks for the vote of confidence. :-) You should be able to do something like $ stg applied > .git/patches/branch/applied $ stg unapplied > .git/patches/branch/unapplied and then manually change the version from 3 to 2, and be ready to go. I haven't tested this, though! > I have noticed two problems so far, but I cannot tell is they are > specific to the "pu" branch. > > 1) Undead patches. I saw the same problem today. I haven't had time to look into it, but I believe it's due to stgit trying to directly modify files under .git/refs instead of using git-update-ref, which breaks with packed refs. The DAG patches rely much more on the refs, so the bug is more severe in that case. https://gna.org/bugs/?9710 > There is also a file .git/patches/wireless-dev/patchorder, which > contains "at76_usb". The patchorder file should be harmless. It's only used to determine patch order for those cases where the DAG information isn't sufficient. (That is, for unapplied patches.) It's strictly advisory, and _not_ used to determine which patches exist. > I was updating the repository by "stg pull", there were two patches, > "at76_usb" being first. It couldn't be merged, so I deleted it. I > deleted the other patch as well, since I new it was applied > upstream. After another "stg pull" at76_usb became "undead". Until this is fixed, you can use git-show-ref and git-update-ref to manually delete the offending ref. That fixed the problem for me. > 2) Invisible branches. I haven't seen this problem at all -- in my repositories, "stg branch -l" just works. Will try to reproduce (hopefully tonight). Do you have a recepie on how to reproduce this from scratch? -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 14:18 ` Karl Hasselström @ 2007-08-09 14:24 ` Karl Hasselström 2007-08-09 16:33 ` Pavel Roskin 1 sibling, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-09 14:24 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-09 16:18:48 +0200, Karl Hasselström wrote: > I saw the same problem today. I haven't had time to look into it, > but I believe it's due to stgit trying to directly modify files > under .git/refs instead of using git-update-ref, which breaks with > packed refs. The DAG patches rely much more on the refs, so the bug > is more severe in that case. git-gc started packing refs by default in late May. That's probably what's caused it to surface. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 14:18 ` Karl Hasselström 2007-08-09 14:24 ` Karl Hasselström @ 2007-08-09 16:33 ` Pavel Roskin 2007-08-09 20:39 ` Karl Hasselström 1 sibling, 1 reply; 28+ messages in thread From: Pavel Roskin @ 2007-08-09 16:33 UTC (permalink / raw) To: Karl Hasselström; +Cc: git, Catalin Marinas, Yann Dirson On Thu, 2007-08-09 at 16:18 +0200, Karl Hasselström wrote: > You should be able to do something like > > $ stg applied > .git/patches/branch/applied > $ stg unapplied > .git/patches/branch/unapplied > > and then manually change the version from 3 to 2, and be ready to go. > I haven't tested this, though! That seems to work. Thank you! "branch" should be substituted with the current branch, of course. > > I have noticed two problems so far, but I cannot tell is they are > > specific to the "pu" branch. > > > > 1) Undead patches. > > I saw the same problem today. I haven't had time to look into it, but > I believe it's due to stgit trying to directly modify files under > .git/refs instead of using git-update-ref, which breaks with packed > refs. The DAG patches rely much more on the refs, so the bug is more > severe in that case. > > https://gna.org/bugs/?9710 I've attached the test case to that bug. You are right, git-gc is involved. > > 2) Invisible branches. > > I haven't seen this problem at all -- in my repositories, "stg branch > -l" just works. Will try to reproduce (hopefully tonight). Do you have > a recepie on how to reproduce this from scratch? It's a problem with git-gc too! Just clone some repository and run "stg branch -l" in it. It with show master. Run git-gc, and "stg branch -l" will show "No branches". I see that in my Linux repository there are files in .git/refs/remotes/wireless-dev but not in other directories under .git/refs/remotes/ -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 16:33 ` Pavel Roskin @ 2007-08-09 20:39 ` Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 0/2] Teach StGIT to survive git-gc Karl Hasselström 0 siblings, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-09 20:39 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson On 2007-08-09 12:33:30 -0400, Pavel Roskin wrote: > On Thu, 2007-08-09 at 16:18 +0200, Karl Hasselström wrote: > > > You should be able to do something like > > > > $ stg applied > .git/patches/branch/applied > > $ stg unapplied > .git/patches/branch/unapplied > > > > and then manually change the version from 3 to 2, and be ready to > > go. I haven't tested this, though! > > That seems to work. Thank you! What? You mean I didn't forget any step? ;-) > "branch" should be substituted with the current branch, of course. I was just too lazy to type the brackets. Or maybe I'm just evil and _want_ the lock-in effect. Who knows? :-) > > I saw the same problem today. > > > > https://gna.org/bugs/?9710 > > I've attached the test case to that bug. You are right, git-gc is > involved. Thanks. > > I haven't seen this problem at all -- in my repositories, "stg > > branch -l" just works. Will try to reproduce (hopefully tonight). > > Do you have a recepie on how to reproduce this from scratch? > > It's a problem with git-gc too! Just clone some repository and run > "stg branch -l" in it. It with show master. Run git-gc, and "stg > branch -l" will show "No branches". Well, well! In that case, I'm off to kill two birds with one stone! > I see that in my Linux repository there are files in > .git/refs/remotes/wireless-dev but not in other directories under > .git/refs/remotes/ Presumably the only nonpacked refs are the ones that have been updated after the last ref packing. Or however it works. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* [StGIT PATCH 0/2] Teach StGIT to survive git-gc 2007-08-09 20:39 ` Karl Hasselström @ 2007-08-10 3:23 ` Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 1/2] New test: make sure that StGIT can handle packed refs Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 2/2] Don't touch ref files manually Karl Hasselström 0 siblings, 2 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-10 3:23 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson ... and here's the fix, and a test. Note that while this is fairly intrusive (and took quite some time to debug), it's also a rather high-priority fix, since git-gc will break StGIT just fine even without the DAG patches. You can also get this from git://repo.or.cz/stgit/kha.git. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* [StGIT PATCH 1/2] New test: make sure that StGIT can handle packed refs 2007-08-10 3:23 ` [StGIT PATCH 0/2] Teach StGIT to survive git-gc Karl Hasselström @ 2007-08-10 3:23 ` Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 2/2] Don't touch ref files manually Karl Hasselström 1 sibling, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-10 3:23 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson It currently can't, which is why this test is needed. The situation has recently taken a turn for the worse, since git-gc nowadays packs refs by default. --- t/t1004-pack-ref.sh | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/t/t1004-pack-ref.sh b/t/t1004-pack-ref.sh new file mode 100755 index 0000000..a5eb17c --- /dev/null +++ b/t/t1004-pack-ref.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Copyright (c) 2007 Karl Hasselström +# + +test_description='Test that StGIT can handle packed refs' + +. ./test-lib.sh +stg init + +test_expect_success \ + 'Pack refs and make sure that we can still see them' ' + stg branch -c foo && + [ $(stg branch -l | tee /dev/stderr | wc -l) -eq 2 ] && + git pack-refs --all && + [ $(stg branch -l | tee /dev/stderr | wc -l) -eq 2 ] +' + +test_expect_success \ + 'Try to delete a branch whose ref has been packed' ' + stg branch -d master +' + +test_done ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-10 3:23 ` [StGIT PATCH 0/2] Teach StGIT to survive git-gc Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 1/2] New test: make sure that StGIT can handle packed refs Karl Hasselström @ 2007-08-10 3:23 ` Karl Hasselström 2007-08-21 13:23 ` Catalin Marinas 1 sibling, 1 reply; 28+ messages in thread From: Karl Hasselström @ 2007-08-10 3:23 UTC (permalink / raw) To: Pavel Roskin; +Cc: git, Catalin Marinas, Yann Dirson Messing with files manually doesn't work if the refs are packed. The officially preferred way is to use git-update-ref, git-show-ref, et.al. So do that. As a consequence of this, we have some small behavior changes: * We used to not leave empty directories behind in the refs tree. But now that's all in the hands of git-update-ref, which does leave them behind. Tests that assumed the old behavior have been fixed. * We (that is, git-show-ref) no longer distinguish between a ref that doesn't exist and a ref that contains garbage. So the tests that assumed we'd fail when encountering a spurious ref with garbage in it have had to go through attitude readjustment. Signed-off-by: Karl Hasselström <kha@treskal.com> --- stgit/commands/branch.py | 5 +-- stgit/commands/common.py | 4 +- stgit/git.py | 79 ++++++++++++++++++++++++++------------------ stgit/stack.py | 70 +++++++++++++++++++++------------------ t/t0001-subdir-branches.sh | 7 ++-- t/t1000-branch-create.sh | 30 +---------------- t/t1001-branch-rename.sh | 2 + 7 files changed, 91 insertions(+), 106 deletions(-) diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py index 2fb5f59..75a9046 100644 --- a/stgit/commands/branch.py +++ b/stgit/commands/branch.py @@ -208,10 +208,7 @@ def func(parser, options, args): if len(args) != 0: parser.error('incorrect number of arguments') - branches = [] - basepath = os.path.join(basedir.get(), 'refs', 'heads') - for path, files, dirs in walk_tree(basepath): - branches += [os.path.join(path, f) for f in files] + branches = git.get_heads() branches.sort() if branches: diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 14dbf67..dddee85 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -42,9 +42,7 @@ def parse_rev(rev): """Parse a revision specification into its patchname@branchname//patch_id parts. If no branch name has a slash in it, also accept / instead of //.""" - files, dirs = list_files_and_dirs(os.path.join(basedir.get(), - 'refs', 'heads')) - if len(dirs) != 0: + if '/' in ''.join(git.get_heads()): # We have branch names with / in them. branch_chars = r'[^@]' patch_id_mark = r'//' diff --git a/stgit/git.py b/stgit/git.py index 72bf889..832a2dc 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -270,6 +270,13 @@ def local_changes(verbose = True): """ return len(tree_status(verbose = verbose)) != 0 +def get_heads(): + heads = [] + for line in _output_lines(['git-show-ref', '--heads']): + m = re.match('^[0-9a-f]{40} refs/heads/(.+)$', line) + heads.append(m.group(1)) + return heads + # HEAD value cached __head = None @@ -294,14 +301,16 @@ def set_head_file(ref): # head cache flushing is needed since we might have a different value # in the new head __clear_head_cache() - if __run('git-symbolic-ref HEAD', - [os.path.join('refs', 'heads', ref)]) != 0: + if __run('git-symbolic-ref HEAD', ['refs/heads/%s' % ref]) != 0: raise GitException, 'Could not set head to "%s"' % ref +def set_ref(ref, val): + """Point ref at a new commit object.""" + if __run('git-update-ref', [ref, val]) != 0: + raise GitException, 'Could not update %s to "%s".' % (ref, val) + def set_branch(branch, val): - """Point branch at a new commit object.""" - if __run('git-update-ref', [branch, val]) != 0: - raise GitException, 'Could not update %s to "%s".' % (branch, val) + set_ref('refs/heads/%s' % branch, val) def __set_head(val): """Sets the HEAD value @@ -309,7 +318,7 @@ def __set_head(val): global __head if not __head or __head != val: - set_branch('HEAD', val) + set_ref('HEAD', val) __head = val # only allow SHA1 hashes @@ -335,16 +344,15 @@ def rev_parse(git_id): except GitException: raise GitException, 'Unknown revision: %s' % git_id +def ref_exists(ref): + try: + rev_parse(ref) + return True + except GitException: + return False + def branch_exists(branch): - """Existence check for the named branch - """ - branch = os.path.join('refs', 'heads', branch) - for line in _output_lines('git-rev-parse --symbolic --all 2>&1'): - if line.strip() == branch: - return True - if re.compile('[ |/]'+branch+' ').search(line): - raise GitException, 'Bogus branch: %s' % line - return False + return ref_exists('refs/heads/%s' % branch) def create_branch(new_branch, tree_id = None): """Create a new branch in the git repository @@ -371,8 +379,7 @@ def switch_branch(new_branch): if not branch_exists(new_branch): raise GitException, 'Branch "%s" does not exist' % new_branch - tree_id = rev_parse(os.path.join('refs', 'heads', new_branch) - + '^{commit}') + tree_id = rev_parse('refs/heads/%s^{commit}' % new_branch) if tree_id != get_head(): refresh_index() if __run('git-read-tree -u -m', [get_head(), tree_id]) != 0: @@ -383,27 +390,33 @@ def switch_branch(new_branch): if os.path.isfile(os.path.join(basedir.get(), 'MERGE_HEAD')): os.remove(os.path.join(basedir.get(), 'MERGE_HEAD')) +def delete_ref(ref): + if not ref_exists(ref): + raise GitException, '%s does not exist' % ref + sha1 = _output_one_line(['git-show-ref', '-s', ref]) + if __run('git-update-ref -d %s %s' % (ref, sha1)): + raise GitException, 'Failed to delete ref %s' % ref + def delete_branch(name): - """Delete a git branch - """ - if not branch_exists(name): - raise GitException, 'Branch "%s" does not exist' % name - remove_file_and_dirs(os.path.join(basedir.get(), 'refs', 'heads'), - name) + delete_ref('refs/heads/%s' % name) -def rename_branch(from_name, to_name): - """Rename a git branch - """ - if not branch_exists(from_name): - raise GitException, 'Branch "%s" does not exist' % from_name - if branch_exists(to_name): - raise GitException, 'Branch "%s" already exists' % to_name +def rename_ref(from_ref, to_ref): + if not ref_exists(from_ref): + raise GitException, '"%s" does not exist' % from_ref + if ref_exists(to_ref): + raise GitException, '"%s" already exists' % to_ref + sha1 = _output_one_line(['git-show-ref', '-s', from_ref]) + if __run('git-update-ref %s %s %s' % (to_ref, sha1, '0'*40)): + raise GitException, 'Failed to create new ref %s' % to_ref + if __run('git-update-ref -d %s %s' % (from_ref, sha1)): + raise GitException, 'Failed to delete ref %s' % from_ref + +def rename_branch(from_name, to_name): + """Rename a git branch.""" + rename_ref('refs/heads/%s' % from_name, 'refs/heads/%s' % to_name) if get_head_file() == from_name: set_head_file(to_name) - rename(os.path.join(basedir.get(), 'refs', 'heads'), - from_name, to_name) - reflog_dir = os.path.join(basedir.get(), 'logs', 'refs', 'heads') if os.path.exists(reflog_dir) \ and os.path.exists(os.path.join(reflog_dir, from_name)): diff --git a/stgit/stack.py b/stgit/stack.py index a54a3b2..3880a94 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -142,14 +142,16 @@ class StgitObject: class Patch(StgitObject): """Basic patch implementation """ - def __init__(self, name, series_dir, refs_dir): + def __init_refs(self): + self.__top_ref = self.__refs_base + '/' + self.__name + self.__log_ref = self.__top_ref + '.log' + + def __init__(self, name, series_dir, refs_base): self.__series_dir = series_dir self.__name = name self._set_dir(os.path.join(self.__series_dir, self.__name)) - self.__refs_dir = refs_dir - self.__top_ref_file = os.path.join(self.__refs_dir, self.__name) - self.__log_ref_file = os.path.join(self.__refs_dir, - self.__name + '.log') + self.__refs_base = refs_base + self.__init_refs() def create(self): os.mkdir(self._dir()) @@ -160,33 +162,31 @@ class Patch(StgitObject): for f in os.listdir(self._dir()): os.remove(os.path.join(self._dir(), f)) os.rmdir(self._dir()) - os.remove(self.__top_ref_file) - if os.path.exists(self.__log_ref_file): - os.remove(self.__log_ref_file) + git.delete_ref(self.__top_ref) + if git.ref_exists(self.__log_ref): + git.delete_ref(self.__log_ref) def get_name(self): return self.__name def rename(self, newname): olddir = self._dir() - old_top_ref_file = self.__top_ref_file - old_log_ref_file = self.__log_ref_file + old_top_ref = self.__top_ref + old_log_ref = self.__log_ref self.__name = newname self._set_dir(os.path.join(self.__series_dir, self.__name)) - self.__top_ref_file = os.path.join(self.__refs_dir, self.__name) - self.__log_ref_file = os.path.join(self.__refs_dir, - self.__name + '.log') + self.__init_refs() + git.rename_ref(old_top_ref, self.__top_ref) + if git.ref_exists(old_log_ref): + git.rename_ref(old_log_ref, self.__log_ref) os.rename(olddir, self._dir()) - os.rename(old_top_ref_file, self.__top_ref_file) - if os.path.exists(old_log_ref_file): - os.rename(old_log_ref_file, self.__log_ref_file) def __update_top_ref(self, ref): - write_string(self.__top_ref_file, ref) + git.set_ref(self.__top_ref, ref) def __update_log_ref(self, ref): - write_string(self.__log_ref_file, ref) + git.set_ref(self.__log_ref, ref) def update_top_ref(self): top = self.get_top() @@ -358,8 +358,7 @@ class Series(PatchSet): # initialized, but don't touch it if it isn't. self.update_to_current_format_version() - self.__refs_dir = os.path.join(self._basedir(), 'refs', 'patches', - self.get_name()) + self.__refs_base = 'refs/patches/%s' % self.get_name() self.__applied_file = os.path.join(self._dir(), 'applied') self.__unapplied_file = os.path.join(self._dir(), 'unapplied') @@ -416,20 +415,22 @@ class Series(PatchSet): def rm(f): if os.path.exists(f): os.remove(f) + def rm_ref(ref): + if git.ref_exists(ref): + git.delete_ref(ref) # Update 0 -> 1. if get_format_version() == 0: mkdir(os.path.join(branch_dir, 'trash')) patch_dir = os.path.join(branch_dir, 'patches') mkdir(patch_dir) - refs_dir = os.path.join(self._basedir(), 'refs', 'patches', self.get_name()) - mkdir(refs_dir) + refs_base = 'refs/patches/%s' % self.get_name() for patch in (file(os.path.join(branch_dir, 'unapplied')).readlines() + file(os.path.join(branch_dir, 'applied')).readlines()): patch = patch.strip() os.rename(os.path.join(branch_dir, patch), os.path.join(patch_dir, patch)) - Patch(patch, patch_dir, refs_dir).update_top_ref() + Patch(patch, patch_dir, refs_base).update_top_ref() set_format_version(1) # Update 1 -> 2. @@ -441,7 +442,7 @@ class Series(PatchSet): config.set('branch.%s.description' % self.get_name(), desc) rm(desc_file) rm(os.path.join(branch_dir, 'current')) - rm(os.path.join(self._basedir(), 'refs', 'bases', self.get_name())) + rm_ref('refs/bases/%s' % self.get_name()) set_format_version(2) # Make sure we're at the latest version. @@ -458,7 +459,7 @@ class Series(PatchSet): def get_patch(self, name): """Return a Patch object for the given name """ - return Patch(name, self.__patch_dir, self.__refs_dir) + return Patch(name, self.__patch_dir, self.__refs_base) def get_current_patch(self): """Return a Patch object representing the topmost patch, or @@ -580,7 +581,7 @@ class Series(PatchSet): """ if self.is_initialised(): raise StackException, '%s already initialized' % self.get_name() - for d in [self._dir(), self.__refs_dir]: + for d in [self._dir()]: if os.path.exists(d): raise StackException, '%s already exists' % d @@ -593,7 +594,6 @@ class Series(PatchSet): self.create_empty_field('applied') self.create_empty_field('unapplied') - os.makedirs(self.__refs_dir) self._set_field('orig-base', git.get_head()) config.set(self.format_version_key(), str(FORMAT_VERSION)) @@ -606,14 +606,18 @@ class Series(PatchSet): if to_stack.is_initialised(): raise StackException, '"%s" already exists' % to_stack.get_name() + patches = self.get_applied() + self.get_unapplied() + git.rename_branch(self.get_name(), to_name) + for patch in patches: + git.rename_ref('refs/patches/%s/%s' % (self.get_name(), patch), + 'refs/patches/%s/%s' % (to_name, patch)) + git.rename_ref('refs/patches/%s/%s.log' % (self.get_name(), patch), + 'refs/patches/%s/%s.log' % (to_name, patch)) if os.path.isdir(self._dir()): rename(os.path.join(self._basedir(), 'patches'), self.get_name(), to_stack.get_name()) - if os.path.exists(self.__refs_dir): - rename(os.path.join(self._basedir(), 'refs', 'patches'), - self.get_name(), to_stack.get_name()) # Rename the config section config.rename_section("branch.%s" % self.get_name(), @@ -715,9 +719,9 @@ class Series(PatchSet): % self._dir()) try: - os.removedirs(self.__refs_dir) - except OSError: - out.warn('Refs directory %s is not empty' % self.__refs_dir) + git.delete_branch(self.get_name()) + except GitException: + out.warn('Could not delete branch "%s"' % self.get_name()) # Cleanup parent informations # FIXME: should one day make use of git-config --section-remove, diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh index fac6339..1685233 100755 --- a/t/t0001-subdir-branches.sh +++ b/t/t0001-subdir-branches.sh @@ -50,10 +50,11 @@ test_expect_success 'Create patch in slashy branch' \ test_expect_success 'Rename branches' \ 'stg branch --rename master goo/gaa && - test ! -e .git/refs/heads/master && + ! git show-ref --verify --quiet refs/heads/master && stg branch --rename goo/gaa x1/x2/x3/x4 && - test ! -e .git/refs/heads/goo && + ! git show-ref --verify --quiet refs/heads/goo/gaa && stg branch --rename x1/x2/x3/x4 servant && - test ! -e .git/refs/heads/x1' + ! git show-ref --verify --quiet refs/heads/x1/x2/x3/x4 +' test_done diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh index cca5504..e920e93 100755 --- a/t/t1000-branch-create.sh +++ b/t/t1000-branch-create.sh @@ -13,26 +13,9 @@ Exercises the "stg branch" commands. stg init test_expect_success \ - 'Create a spurious refs/patches/ entry' ' - find .git -name foo | xargs rm -rf && - touch .git/refs/patches/foo -' - -test_expect_failure \ - 'Try to create an stgit branch with a spurious refs/patches/ entry' ' - stg branch -c foo -' - -test_expect_success \ - 'Check that no part of the branch was created' ' - test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/patches/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - -test_expect_success \ 'Create a spurious patches/ entry' ' find .git -name foo | xargs rm -rf && - touch .git/patches/foo + mkdir -p .git/patches && touch .git/patches/foo ' test_expect_failure \ @@ -69,15 +52,4 @@ test_expect_success \ touch .git/refs/heads/foo ' -test_expect_failure \ - 'Try to create an stgit branch with an invalid refs/heads/ entry' ' - stg branch -c foo -' - -test_expect_success \ - 'Check that no part of the branch was created' ' - test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" && - ( grep foo .git/HEAD; test $? = 1 ) -' - test_done diff --git a/t/t1001-branch-rename.sh b/t/t1001-branch-rename.sh index 28da15c..4e1ec84 100755 --- a/t/t1001-branch-rename.sh +++ b/t/t1001-branch-rename.sh @@ -26,7 +26,7 @@ test_expect_success \ 'Rename an stgit branch' \ 'stg branch -c buz && stg branch -r foo bar && - test -z `find .git -name foo | tee /dev/stderr` + [ -z $(find .git -type f | grep foo | tee /dev/stderr) ] ' test_done ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-10 3:23 ` [StGIT PATCH 2/2] Don't touch ref files manually Karl Hasselström @ 2007-08-21 13:23 ` Catalin Marinas 2007-08-21 15:58 ` Karl Hasselström 2007-08-21 16:46 ` Karl Hasselström 0 siblings, 2 replies; 28+ messages in thread From: Catalin Marinas @ 2007-08-21 13:23 UTC (permalink / raw) To: Karl Hasselström; +Cc: Pavel Roskin, git, Yann Dirson Hi Karl, On 10/08/07, Karl Hasselström <kha@treskal.com> wrote: > Messing with files manually doesn't work if the refs are packed. The > officially preferred way is to use git-update-ref, git-show-ref, > et.al. So do that. Thanks for this patch. I'll apply it but I have some questions below. > @@ -294,14 +301,16 @@ def set_head_file(ref): > # head cache flushing is needed since we might have a different value > # in the new head > __clear_head_cache() > - if __run('git-symbolic-ref HEAD', > - [os.path.join('refs', 'heads', ref)]) != 0: > + if __run('git-symbolic-ref HEAD', ['refs/heads/%s' % ref]) != 0: > raise GitException, 'Could not set head to "%s"' % ref Why replacing os.path.join with a single string? I think the former is more portable if, in the future, someone will try to run StGIT on Windows (and GIT would be compiled directly, without cygwin). > diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh > index cca5504..e920e93 100755 > --- a/t/t1000-branch-create.sh > +++ b/t/t1000-branch-create.sh > @@ -13,26 +13,9 @@ Exercises the "stg branch" commands. > stg init > > test_expect_success \ > - 'Create a spurious refs/patches/ entry' ' > - find .git -name foo | xargs rm -rf && > - touch .git/refs/patches/foo I haven't tried this test but is there any problem if we keep them? Thanks. -- Catalin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 13:23 ` Catalin Marinas @ 2007-08-21 15:58 ` Karl Hasselström 2007-08-21 16:09 ` Karl Hasselström 2007-08-21 16:12 ` Johannes Sixt 2007-08-21 16:46 ` Karl Hasselström 1 sibling, 2 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-21 15:58 UTC (permalink / raw) To: Catalin Marinas; +Cc: Pavel Roskin, git, Yann Dirson On 2007-08-21 14:23:29 +0100, Catalin Marinas wrote: > On 10/08/07, Karl Hasselström <kha@treskal.com> wrote: > > > Messing with files manually doesn't work if the refs are packed. > > The officially preferred way is to use git-update-ref, > > git-show-ref, et.al. So do that. > > Thanks for this patch. I'll apply it but I have some questions > below. > > > @@ -294,14 +301,16 @@ def set_head_file(ref): > > # head cache flushing is needed since we might have a different value > > # in the new head > > __clear_head_cache() > > - if __run('git-symbolic-ref HEAD', > > - [os.path.join('refs', 'heads', ref)]) != 0: > > + if __run('git-symbolic-ref HEAD', ['refs/heads/%s' % ref]) != 0: > > raise GitException, 'Could not set head to "%s"' % ref > > Why replacing os.path.join with a single string? I think the former > is more portable if, in the future, someone will try to run StGIT on > Windows (and GIT would be compiled directly, without cygwin). Yes, that's the case iff it is a pathname in the file system. But I think forward slashes are used even on Windows in this case -- otherwise too mmuch configuration would have to be changed. This is what I _think_, however; I haven't actually checked. > > diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh > > index cca5504..e920e93 100755 > > --- a/t/t1000-branch-create.sh > > +++ b/t/t1000-branch-create.sh > > @@ -13,26 +13,9 @@ Exercises the "stg branch" commands. > > stg init > > > > test_expect_success \ > > - 'Create a spurious refs/patches/ entry' ' > > - find .git -name foo | xargs rm -rf && > > - touch .git/refs/patches/foo > > I haven't tried this test but is there any problem if we keep them? Yes. This test started to fail after my change. I don't remember exactly, but I think it was git-symbolic-ref actually reading the file, finding no ref there, and ignoring it. So this empty file didn't mess up the machinery anymore, and since this isn't a common usecase anyway, and since this change is to rely on git for all the low-level ref manipulation, I just deleted the test. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 15:58 ` Karl Hasselström @ 2007-08-21 16:09 ` Karl Hasselström 2007-08-21 16:12 ` Johannes Sixt 1 sibling, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-21 16:09 UTC (permalink / raw) To: Catalin Marinas; +Cc: Pavel Roskin, git, Yann Dirson On 2007-08-21 17:58:45 +0200, Karl Hasselström wrote: > On 2007-08-21 14:23:29 +0100, Catalin Marinas wrote: > > > On 10/08/07, Karl Hasselström <kha@treskal.com> wrote: > > > > > diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh > > > index cca5504..e920e93 100755 > > > --- a/t/t1000-branch-create.sh > > > +++ b/t/t1000-branch-create.sh > > > @@ -13,26 +13,9 @@ Exercises the "stg branch" commands. > > > stg init > > > > > > test_expect_success \ > > > - 'Create a spurious refs/patches/ entry' ' > > > - find .git -name foo | xargs rm -rf && > > > - touch .git/refs/patches/foo > > > > I haven't tried this test but is there any problem if we keep > > them? > > Yes. > > This test started to fail after my change. I don't remember exactly, > but I think it was git-symbolic-ref actually reading the file, > finding no ref there, and ignoring it. So this empty file didn't > mess up the machinery anymore, and since this isn't a common usecase > anyway, and since this change is to rely on git for all the > low-level ref manipulation, I just deleted the test. BTW, I just saw that this was explained by the second bullet point in the commit message. :-) -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 15:58 ` Karl Hasselström 2007-08-21 16:09 ` Karl Hasselström @ 2007-08-21 16:12 ` Johannes Sixt 2007-08-21 16:38 ` Karl Hasselström 1 sibling, 1 reply; 28+ messages in thread From: Johannes Sixt @ 2007-08-21 16:12 UTC (permalink / raw) To: Karl Hasselström; +Cc: Pavel Roskin, git, Yann Dirson, Catalin Marinas Karl Hasselström wrote: > On 2007-08-21 14:23:29 +0100, Catalin Marinas wrote: > > On 10/08/07, Karl Hasselström <kha@treskal.com> wrote: > > > @@ -294,14 +301,16 @@ def set_head_file(ref): > > > # head cache flushing is needed since we might have a different value > > > # in the new head > > > __clear_head_cache() > > > - if __run('git-symbolic-ref HEAD', > > > - [os.path.join('refs', 'heads', ref)]) != 0: > > > + if __run('git-symbolic-ref HEAD', ['refs/heads/%s' % ref]) != 0: > > > raise GitException, 'Could not set head to "%s"' % ref > > > > Why replacing os.path.join with a single string? I think the former > > is more portable if, in the future, someone will try to run StGIT on > > Windows (and GIT would be compiled directly, without cygwin). > > Yes, that's the case iff it is a pathname in the file system. But I > think forward slashes are used even on Windows in this case -- > otherwise too mmuch configuration would have to be changed. This is > what I _think_, however; I haven't actually checked. There are some instances where the MinGW port accepts backslashes in ref names, but you are on the safe side with forward slashes. -- Hannes ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 16:12 ` Johannes Sixt @ 2007-08-21 16:38 ` Karl Hasselström 0 siblings, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-21 16:38 UTC (permalink / raw) To: Johannes Sixt; +Cc: Pavel Roskin, git, Yann Dirson, Catalin Marinas On 2007-08-21 18:12:30 +0200, Johannes Sixt wrote: > There are some instances where the MinGW port accepts backslashes in > ref names, but you are on the safe side with forward slashes. This was just what I was expecting. Thanks for the confirmation! -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 13:23 ` Catalin Marinas 2007-08-21 15:58 ` Karl Hasselström @ 2007-08-21 16:46 ` Karl Hasselström 2007-08-21 20:48 ` Karl Hasselström 2007-08-23 14:04 ` Catalin Marinas 1 sibling, 2 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-21 16:46 UTC (permalink / raw) To: Catalin Marinas; +Cc: Pavel Roskin, git, Yann Dirson On 2007-08-21 14:23:29 +0100, Catalin Marinas wrote: > Thanks for this patch. Two things: * The test in your tree has the latin1 form of my name in it, instead of utf8. (I noticed because I got a conflict when I rebased onto your master.) * The test suite now fails on your master (since you've applied just the test and not the fix). Please don't do that; it makes development needlessly hard. (To be fair, this is partly my fault, since I posted the fixin a separate patch. I'll change my ways.) -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 16:46 ` Karl Hasselström @ 2007-08-21 20:48 ` Karl Hasselström 2007-08-23 14:04 ` Catalin Marinas 1 sibling, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-21 20:48 UTC (permalink / raw) To: Catalin Marinas; +Cc: Pavel Roskin, git, Yann Dirson On 2007-08-21 18:46:29 +0200, Karl Hasselström wrote: > * The test in your tree has the latin1 form of my name in it, > instead of utf8. (I noticed because I got a conflict when I > rebased onto your master.) That seems to have happened to the other new test too. -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [StGIT PATCH 2/2] Don't touch ref files manually 2007-08-21 16:46 ` Karl Hasselström 2007-08-21 20:48 ` Karl Hasselström @ 2007-08-23 14:04 ` Catalin Marinas 1 sibling, 0 replies; 28+ messages in thread From: Catalin Marinas @ 2007-08-23 14:04 UTC (permalink / raw) To: Karl Hasselström; +Cc: Pavel Roskin, git, Yann Dirson On 21/08/07, Karl Hasselström <kha@treskal.com> wrote: > On 2007-08-21 14:23:29 +0100, Catalin Marinas wrote: > > > Thanks for this patch. > > Two things: > > * The test in your tree has the latin1 form of my name in it, > instead of utf8. (I noticed because I got a conflict when I > rebased onto your master.) I imported it on a different PC (at work) where I think the locale support isn't properly set up. Xterm accepted a copy-paste operation with your name and I passed it through emacs which probably broke it. The From: header had a different encoding and hence the author was correct. I'll try to do it on my home PC only (or just pull from your repo :-)). > * The test suite now fails on your master (since you've applied just > the test and not the fix). Please don't do that; it makes > development needlessly hard. (To be fair, this is partly my fault, > since I posted the fixin a separate patch. I'll change my ways.) I think it's OK to send separate patches and I'm OK with a test failing in a development stage. The 2nd patch didn't apply cleanly and didn't have time to see what was wrong. I'll push it tonight, please have a look for things I might have missed. Thanks. -- Catalin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 13:24 ` Pavel Roskin 2007-08-09 14:18 ` Karl Hasselström @ 2007-08-09 21:31 ` Catalin Marinas 2007-08-10 0:30 ` Karl Hasselström 2007-08-12 22:47 ` Pavel Roskin 1 sibling, 2 replies; 28+ messages in thread From: Catalin Marinas @ 2007-08-09 21:31 UTC (permalink / raw) To: Pavel Roskin; +Cc: Karl Hasselström, git, Yann Dirson On 09/08/2007, Pavel Roskin <proski@gnu.org> wrote: > On Thu, 2007-08-09 at 09:38 +0200, Karl Hasselström wrote: > > > I take it this all means you're actually using my branch? What's your > > opinion on its usefulness? > > Well, I tried it, and then ran a script to update all local > repositories. It converted everything to "version 3", so I'm sort of > stuck with it. If the "version 3" code is not committed to the mainline > StGIT, I'll have to convert my repositories back or even re-fetch them. I'll merge many of Karl's patches for the next stable release (which I hope to be sooner than the current 0.13) but I'm still on holiday for one more week and can't do much work (busy with DIY). Thanks to Karl for setting up this experimental branch. BTW, what does 'pu' mean? -- Catalin ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 21:31 ` 'pu' branch for StGIT Catalin Marinas @ 2007-08-10 0:30 ` Karl Hasselström 2007-08-12 22:47 ` Pavel Roskin 1 sibling, 0 replies; 28+ messages in thread From: Karl Hasselström @ 2007-08-10 0:30 UTC (permalink / raw) To: Catalin Marinas; +Cc: Pavel Roskin, git, Yann Dirson On 2007-08-09 22:31:09 +0100, Catalin Marinas wrote: > I'll merge many of Karl's patches for the next stable release (which > I hope to be sooner than the current 0.13) but I'm still on holiday > for one more week and can't do much work (busy with DIY). Great! Would you like me to select the "safe" topics and give you a single integration branch to pull, or do you want to be the one that does the selecting? > Thanks to Karl for setting up this experimental branch. BTW, what > does 'pu' mean? Proposed Updates, as I recall. But I just used that to explain how my branch is going to behave (meaning: it'll behave like Junio's pu branch); it isn't actually called "pu". Not so pedagogical if no one has heard of Junio's pu branch, I guess. :-) -- Karl Hasselström, kha@treskal.com www.treskal.com/kalle ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 'pu' branch for StGIT 2007-08-09 21:31 ` 'pu' branch for StGIT Catalin Marinas 2007-08-10 0:30 ` Karl Hasselström @ 2007-08-12 22:47 ` Pavel Roskin 1 sibling, 0 replies; 28+ messages in thread From: Pavel Roskin @ 2007-08-12 22:47 UTC (permalink / raw) To: Catalin Marinas; +Cc: Karl Hasselström, git, Yann Dirson Quoting Catalin Marinas <catalin.marinas@gmail.com>: > I'll merge many of Karl's patches for the next stable release (which I > hope to be sooner than the current 0.13) but I'm still on holiday for > one more week and can't do much work (busy with DIY). I'm on vacation for two more weeks, on a poor modem connection and away from anything POSIX-compatible (and pulling StGIT is too much for my modem anyway), so please don't wait for my replies. > Thanks to Karl for setting up this experimental branch. BTW, what does > 'pu' mean? I guess it's "pick-up", modeled after git's "pu" branch. -- Regards, Pavel Roskin ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2007-08-23 14:04 UTC | newest] Thread overview: 28+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-08-07 2:20 'pu' branch for StGIT Karl Hasselström 2007-08-07 2:38 ` Shawn O. Pearce 2007-08-08 5:03 ` Pavel Roskin 2007-08-08 9:20 ` Karl Hasselström 2007-08-08 21:39 ` Karl Hasselström 2007-08-08 22:18 ` Pavel Roskin 2007-08-08 23:23 ` Karl Hasselström 2007-08-09 0:10 ` Pavel Roskin 2007-08-09 7:38 ` Karl Hasselström 2007-08-09 13:24 ` Pavel Roskin 2007-08-09 14:18 ` Karl Hasselström 2007-08-09 14:24 ` Karl Hasselström 2007-08-09 16:33 ` Pavel Roskin 2007-08-09 20:39 ` Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 0/2] Teach StGIT to survive git-gc Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 1/2] New test: make sure that StGIT can handle packed refs Karl Hasselström 2007-08-10 3:23 ` [StGIT PATCH 2/2] Don't touch ref files manually Karl Hasselström 2007-08-21 13:23 ` Catalin Marinas 2007-08-21 15:58 ` Karl Hasselström 2007-08-21 16:09 ` Karl Hasselström 2007-08-21 16:12 ` Johannes Sixt 2007-08-21 16:38 ` Karl Hasselström 2007-08-21 16:46 ` Karl Hasselström 2007-08-21 20:48 ` Karl Hasselström 2007-08-23 14:04 ` Catalin Marinas 2007-08-09 21:31 ` 'pu' branch for StGIT Catalin Marinas 2007-08-10 0:30 ` Karl Hasselström 2007-08-12 22:47 ` Pavel Roskin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).