| 2006-06-22 |
| → GeertB joined | 01:11 |
| → pschulz01 joined | 02:07 |
|
pschulz01
| Is there a way to generate a report from a git archive (between commits) similar to what 'git pull' displays? | 02:19 |
|
| eg. lines of code added/deleted per file. | 02:20 |
|
| Or do I need to pipe output 'git diff' though some patch summary tool? | 02:21 |
|
DrNick
| git log A..B --stat | 02:21 |
|
| although that's a diffstat per commit instead of total | 02:22 |
|
| ah. git diff-tree A..B --stat | 02:24 |
|
pschulz01
| Thanks.. I though I was going crazy.. | 02:25 |
|
DrNick
| when in doubt, read the source | 02:25 |
|
pschulz01
| Hmm.. I might have an old version. | 02:26 |
|
| (git-core in ubuntu 6.06) | 02:27 |
|
| 1.1.3 | 02:27 |
|
DrNick
| very old | 02:29 |
| → GyrosGeier joined | 02:35 |
| → krh joined | 03:03 |
| → alp joined | 03:15 |
|
alp
| i've added a new page to the wiki that i'm fleshing out, http://git.or.cz/gitwiki/GitCommonMistakes | 03:24 |
|
| the idea is to document botched git use and migration in the wild, feedback welcome | 03:24 |
|
dkowis
| what are the migration patterns of git in the wild? | 03:32 |
|
| dkowis makes bad jokes | 03:32 |
|
dkowis
| s/jokes/puns | 03:32 |
| dkowis → wtf | 03:42 |
| wtf → ohehmeffgee | 03:43 |
| ohehmeffgee → stfu | 03:43 |
| stfu → dkowis | 03:44 |
| → eleusis joined | 04:49 |
| → pjz joined | 05:11 |
|
pjz
| anyone awake? | 05:12 |
|
| situation: I did 'git clone' and then made one change that I want to keep, and then accidentally deleted a file. I haven't done a commit. How do I get the file I accidentally deleted back? | 05:13 |
| → gitster joined | 05:14 |
|
DrNick
| git checkout path | 05:14 |
|
pjz
| ah, sweet, thanks | 05:15 |
|
| I swear I looked all over the tutorials and the manpages and etc | 05:16 |
| → krh joined | 05:38 |
| Shipon → Aexoden | 05:40 |
|
ShadeHawk
| How to split commit into two? | 06:13 |
| → Eludias joined | 06:35 |
| → lukass joined | 07:21 |
| → dst_ joined | 07:38 |
| → Tv joined | 07:57 |
|
alley_cat
| I thought git checkout path/to/file would restore that? | 08:22 |
|
| it doesn't do it here, and I can't seem to get the file out of the index either | 08:22 |
|
| I did a quite messy cherry-pick, and there were conflicts in the file | 08:23 |
| dwmw2_gone → dwmw2 | 08:32 |
|
ShadeHawk
| if you have dirty version of the file, try 'git checkout -f -- file' | 08:41 |
|
| sorry, -f doesn't work with path. | 08:42 |
|
| git update-index --remove? check update-index options. | 08:42 |
|
alley_cat
| I think I tried almost everything | 08:43 |
|
| gave up on that cherry pick for now | 08:43 |
| → octo_ joined | 09:19 |
| octo_ → octo | 09:21 |
| → alley_cat joined | 09:28 |
| → alley_cat joined | 09:33 |
| → tonyj joined | 09:33 |
| → alley_cat joined | 09:34 |
|
ShadeHawk
| Can lightweight tags point to something other than commit? git 1.3.0 doesn't warn/error out that it cannot create lightweight not-commit tag... | 09:44 |
|
| Additionally, from documentation is not obvious that if you use -m option to provide tag comment, -a (or -s) is implied, and tag object is created. | 09:46 |
| → chris2 joined | 10:05 |
|
Oejet
| ShadeHawk: A tag can point at any type of object. | 10:23 |
| → matled joined | 10:31 |
|
ShadeHawk
| Sorry... that is just gitweb bug then, it does show only example/commit-light | 10:34 |
| → benlau joined | 10:37 |
| → ferdy joined | 12:05 |
| → pasky joined | 12:07 |
| → mchehab joined | 12:10 |
| → boto joined | 12:11 |
| → coywolf joined | 12:45 |
| → alley_cat joined | 13:16 |
| → ferdy joined | 13:28 |
| ← EdsipeR left | 13:34 |
| → agile joined | 13:37 |
| → mbrio joined | 13:38 |
|
mbrio
| Good morning all, I was wondering if there was a way to break up a Git repository into smaller repositories | 13:39 |
|
| and keep their histories | 13:39 |
|
jdl
| mv | 13:39 |
|
| Oh. | 13:39 |
|
| I don't think so directly. | 13:40 |
|
| The obvious answer is to clone it n-1 times and remove the unwanted bits from the clones... | 13:40 |
|
mbrio
| hrmm | 13:40 |
|
| that could work | 13:41 |
|
| I'll play around with it | 13:41 |
|
jdl
| The tree object encompasses the whole repository ultimately. | 13:41 |
|
pasky
| ShadeHawk: I think using stgit would really help you a lot :) | 13:41 |
|
jdl
| If it is strictly on a per-directory basis, you could conceivably locate the right tree object in the repo and... | 13:42 |
|
pasky
| mbrio: you might find cg-admin-rewritehist useful for it (it won't do it for you but will help you automate it) | 13:42 |
|
mbrio
| hahah and end up messing up my repo hahah | 13:42 |
|
pasky
| ? | 13:43 |
|
mbrio
| though it would be a good way for me to understand the internals more | 13:43 |
|
| I'm fairly new to git | 13:43 |
|
| but I do considerably like it | 13:43 |
|
| at least I can screw with a local repo | 13:43 |
|
jdl
| I'm new to git too. | 13:43 |
|
mbrio
| and if I end up destroying it I atleast always have the global one | 13:43 |
|
| jdl nods. | 13:44 |
|
pasky
| mbrio: just clone it and experiment on the cloned copy | 13:44 |
|
mbrio
| yeah | 13:44 |
|
pasky
| mbrio: note that cg-admin-rewritehist will let you create branches containing the "separated" repositories, but then it's easy to separate the disjoint branches to separate repositories | 13:45 |
|
mbrio
| I'm basically dealing with the problem I had yesterday of wanting to link external projects, now I'm breaking up each of the projects into much smaller projects | 13:45 |
|
| pasky: that seems as though it will do what I need it to do, I'll do some research on it, I'm not using cogito but I do have it installed | 13:45 |
|
pasky
| cg-admin-rewritehist is fairly isolated so you don't need to know the rest of cogito to use it | 13:46 |
|
mbrio
| I figured before I started using an interface to git I should learn git first | 13:47 |
|
pasky
| mbrio: well cogito is rather designed for the opposite way, but whatever works for you :) | 13:48 |
|
jdl
| Heh. | 13:52 |
|
| And how would _you_ know what Cogito is designed for, pasky? :-) | 13:52 |
|
pasky
| just guessing ;)) | 13:53 |
|
jdl
| Thought that might be the case. | 13:53 |
|
pasky
| anyway the primary design goal was to just have a version control system that's easy to use | 13:54 |
|
mbrio
| Yeah I understand that it was meant so you didn't really need to know the internals of Git, but if it is being used as an interface to Git that's easier to use wouldn't you want to know what Cogito is doing under the hood so you know what to do if anything goes wrong with your repo? | 14:11 |
|
| but then again you wouldn't need to use Cogito if you knew the internals | 14:12 |
|
jdl
| Some folks don't want to know what's going on in the Index, for example. | 14:12 |
|
mbrio
| yea | 14:12 |
|
| and that's where the market of Cogito has been created | 14:12 |
|
| and that's great | 14:12 |
|
| most people don't really need to know it unless they are repo administrators | 14:13 |
| → GyrosGeier joined | 14:13 |
| → GeertB joined | 14:24 |
|
jdl
| Where are the --pretty format options documented? | 14:29 |
|
ShadeHawk
| Somewhere deep, and it seems like not all are documented. For example git-log accepts --pretty=oneline, git-diff-tree(1) talko only about raw|medium|short | 14:32 |
|
| jdl goes grepping... | 14:34 |
|
jdl
| git-rev-list is supposed to, it sems. | 14:34 |
|
| seems, even. | 14:34 |
|
| git-log cheeses out and refs options from git-diff-tree and git-rev-list. | 14:35 |
|
| Seems like we should factor those options out into their own #include-able files more. | 14:35 |
|
| diff-tree should already be that way, IIRC. | 14:35 |
|
| Alright. Maybe I will get to it tonight... | 14:36 |
| dwmw2 → dwmw2_gone | 14:57 |
| → Tv joined | 15:00 |
| → pasky joined | 15:26 |
|
ShadeHawk
| how well git deals with hardlinks? does it create during clone or checkout hardlinks for the files which have identical contents? i.e. does it preserve hardlinks across cloning/syncing repositories and working directories? | 16:14 |
|
pasky
| you mean in the working copy or in the object store? | 16:19 |
|
ShadeHawk
| both | 16:26 |
|
| in the repository I mean in the tree object. | 16:27 |
|
| if it is needed. | 16:27 |
|
pasky
| huh | 16:28 |
|
ShadeHawk
| but mainly in the working copy | 16:29 |
|
| symlinks I think are supported well. | 16:29 |
|
pasky
| well you really do not want to hardlink files with identical content in the working copy | 16:29 |
|
ShadeHawk
| unless you have COW-links (Copy-On-Write hardlinks) | 16:29 |
|
| well, I want to preserve hardlinks ;-) | 16:30 |
|
pasky
| git can't do that as things are now | 16:31 |
|
ShadeHawk
| oh, well, it is not that important... | 16:32 |
| → chris2 joined | 16:40 |
|
chris2
| are there any bindings to libgit.a for scripting languages? | 16:42 |
|
merlyn
| beginnings of Git.pm now | 16:43 |
|
pasky
| What's the minimal perl version we should work with? | 16:44 |
|
| chris2: I'm working at it at this very moment :) | 16:44 |
|
chris2
| is there anything you can show? :) | 16:45 |
|
| chris2 'd like to do a ruby interface | 16:45 |
|
pasky
| chris2: http://pasky.or.cz/~xpasky/git-perl/Git.html (s/html/pm/ for the source) | 16:46 |
|
| chris2: we'll primarily just call external commands now and slowly add bindings to libgit as we go | 16:46 |
|
| but I'm already doing Git.xs for hash_object(), just for the heck of it :) | 16:46 |
|
chris2
| i see | 16:47 |
| → pdmef joined | 16:51 |
|
ShadeHawk
| same place, same bat channel^W^W^W i.e. http://pasky.or.cz/~xpasky/git-perl/Git.xs (BTW, why didn't you do this on topic branch in your git repo, and publish via gitweb... or is it in too early stages of development)? | 17:06 |
| → GeertB joined | 17:07 |
|
ShadeHawk
| what does hash_object() do? | 17:07 |
|
pasky
| keep reloading ;) | 17:11 |
|
ShadeHawk
| is it to store object, get object from repository (cat-file), open file for reading? | 17:16 |
|
| pasky: BTW your web server serves Git.pm as text/x-perl, so I cannot view it in my browser. Could you symlink Git.pm.txt to it, or change httpd config, please? | 17:18 |
| ← mbrio left | 17:19 |
|
pasky
| your browser is broken | 17:22 |
|
| but I created the symlink | 17:23 |
|
ShadeHawk
| thanks. | 17:24 |
|
| chris2 tries to make a dynamically linked libgit, but always gets errors due to undefined main | 17:24 |
|
ShadeHawk
| there was some patch on the list to make libgit shared library sometime ago | 17:25 |
|
alp
| i have patches for libgit if your're interested | 17:25 |
|
chris2
| i just wonder where main is referenced | 17:25 |
|
dst_
| It was my patch, an old version at available at http://stosberg.net/pub/ | 17:26 |
|
ShadeHawk
| pasky: why do you use CamelCase keys for option names? | 17:26 |
|
dst_
| I also have the first traces of a perl interface to that library. | 17:27 |
|
| Works for me so far, that I can get the version string out of git and read the ls-tree output in a perl array. | 17:27 |
|
ShadeHawk
| perhaps pasky would be interested, dst_ | 17:27 |
|
pasky
| ShadeHawk: to keep the conventions | 17:29 |
|
| mostly | 17:29 |
|
alp
| i have a small c# git binding that might be useful, http://www.ndesk.org/tmp/gits.cs | 17:30 |
|
pasky
| I'm now doing .xs for basically git-hash-object | 17:30 |
|
dst_
| I'll put it online. Give me a few minutes to sort it out. | 17:30 |
|
ShadeHawk
| would you support/do you plan supporting CGI calling conventions, i.e. repository({-directory => "~/git"}); (with anonymous hashref)? | 17:31 |
| → GeertB joined | 17:39 |
| → anholt_ joined | 17:39 |
|
dst_
| My stuff is at http://stosberg.net/pub/gitlib/ . To test, extract the tar inside your git directory and apply the shared-lib.diff. You'll need swig to generate the perl-to-c bindings. | 17:42 |
|
pasky
| ShadeHawk: what exactly are you after? | 17:42 |
|
| dst_: hmm, the create_array() bit looks scary | 17:43 |
|
dst_
| Unfortunately swig's calling conventions require this. | 17:44 |
|
| It can't hand perl arrays to the c code. | 17:44 |
|
pasky
| I guess I'll rather stay directly with the .xs then... but the idea of calling builtins thru libgit looks nice | 17:46 |
|
| aha, but that's not something linked to libgit by default :) | 17:46 |
|
ShadeHawk
| to be able to use repository({key => value, key => value, key => value}) | 17:47 |
|
pasky
| ShadeHawk: instead of repository(key => value, key => value, key => value)? what'd be the point? | 17:48 |
| → krh joined | 17:58 |
|
pasky
| damn, this reminds me why I hate git header files | 18:04 |
|
| (not to say perl headers aren't orders of magnitude worse) | 18:06 |
| → Paavo joined | 18:07 |
|
pasky
| $ perl -w -I/home/xpasky/lib/perl5/site_perl/5.8.8 -MGit -le 'print Git::hash_object("Makefile", "blob")' | 18:11 |
|
| c0f64523c7861ebb6a414c22c58793f0ff357296 | 18:11 |
|
| woohoo! | 18:11 |
|
dst_
| Congratulations. | 18:13 |
|
nickh
| sweet! | 18:13 |
|
ShadeHawk
| time? | 18:14 |
|
| i.e. $ time perl -w -I/home/xpasky/lib/perl5/site_perl/5.8.8 -MGit -le 'print Git::hash_object("Makefile", "blob")' | 18:14 |
|
swoolley
| that includes the entire perl process | 18:15 |
|
| might want to loop the print and time that | 18:15 |
|
pasky
| 0.027s vs. 0.32s for generic_oneline | 18:15 |
|
| so it's not really impressive but yes, what swoolley said | 18:15 |
|
| $ time perl -w -I/home/xpasky/lib/perl5/site_perl/5.8.8 -MGit -le 'print Git::generic_oneline("hash-object", "Makefile") for (1..1000)' >/dev/null | 18:16 |
|
| real 0m4.775s | 18:16 |
|
| $ time perl -w -I/home/xpasky/lib/perl5/site_perl/5.8.8 -MGit -le 'print Git::hash_object("Makefile") for (1..1000)' >/dev/null | 18:16 |
|
ShadeHawk
| $ time perl -w -I/home/xpasky/lib/perl5/site_perl/5.8.8 -MGit -le 'print "c0f64523c7861ebb6a414c22c58793f0ff357296\n"' | 18:16 |
|
pasky
| real 0m0.178s | 18:16 |
|
| much more impressive, I'd say ;) | 18:16 |
|
ShadeHawk
| 25 x faster... | 18:17 |
|
swoolley
| \n isn't needed with -l | 18:18 |
|
ShadeHawk
| pasky: is this single hanging semicolon after croak in arg being filehandle case needed? if so, why? | 18:45 |
|
| croak("You passed me something weird - a dir glob?"); | 18:45 |
|
| ; | 18:45 |
|
pasky
| ShadeHawk: it is needed since I'm about to write a command there :) | 18:47 |
|
| you are looking at what I'm literally editing right now | 18:47 |
|
ShadeHawk
| ahhhhh... now I understand... working dir state... | 18:48 |
|
| I'm wondering whether to wait for Git.pm before refactoring gitweb | 18:49 |
|
| (perhaps someone else would do that ;-)) | 18:49 |
|
pasky
| Git.pm is probably going to evolve fast and gitweb would be a great test-user for all the new interfaces we are gradually going to add | 18:51 |
| → z3ro joined | 18:53 |
|
normalperson
| pasky: looks sweet | 19:03 |
| → cworth joined | 19:19 |
| → ShadeHawk joined | 19:21 |
| → Eludias joined | 19:22 |
| → DrNick joined | 19:41 |
| → krh joined | 19:56 |
|
pasky
| so, I've done some pretty big changes :) | 20:16 |
|
| to the API and stuff | 20:16 |
|
| ShadeHawk: what did you mean by: | 20:19 |
|
| (to be converted in the 'new' | 20:19 |
|
| constructor I guess) | 20:20 |
|
ShadeHawk
| my $repo = new Git::repository('/home/jnareb/git/'); | 20:21 |
|
| or something like that. | 20:21 |
|
| of | 20:22 |
|
| my $repo = Git::repository->new('/home/jnareb/git'); | 20:22 |
|
pasky
| well, if we'll have an init-db repository constructor, this could get mighty confusing | 20:26 |
|
| so I'd rather not | 20:26 |
|
| besides, we'd just have to offload everything to a Git::repository object, which doesn't make much sense to me | 20:26 |
|
dormando
| How does git/cogito handle tracking symlinks? | 20:26 |
|
| or could someone point me to the doc file I can't find? :\ | 20:27 |
| → CIA-14 joined | 20:28 |
|
ShadeHawk
| dormando: symlinks are supported - see: http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi?p=git.git;a=tree;hb=HEAD;f=gitweb/test | 20:30 |
| → agile joined | 20:30 |
|
ShadeHawk
| for tree object, symlink is object marked as symlink | 20:30 |
|
| for blob, it is just a file name it points too | 20:31 |
|
| ate laste that looks from diff: http://front.fuw.edu.pl/cgi-bin/jnareb/gitweb.cgi?p=git.git;a=commitdiff;h=HEAD | 20:31 |
|
| diff for creating symlink looks like that: | 20:32 |
|
| new file mode 120000 | 20:32 |
|
| index 0000000..ae35211 | 20:32 |
|
| --- /dev/null | 20:32 |
|
| +++ b/gitweb/test/symlink | 20:32 |
|
| @@ -0,0 +1 @@ | 20:32 |
|
| +file+plus+sign | 20:32 |
|
| \ No newline at end of file | 20:32 |
|
dormando
| Hm. okay. | 20:34 |
|
| Had some weirdness just now, but it looks like a cogito thing | 20:34 |
|
| cg-rm couldn't remove a bunch of symlinks (I think we're one version behind) | 20:34 |
|
| git rm -f did it | 20:34 |
|
ShadeHawk
| and changing symlink target is for diff: | 20:35 |
|
dormando
| running through a push/pull cycle to see if it actually got rid of them | 20:35 |
|
ShadeHawk
| diff --git a/gitweb/test/symlink b/gitweb/test/symlink | 20:35 |
|
| index ae35211..f97d055 120000 | 20:35 |
|
| --- a/gitweb/test/symlink | 20:35 |
|
| +++ b/gitweb/test/symlink | 20:35 |
|
| @@ -1 +1 @@ | 20:35 |
|
| -file+plus+sign | 20:35 |
|
| \ No newline at end of file | 20:35 |
|
| +hardlink | 20:35 |
|
| \ No newline at end of file | 20:35 |
|
dormando
| Looks like it worked fine, sorry :P | 20:36 |
|
ShadeHawk
| So git should handle symlinks well. | 20:36 |
|
dormando
| Confirmed that the diffs look like you just described | 20:36 |
|
| Seems like cogito has some trouble with symlinks. I'll upgrade it and report if it's still happening | 20:36 |
|
| Thanks :) | 20:37 |
|
pasky
| cogito wasn't tested with symlinks a lot :( | 20:40 |
|
dormando
| Hm :\ What I tried to remove was 100 symlinks to a directory, and it saw them all as directories | 20:41 |
|
| So blah blah. | 20:41 |
|
| git rm -f zapped the buggers fine | 20:41 |
|
pasky
| :)) | 20:42 |
|
ShadeHawk
| pasky: IIRC there was a patch to support --git-dir command line option at least for git wrapper... | 20:45 |
|
| in the 3 parts series of making gitweb mod_perl friendly | 20:45 |
|
pasky
| I'll have a look | 20:47 |
|
ShadeHawk
| hash_object doesn't work for "tag" type? | 20:48 |
|
| do you know if there is a perl module to check if GPG signature matches? | 20:51 |
|
pasky
| Crypt::GPG as a 10-second CPAN search revealed ;) | 20:53 |
|
| hash_object probably works for any object type | 20:54 |
|
| not sure about delta | 20:54 |
|
| the --git-dir patch just makes git.c setenv(GIT_DIR), so not really useful :( | 20:54 |
|
| but extending the setup_repo_whateverisitnamed() function to support that should be easy | 20:54 |
|
chris2
| hrm, 1000x makefile hashing is here: 3.059989 (git.rb) vs 71.056134 (git-hash-object) on a totally loaded and slow ibook | 20:58 |
|
ShadeHawk
| and don't forget to add '--git-dir' support to Git.pm to use by Perl scripts. | 20:58 |
|
| chris2: git.rb? | 20:59 |
|
chris2
| a ruby binding for libgit | 20:59 |
|
| i wrote this afternoon | 20:59 |
|
| <100loc ruby, 0loc c. already can lookup sha1, traverse trees and hash objects :-) | 21:01 |
|
ShadeHawk
| by git-hash-object you mean calling this from inside ruby script, or what? | 21:02 |
|
chris2
| git.rb calls index_fd, and git-hash-object forks 1000x times | 21:03 |
|
pasky
| Temporary fix: commented out offending line in mimetype_guess. | 21:04 |
|
| ShadeHawk: what does that mean? | 21:04 |
|
ShadeHawk
| if yes, this is an order of speedup for Git.pm fork+pipe+exec, vs XS. | 21:04 |
|
| pasky: this line caused error (undefined global $path), so I commented it out. I don't know what this line *meant* to do, to correct it correctly | 21:04 |
|
pasky
| # (relative to the current git repository) | 21:05 |
|
| this part of $mimetypes_file | 21:05 |
| → spyderous joined | 21:05 |
|
spyderous
| how can i revert an entire merge? | 21:06 |
|
| preferably without individually reverting each commit that was merged over | 21:06 |
|
ShadeHawk
| 23.2 for your ruby binding, around 26.8 for pasky's solution (only hash_object for now) | 21:07 |
|
chris2
| the ibook probably distorts the numbers a lot | 21:07 |
|
ShadeHawk
| spyderous: I guess git-reset --hard ORIG_HEAD, but I'm not sure. | 21:07 |
|
pasky
| ShadeHawk: it's different hardware | 21:07 |
|
chris2
| if someone has ruby 1.8.4 installed, i can post it | 21:07 |
|
spyderous
| i already pushed it, so i can't just kill the history | 21:07 |
|
| well technically somebody else pushed it, but same point =P | 21:07 |
|
pasky
| ShadeHawk: even different architecture so relative fork() costs might be quite different | 21:07 |
|
chris2
| esp on osx :P | 21:08 |
|
pasky
| oh | 21:08 |
|
| ok, that too :)) | 21:08 |
|
chris2
| i guess perl xs will be absolutely faster than ruby/dl | 21:08 |
|
| but far more work, too ;-) | 21:08 |
|
ShadeHawk
| chris2: do you plan to publish it/send it on git mailing list... | 21:10 |
|
chris2
| it's very ugly atm | 21:10 |
|
ShadeHawk
| BTW git-svnconvert in Ruby was it your work? | 21:10 |
|
chris2
| no | 21:10 |
|
pasky
| spyderous: decide "which" parent of the commit do you want reverted, then do a diff between the parent and the commit, apply that in reverse and commit | 21:10 |
|
chris2
| ShadeHawk: i guess i'll publish it when its a bit more mature | 21:11 |
|
ShadeHawk
| chris2: if you have some free time, you can compare speedup from pasky's Git.pm encoding hash_object in XS... | 21:12 |
|
chris2
| will do later | 21:12 |
|
ShadeHawk
| pasky: documentation got out of sync with implementation. command does not return filehandle in scalar context | 21:15 |
|
spyderous
| pasky: ok, thanks for the tip | 21:15 |
|
ShadeHawk
| IMVVHO generic command() should return array for array, filehandle for scalar, and run quietly for null/void context. | 21:16 |
|
| OR return array of lines for array context, first line for scalar context, and run quietly for null/void context. | 21:17 |
|
| from the common usages. | 21:17 |
|
| if you want to return whole output for scalar context, instead of using array then joining elements, wouldn't it be better to just slutp (undef $/) the file? | 21:19 |
| → kampasky joined | 21:19 |
|
ShadeHawk
| s/slutp/slurp/ (and this is Perl termonology IIRC) | 21:20 |
|
| ShadeHawk is confused... it looks like he doesn't understand Perl... | 21:21 |
|
pasky
| well, this is tough to argue about since this is really matter of taste | 21:22 |
|
| but to me, this way it just look much more logical to me - it's kind of how you would expect the function to behave | 21:23 |
|
| even if it might not be the most economic way to the number of functions or characters typed when programming | 21:23 |
|
| thanks for the documentation alert | 21:24 |
|
ShadeHawk
| if (!defined wantarray) { local $/; return <$fh>; } or something like that... | 21:26 |
|
pasky
| huh? | 21:28 |
|
| if you don't want anything, the best thing you can do at the point is to close the $fh | 21:29 |
|
ShadeHawk
| sorry, it should be: | 21:31 |
|
| my $content; | 21:31 |
|
| pasky is confused to no avail :) | 21:32 |
|
ShadeHawk
| { local $/; $content = <$fh>; } unless (defined wantarray && !wantarray); | 21:32 |
|
| ... | 21:32 |
|
| return $ccontent; # instead of join('", @lines); | 21:33 |
| → cworth joined | 21:33 |
|
ShadeHawk
| now clear? | 21:33 |
|
| s/unless/if/ | 21:34 |
|
| Gah. Changing code while writing... | 21:34 |
|
| i.e. slurp if in scalar context, discard output if in void context, return array of [chomped?] lines if in array/list context | 21:35 |
|
pasky
| Hmm. | 21:36 |
| → kampasky joined | 21:36 |
|
ShadeHawk
| should be little faster, becaue Perl doesn't need to split output into lines, only to discard it later... | 21:37 |
|
pasky
| But it will be significantly slower (and O(N) in memory usage) in void context. | 21:38 |
|
ShadeHawk
| no, slurp only for scalar context, i.e. for (defined wantarray && ! wantarray) | 21:38 |
|
pasky
| oops | 21:39 |
|
| I guess the patch was too huge for the mailing list | 21:39 |
|
| hrmz | 21:39 |
|
ShadeHawk
| { local $/; my $content = <$fh> } if (defined wantarray && !wantarray); | 21:39 |
|
| @lines = <$fh> if (defined wantarray && wantarray); | 21:40 |
|
| i.e. | 21:40 |
|
| @lines = <$fh> if defined wantarray; | 21:40 |
|
| or even | 21:40 |
|
| my @lines = <$fh> if defined wantarray; | 21:40 |
|
| although conditional declaration is frowned upon, if possible at all... | 21:41 |
|
pasky
| I will just outsource the close to a sperate function and write separate code paths :) | 21:41 |
|
ShadeHawk
| you added command_pipe, but didn't add it to @EXPORT_OK | 21:43 |
|
pasky
| oops, another thing I forgot :) | 21:43 |
|
| good thing the patch didn't make it to the list | 21:44 |
|
ShadeHawk
| and you might want to add info about void context for command to documentation, too... | 21:44 |
|
| or not, as it is obvious (it is an implementation detail) | 21:45 |
|
| ...ah those XS names: SVt_RV, SVt_PVGV, IoIFP, sv_2io, SvPV_nolen... | 21:48 |
|
DrNick
| look at all that wasted Perl effort | 21:49 |
|
| you could be doing this in Python, you know | 21:49 |
|
| or a selection of many other languages that aren't write-only | 21:49 |
|
ShadeHawk
| Common Lisp for example? ;-P | 21:50 |
|
| chris2 hates the read_tree_recursive call | 21:51 |
|
ShadeHawk
| DrNick: try to write something in TeX language... that is write-only language... | 21:51 |
|
| C for example? ;-)))) | 21:51 |
|
pasky
| ShadeHawk: Yes, when doing XS today, first in a rather long time I felt again as a true wizard. :) | 21:52 |
| ← spyderous left | 21:52 |
|
pasky
| I just love that about doing XS. Real raw magic. | 21:53 |
|
chris2
| apropos magic. will i get slapped for using const char *base in read_tree_recursive to pass a closure? ;-) | 21:54 |
|
pasky
| eek :) | 21:58 |
|
chris2
| that's the most evil ruby i ever wrote | 22:01 |
|
| Git.read_tree_recursive(@tree, [block.object_id | (recursive ? 1 : 0)]. | 22:01 |
|
| pack("L"), 4, 0, nil, READ_TREE) | 22:01 |
|
| it places the address of the closure, together with whether to walk recursive in the first 4 bytes of the base ;) | 22:01 |
|
pasky
| cute :) | 22:03 |
|
chris2
| actually, there is a worse line atm | 22:03 |
|
pasky
| hmm, I should check ruby out.. the syntax seems quite similar to perl | 22:03 |
|
chris2
| rstat = File.stat thing | 22:04 |
|
| stat = DL::PtrData.new(rstat.object_id*2).to_a('P', 5).last | 22:04 |
|
| this calculates where the struct stat* is placed internally ;-) | 22:04 |
|
pasky
| or perhaps just the @tree part appealed to me ;) | 22:04 |
|
chris2
| you'd probably enjoy it | 22:04 |
|
| @foo means instance variable | 22:04 |
|
| there are no sigils for datatypes | 22:05 |
|
| only for scope | 22:05 |
|
ShadeHawk
| pasky: Patch (Git.pm v3) passed | 22:07 |
|
dormando
| okay... symlink annoyance again | 22:08 |
|
pasky
| ShadeHawk: passed? :) | 22:08 |
|
dormando
| we have remote repo origin | 22:08 |
|
| user A git rm -f's a ton of symlinks | 22:08 |
|
| user B cg-update's | 22:08 |
|
| it doesn't remove the symlinks | 22:08 |
|
| user B commits and pushes, and the symlinks go back into the repo | 22:08 |
|
pasky
| that's weird | 22:09 |
|
dormando
| One of the devs is about to put my head through the floor :P | 22:09 |
|
pasky
| did the cg-update do a merge? | 22:09 |
|
dormando
| sec | 22:09 |
|
| possibly. When I do a fast-forward the symlinks poof | 22:10 |
|
| lemme go bug user B | 22:10 |
|
pasky
| it's not that important as what cg-status shows after the cg-update | 22:11 |
|
ShadeHawk
| pasky: Hmmm... if you use git wrapper, using "--git-dir=$self->{opts}->{Repository}" as a first arguments can be alternative to setting $ENV{GIT_DIR} | 22:14 |
|
| i.e. is on git mailing list | 22:14 |
|
pasky
| ah.. cool | 22:14 |
|
| ShadeHawk: well, I kind of prefer the $ENV{GIT_DIR} solution since it doens't clutter ps axu output ;) | 22:14 |
|
| it might be a wee bit slower but I think that's not gonna be noticeable in all the fork() overhead | 22:15 |
|
dormando
| pasky; ok, sec... | 22:15 |
|
| bugging people | 22:15 |
|
| I think it just doesn't show them as changed at all | 22:16 |
|
ShadeHawk
| that is supposedly needed for mod_perl compliant gitweb... it could be set as an option when creating repository... ergh, perhaps one should separate repository from git configuration. | 22:16 |
|
dormando
| I see he did a merge earlier, but most are fast forwards | 22:16 |
|
| and saw nothing in his backscroll about the symlinks | 22:16 |
|
pasky
| ShadeHawk: well, I claim it isn't | 22:16 |
|
| ShadeHawk: remember that we set the %ENV already in the subprocess | 22:17 |
|
ShadeHawk
| ah... yes... | 22:18 |
|
| By the way, for "git-command" invocation one needs gitexecdir (better to remember it, instead of calling git --exec-path every time) | 22:18 |
|
pasky
| yes, gitexecdir is what I want to add now | 22:18 |
|
ShadeHawk
| Git.pm is very nice. | 22:22 |
|
| By the way, are 'git' always in gitbin aka bindir, _and_ in gitexecdir aka libexecdir? | 22:23 |
|
pasky
| I don't think so | 22:26 |
|
| Git::exec_path() implemented | 22:27 |
|
dormando
| pasky; this is ... really annoying :( | 22:35 |
|
| Any suggestions on how we should fix the repo? | 22:35 |
|
| we need to get rid of the symlinks, but anyone else doing work adds them back in | 22:36 |
| → tmokros joined | 22:39 |
|
ShadeHawk
| pasky: could you also add Git::git_version()? The only cases where we might want to call 'git' directly, and not one of the git-commands. | 22:43 |
|
pasky
| ShadeHawk: sure | 22:44 |
|
ShadeHawk
| attention: it should be git version, as we might want tu use script for testing from never version that the one installed. | 22:44 |
|
| that's the beauty of scripts. | 22:44 |
|
pasky
| dormando: I have to admit that I didn't ever track symlinks with Git and I'm afrait to lose my mental state now so it might be best to ask around on the mailing list | 22:45 |
|
ShadeHawk
| I use git 1.3.0 (Slackware ready package from LinuxPackages), but git-send-email from current version, and muck with current gitweb.cgi | 22:45 |
|
| so relying on @@VERSION@@ might be out (but might be first reslt if set) | 22:46 |
|
pasky
| ShadeHawk: actually, I'm ending up abolishing GitPath again and will not make use of exec_dir(), and rather call any external commands using execv_git_cmd() ;) | 22:46 |
|
| ShadeHawk: well, if your .pm is out-of-sync, that means most likely .so of your .xs is out-of-sync, and that means everything will behave _really_ strange, especially as random functionality may shift between external commands and the .so | 22:46 |
|
| ShadeHawk: so, the .pm you use must match the git version you have installed | 22:47 |
|
dormando
| pasky: no problem | 22:47 |
|
ShadeHawk
| Oh well... | 22:49 |
|
| well, you might not make use of git_exec_dir, but you might leave it and git_version, even if unused. | 22:53 |
|
pasky
| sure, I won't retract the patch | 22:53 |
|
ShadeHawk
| because for example at least for now Git.pm doesn support: command_in, command_inout, and creating pipelines (although you might do it by hand-stitching I guess) | 22:55 |
|
pasky
| the trouble with XS is that my fingers can't decide whether to write continue or next | 22:56 |
| → yacc joined | 23:00 |
|
yacc
| Just wondering, is there a git port to Win32? | 23:00 |
| → idr joined | 23:12 |
|
idr
| I've encountered an odd situation with git, and I can't figure out how to make forward progress. | 23:13 |
|
| I have commits in my local tree to a file. That file was subsequently deleted upstread, and I did a 'git pull'. File gone. | 23:13 |
|
| Later, the file was re-added (or the deletion was undone?) upstream. | 23:14 |
|
| Now 'git pull' has problems on that file. | 23:14 |
|
| Specifically, I get foo.c~HEAD and foo.c~[commit id gook] where foo.c should be, and git tells me "Automatic merge failed; fix conflicts and the commit the result." | 23:15 |
|
anholt_
| so, you move foo.c~HEAD over fooc, git-update-index foo.c, commit, right? | 23:16 |
|
idr
| If I try to commit back a version of foo.c that is what I want, git tells me "Cannot do partial commit durning merge." | 23:16 |
|
| anholt_: I did try that also. | 23:17 |
|
anholt_
| what did that do? | 23:17 |
|
idr
| anholt_: But, IIRC, the commit said no changes. | 23:17 |
|
| anholt_: Let me try it again... | 23:18 |
|
anholt_
| what exact commit command did you use? | 23:18 |
|
idr
| Okay. | 23:18 |
|
| anholt_: Doing 'git pull', edit of xf86sym.c, git-update-index xf86sym.c, git commit xf86sym.c results in ""Cannot do partial commit durning merge." | 23:19 |
|
anholt_
| just git commit | 23:19 |
|
| you want to commit the whole merge, not your update to a single file. | 23:19 |
|
idr
| anholt_: I guess that makes sense. And it did work, too. | 23:21 |
|
anholt_
| (and git-update-index is saying "I've fixed the conflicts in this file, it's ready to go". git status will tell you if you have further files to fix up) | 23:21 |
| → Simon- joined | 23:21 |
| ← Elrond left | 23:25 |
| ← Simon- left | 23:26 |
| → benlau joined | 23:32 |
| → mchehab joined | 23:51 |
|
yacc
| Just wondering, is git available for Windows? | 23:56 |
|
neuralis
| yacc: should work fine under cygwin, don't know about native binaries | 23:58 |