Git development
 help / color / mirror / Atom feed
* RE : RE : trailling whitespace with git am ?
From: PICCA Frédéric-Emmanuel @ 2009-08-14 20:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Riesen, git
In-Reply-To: <7vab22i1dl.fsf@alter.siamese.dyndns.org>

> how can I do the difference between a patch with normal CR+LF (the autor use this format)
> and a patch without CR+LF due to the webmail ?

> That is a question to your webmail provider but I think you generally
> can't.  Use dos2unix as Alex suggested and you should be fine.

git am --whitespace=fix was sufficient to apply the patch

^ permalink raw reply

* Re: [PATCH 1/5] port --ignore-unmatch to "git add"
From: Luke-Jr @ 2009-08-14 20:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, Luke Dashjr, git
In-Reply-To: <7vws56i35q.fsf@alter.siamese.dyndns.org>

On Friday 14 August 2009 02:52:33 pm Junio C Hamano wrote:
> Thomas Rast <trast@student.ethz.ch> writes:
> > Junio C Hamano wrote:
> >> Chould you refresh my memory a bit?
> >>
> >> In what circumstance is "rm --ignore-unmatch" useful to begin with?
> >
> > Not sure about add --ignore-unmatch myself, but there's even an
> > example of rm --ignore-unmatch in man git-filter-branch, along the
> > lines of
> >
> >   git filter-branch --index-filter '
> >     rm --ignore-unmach some_file_that_shouldnt_be_in_history
> >   ' -- --all
>
> Ah, that makes sense.  I am not sure about "add --ignore-unmatch" myself
> either, and an example similar to the above filter-branch would not apply
> very easily (i.e. "add a file that should have been in history" would not
> need --ignore-unmatch).

The purpose of "add --ignore-unmatch" is to ignore race conditions where one 
of the files to be added has been deleted after git is executed, but before 
git scans it.

^ permalink raw reply

* Re: RE : trailling whitespace with git am ?
From: Junio C Hamano @ 2009-08-14 20:31 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: Alex Riesen, git
In-Reply-To: <606CC410B038E34CB97646A32D0EC0BF0181FABD@venusbis.synchrotron-soleil.fr>

PICCA Frédéric-Emmanuel  <frederic-emmanuel.picca@synchrotron-soleil.fr>
writes:

> how can I do the difference between a patch with normal CR+LF (the autor use this format)
> and a patch without CR+LF due to the webmail ?

That is a question to your webmail provider but I think you generally
can't.  Use dos2unix as Alex suggested and you should be fine.

^ permalink raw reply

* Re: RE : trailling whitespace with git am ?
From: Alex Riesen @ 2009-08-14 20:31 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: git

On Fri, Aug 14, 2009 at 22:21, PICCA
Frédéric-Emmanuel<frederic-emmanuel.picca@synchrotron-soleil.fr>
wrote:
>> This patch has DOS line endings (like CR, followed by LF).
>
>> You can either use dos2unix (or your editor of choice), or update your git
>> to current master branch, where "git am" handles such patches transparently.
>
> I am using git 1.6.3.3 debian unstable is it ok ?

No. I just checked - it is not even in master yet. You can merge
the commits at c2ca1d79dbd54b06. That's what I am using. These
are merged in Junio's next already, so you'll see them in master
someday. Meanwhile I can have it like this:

$ git clone git://git.kernel.org/pub/scm/git/git.git
$ cd git
$ git merge c2ca1d79dbd54b06
$ make && make test && make doc
$ make install install-doc

This will install the freshly compiled git in your home (~/bin,
~/share, ~/libexec, ...)

I would recommend to remove the debian's git first, BTW.

> how can I do the difference between a patch with normal CR+LF (the autor use this format)
> and a patch without CR+LF due to the webmail ?

Just replace the trailing CR+LF with just LF. The program named
"dos2unix" does that.

^ permalink raw reply

* Re: [RFC PATCH 0/2] add a --delete option to git push
From: Jakub Narebski @ 2009-08-14 20:25 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: git
In-Reply-To: <fabb9a1e0908140953w2d3f571cv3e7415817c2758a7@mail.gmail.com>

Dnia piątek 14. sierpnia 2009 18:53, Sverre Rabbelier napisał:
> 2009/8/14 Jakub Narebski <jnareb@gmail.com>:
>> On Fri, 14 August 2009, Sverre Rabbelier wrote:
>>>
>>> This is in reply to a brief conversation I had with jnareb on #git
>>> about the blogpost "5 things git could learn from hg", or something
>>> like that (can't find it right now).
>>
>> Thanks.
> 
> What do you think would be the best solution? There seem to be a lot
> of opinions on how to proceed.

I think we can begin with simple and strict: "--delete=<branch>"
is long version of equivalent ":<branch>" (like long option equivalent
to short one).

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: [RFC PATCH v3 8/8] --sparse for porcelains
From: Jakub Narebski @ 2009-08-14 20:23 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Junio C Hamano, git, Johannes Schindelin
In-Reply-To: <fcaeb9bf0908130538x396b1208s43d312107e3e198c@mail.gmail.com>

Dnia czwartek 13. sierpnia 2009 14:38, Nguyen Thai Ngoc Duy napisał:
> On 8/13/09, Jakub Narebski <jnareb@gmail.com> wrote:
>> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
>>> 2009/8/12 Junio C Hamano <gitster@pobox.com>:
>>
>>>> It could also require core.sparseworktree configuration set to true if we
>>>> are really paranoid, but without the actual sparse specification file
>>>> flipping that configuration to true would not be useful anyway, so in
>>>> practice, giving --sparse-work-tree option to these Porcelain commands
>>>> would be no-op, but --no-sparse-work-tree option would be useful to
>>>> ignore $GIT_DIR/info/sparse and populate the work tree fully.
>>>
>>> Only part "ignore $GIT_DIR/info/sparse" is correct.
>>> "--no-sparse-work-tree" would not clear CE_VALID from all entries in
>>> index (which is good, if you are using CE_VALID for another purpose).
>>>
>>> To quit sparse checkout, you must create an empty
>>> $GIT_DIR/info/sparse, then do "git checkout" or "git read-tree -m -u
>>> HEAD" so that the tree is full populated, then you can remove
>>> $GIT_DIR/info/sparse. Quite unintuitive..
>>
>>
>> Hmmm... this looks like either argument for introducing --full option
>>  to git-checkout (ignore CE_VALID bit, checkout everything, and clean
>>  CE_VALID (?))...
>>
>>  ...or for going with _separate_ bit for partial checkout, like in the
>>  very first version of this series, which otherwise functions like
>>  CE_VALID, or is just used to mark that CE_VALID was set using sparse.
> 
> In my opinion, making an empty .git/info/sparse to fully populate
> worktree is not too bad. I wanted to have plumbing-level support in
> git so that you could try sparse checkout on your projects (possibly
> with a few additional scripts to make your life easier). Then good
> Porcelain UI may emerge later (or in worst case, people would roll
> their own sparse checkout).

Deciding whether sparse checkout should use CE_VALID only, or should it
(as it was in the very first version of series) use additional flag, 
either CE_NO_CHECKOUT, or CE_VALID_IS_USED_HERE_FOR_SPARSE_CHECKOUT ;-)
is a design decision about *plumbing-level* support.

Note that shallow clone, while using the same mechanism as grafts file,
nevertheless use separate file; so perhaps sparse checkout while using
the same mechanism as --assume-unchanged should use additional flag.


BTW. you might want to use GIT_SPARSE_FILE, similar to GIT_INDEX_FILE;
see the fact that plumbing doesn't have .gitignore not .git/info/excludes
hardcoded... well, except for --standard-excludes.  This way full
checkout would be as simple as using

  $ GIT_SPARSE_FILE= git checkout -- .

-- 
Jakub Narebski
Poland

^ permalink raw reply

* RE : trailling whitespace with git am ?
From: PICCA Frédéric-Emmanuel @ 2009-08-14 20:21 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git
In-Reply-To: <81b0412b0908141310x7e4acf4fgf4ea71cf53de6eea@mail.gmail.com>

> This patch has DOS line endings (like CR, followed by LF).

> You can either use dos2unix (or your editor of choice), or update your git
> to current master branch, where "git am" handles such patches transparently.

I am using git 1.6.3.3 debian unstable is it ok ?

In fact we saw that this problem was due to our webmail

the patch was attached to a mail and using the webmail interface a save to disk transform the CR -> CR LF

we tested it with gmail and the microsoft webmail

now the problem is that a patch with CR+ LF do not have the same signature that a patch
with  only CR.

how can I do the difference between a patch with normal CR+LF (the autor use this format)
and a patch without CR+LF due to the webmail ?

See you

Frederic

^ permalink raw reply

* Re: trailling whitespace with git am ?
From: Alex Riesen @ 2009-08-14 20:10 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: git
In-Reply-To: <606CC410B038E34CB97646A32D0EC0BF0181FAB4@venusbis.synchrotron-soleil.fr>

2009/8/14 PICCA Frédéric-Emmanuel
<frederic-emmanuel.picca@synchrotron-soleil.fr>:
> mordor% git am /home/picca/Projets/patches/0001-Add-the-POGO-TO-DELETE-comment-to-ComputedAnglesClea.patch
> Applying: 'Add the POGO TO DELETE comment to ComputedAnglesClear command'
> /tmp/diffractometer/.git/rebase-apply/patch:13: trailing whitespace.
>
> /tmp/diffractometer/.git/rebase-apply/patch:14: trailing whitespace.
>        /* POGO TO DELETE */
> error: patch failed: src/Diffractometer/Diffractometer.cpp:2023
> error: src/Diffractometer/Diffractometer.cpp: patch does not apply

This patch has DOS line endings (like CR, followed by LF).

You can either use dos2unix (or your editor of choice), or update your git
to current master branch, where "git am" handles such patches transparently.

^ permalink raw reply

* Re: [PATCH 1/5] port --ignore-unmatch to "git add"
From: Junio C Hamano @ 2009-08-14 19:52 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Luke Dashjr, git
In-Reply-To: <200908132306.37947.trast@student.ethz.ch>

Thomas Rast <trast@student.ethz.ch> writes:

> Junio C Hamano wrote:
>> 
>> Chould you refresh my memory a bit?
>> 
>> In what circumstance is "rm --ignore-unmatch" useful to begin with?
>
> Not sure about add --ignore-unmatch myself, but there's even an
> example of rm --ignore-unmatch in man git-filter-branch, along the
> lines of
>
>   git filter-branch --index-filter '
>     rm --ignore-unmach some_file_that_shouldnt_be_in_history
>   ' -- --all

Ah, that makes sense.  I am not sure about "add --ignore-unmatch" myself
either, and an example similar to the above filter-branch would not apply
very easily (i.e. "add a file that should have been in history" would not
need --ignore-unmatch).

^ permalink raw reply

* Re: [PATCH] git stash: Give friendlier errors when there is nothing to apply
From: Junio C Hamano @ 2009-08-14 19:52 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: git, Ori Avtalion
In-Reply-To: <4a81787d.0e0f660a.5238.4c8b@mx.google.com>

Ori Avtalion <ori@avtalion.name> writes:

> The change makes sure a stash (given or default) exists before
> checking if the working tree is dirty.
>
> If the default stash is requested, the old message was scary and
> included a 'fatal' error from rev-parse:
>      fatal: Needed a single revision
>      : no valid stashed state found
>
> It is replaced with a friendlier 'Nothing to apply' error, similar to
> 'git stash branch'.
>
> If a specific stash is specified, the 'Needed a single revision' errors
> from rev-parse are suppressed.
>
> Signed-off-by: Ori Avtalion <ori@avtalion.name>
> Acked-by: Thomas Rast <trast@student.ethz.ch>

I do not see anything that might break existing usage of the command.
Comments?

A tangent; we might want an analogue to "shortlog -s -n" but based on
"blame".

^ permalink raw reply

* Re: [PATCH] git submodule summary: add --files option
From: Junio C Hamano @ 2009-08-14 19:52 UTC (permalink / raw)
  To: hjemli; +Cc: git, Jens Lehmann
In-Reply-To: <4A846A62.7010306@web.de>

Jens Lehmann <Jens.Lehmann@web.de> writes:

> git submodule summary is providing similar functionality for submodules as
> git diff-index does for a git project (including the meaning of --cached).
> But the analogon to git diff-files is missing, so add a --files option to
> summarize the differences between the index of the super project and the
> last commit checked out in the working tree of the submodule.
>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>

Makes sense to me.  Comments?

^ permalink raw reply

* Re: [PATCH] git-config: Parse config files leniently
From: Junio C Hamano @ 2009-08-14 19:52 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git, David Reitter, Jakub Narebski
In-Reply-To: <a812f567b4541ce55e9c60037a047488a0893c36.1250262273.git.git@drmicha.warpmail.net>

Michael J Gruber <git@drmicha.warpmail.net> writes:

> Currently, git config dies as soon as there is a parsing error. This is
> especially unfortunate in case a user tries to correct config mistakes
> using git config -e.
>
> Instead, issue a warning only and treat the rest of the line as a
> comment (ignore it). This benefits not only git config -e users.

... a broken sentence in the middle?  I would have expected the "not only"
followed by "but also"; the question is "but also what?"

Hopefully the benefit is not that it now allows all the other commands to
cause unspecified types of damage to the repository by following iffy
settings obtained from a broken configuration file.

> Reported-by: David Reitter <david.reitter@gmail.com>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>

> Test had to be adjusted as well.

The change to the test demonstrates the issue rather well.  The check()
shell function does not check the exit value from "git config --get", but
in a real script that cares to check and stop on error, this change will
now let the script go on, leaving the breakage unnoticed.  I suspect
command implemented in C, that call git_config(), will also have the same
issue, and I cannot convince myself this is a good change in general,
outside the scope of helping "git config -e".

But I may be being overly cautious.

By the way, why did you have to change s/echo/printf/?  Can't you give two
lines in a single argument without "\n" escape?

> diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
> index 080117c..be850c5 100755
> --- a/t/t1303-wacky-config.sh
> +++ b/t/t1303-wacky-config.sh
> @@ -9,7 +9,7 @@ setup() {
>  }
>  
>  check() {
> -	echo "$2" >expected
> +	printf "$2\n" >expected
>  	git config --get "$1" >actual 2>&1
>  	test_cmp actual expected
>  }
> @@ -44,7 +44,7 @@ LONG_VALUE=$(printf "x%01021dx a" 7)
>  test_expect_success 'do not crash on special long config line' '
>  	setup &&
>  	git config section.key "$LONG_VALUE" &&
> -	check section.key "fatal: bad config file line 2 in .git/config"
> +	check section.key "warning: bad config file line 2 in .git/config\nwarning: bad config file line 2 in .git/config"
>  '
>  
>  test_done

^ permalink raw reply

* Re: [PATCH v3 2/3] fast-import: add option command
From: Sverre Rabbelier @ 2009-08-14 17:43 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Junio C Hamano, Johannes Schindelin, Git List
In-Reply-To: <20090814173929.GU1033@spearce.org>

Heya,

On Fri, Aug 14, 2009 at 10:39, Shawn O. Pearce<spearce@spearce.org> wrote:
> Sorry, lack of caffeine.  Rereading the docs makes sense.

Perfectly acceptable, I totally though the 'break' in a 'switch'
statement would break out of the outer for loop the other day.

>> > So yea, I really do think its a good idea for command line options
>> > to override stream options, despite what Dscho may think. ?:-)
>>
>> Which is what the current version does, yes?
>
> Yes.  :-)

Ok, I think perhaps we can wait 'nother day to see if anyone notices
anything (possibly after more caffeine) and then ask Junio to apply?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: [PATCH v3 2/3] fast-import: add option command
From: Shawn O. Pearce @ 2009-08-14 17:39 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Johannes Schindelin, Git List
In-Reply-To: <fabb9a1e0908140937h32a2eac7ka88f76aa417fd631@mail.gmail.com>

Sverre Rabbelier <srabbelier@gmail.com> wrote:
> On Fri, Aug 14, 2009 at 08:37, Shawn O. Pearce<spearce@spearce.org> wrote:
> > Sverre Rabbelier <srabbelier@gmail.com> wrote:
> >> +`option`
> >> +~~~~~~~~
> >> +Processes the specified option so that git fast-import behaves in a
> >> +way that suits the frontend's needs.
> >> +Note that options specified by the frontend are overridden by any
> >> +options the user may specify to git fast-import itself.
> >
> > Wha? ?This disagrees with the code.
> 
> It does? It's saying that the user my override what the frontend
> specifies, which is what the current version does.

Sorry, lack of caffeine.  Rereading the docs makes sense.
 
> >> + ? ? if (!seen_non_option_command)
> >> + ? ? ? ? ? ? parse_argv();
> >
> > This is too late.
> 
> No it's not. Earlier in the patch, at the other
> 'seen_non_option_command', we call parse_argv() as well (which happens
> when a non-option command is issued). This statement is here to deal
> with options that affect an empty stream, such as 'git format-patch
> --import-marks=marks.old --export-marks=marks.new < /dev/null &&
> test_cmp marks.old marks.new'.

Oy, I missed that call.  I looked for it but gave up too soon I guess.
 
> > So yea, I really do think its a good idea for command line options
> > to override stream options, despite what Dscho may think. ?:-)
> 
> Which is what the current version does, yes?

Yes.  :-)

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH v3 2/3] fast-import: add option command
From: Sverre Rabbelier @ 2009-08-14 16:37 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Junio C Hamano, Johannes Schindelin, Git List
In-Reply-To: <20090814153707.GT1033@spearce.org>

Heya,

On Fri, Aug 14, 2009 at 08:37, Shawn O. Pearce<spearce@spearce.org> wrote:
> Sverre Rabbelier <srabbelier@gmail.com> wrote:
>> +`option`
>> +~~~~~~~~
>> +Processes the specified option so that git fast-import behaves in a
>> +way that suits the frontend's needs.
>> +Note that options specified by the frontend are overridden by any
>> +options the user may specify to git fast-import itself.
>
> Wha?  This disagrees with the code.

It does? It's saying that the user my override what the frontend
specifies, which is what the current version does.

> This is a nasty refactoring, I would prefer to see it done in its
> own commit, "move option_import_marks so it can be called during
> command processing".

Ok, will do.

>> +     // argv hasn't been parsed yet, do so
>> +     if (!seen_non_option_command)
>> +             parse_argv();
>
> This is too late.

No it's not. Earlier in the patch, at the other
'seen_non_option_command', we call parse_argv() as well (which happens
when a non-option command is issued). This statement is here to deal
with options that affect an empty stream, such as 'git format-patch
--import-marks=marks.old --export-marks=marks.new < /dev/null &&
test_cmp marks.old marks.new'.

> So yea, I really do think its a good idea for command line options
> to override stream options, despite what Dscho may think.  :-)

Which is what the current version does, yes?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: [EGIT] Push to GitHub caused corruption
From: John Bito @ 2009-08-14 16:17 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, Shawn O. Pearce
In-Reply-To: <200908141119.49798.robin.rosenberg.lists@dewire.com>

The repo that was pushed to cause the corruption GitHup has the tree
entry f4f9ecd1875938baa42467dfd6a8134d75fe5de4 in a dangling commit.

I've opened a bug in hopes that will limit the chatter on this list:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=286653

The information below is all in there, as well.

$ git fsck --full f4f9ecd1875938baa42467dfd6a8134d75fe5de4
dangling commit 560a391801d1712b625d4ae317a490529a4ccf08

$ git ls-tree f4f9ecd1875938baa42467dfd6a8134d75fe5de4
100644 blob 9324c851e6816962f87cb772ebc34f9c8036d832    .classpath
100644 blob 1cb465bc1e95c2e088376ac06b363a3aa481c9ce    .project
040000 tree f00fa742e906037190ae0cce70ec235fbf6eab83    .settings
100644 blob 7186ec1ee04722679dd9b8c0567fa522ac0495b3    asql.jardesc
040000 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904    bin-groovy
040000 tree 57548924f1eca854dc8db00844f95d3de2c82957    bin
040000 tree 1156d24cd387c7278bc536d32b09057556a6c60d    lib
040000 tree 3d1f74522c3e7c3c03390fae376446fda6eed306    src

$ git show 560a391801d1712b625d4ae317a490529a4ccf08
commit 560a391801d1712b625d4ae317a490529a4ccf08
Author: John W. Bito <jwbito@XXXX>
Date:   Mon Aug 10 14:01:22 2009 -0700

    Now traverse rows using DB cursor.  Enable statement cache.

diff --git a/ADS/testlib/asql.jar b/ADS/testlib/asql.jar
index bb434c7..155b825 100644
Binary files a/ADS/testlib/asql.jar and b/ADS/testlib/asql.jar differ
diff --git a/ADS/testlib/groovy-all-1.6.1.jar b/ADS/testlib/groovy-all-1.6.1.jar
deleted file mode 100644
index a6252c2..0000000
Binary files a/ADS/testlib/groovy-all-1.6.1.jar and /dev/null differ
diff --git a/ADS/testlib/groovy-all-1.7-beta-1-SNAPSHOT.jar
b/ADS/testlib/groovy-all-1.7-beta-1-SNAPSHOT.jar
new file mode 100644
index 0000000..4d3fec8
Binary files /dev/null and
b/ADS/testlib/groovy-all-1.7-beta-1-SNAPSHOT.jar differ
diff --git a/queryengine/.classpath b/queryengine/.classpath
index 4aab135..9324c85 100644
--- a/queryengine/.classpath
+++ b/queryengine/.classpath
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry excluding="ch/viveo/query/test/resources/"
kind="src" path="src"/>
-	<classpathentry
excluding="bin-groovy/|src/|src/ch/viveo/query/test/resources/"
kind="src" path=""/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/nb_binding"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-	<classpathentry kind="con"
path="org.eclipse.datatools.connectivity.jdt.DRIVERLIBRARY/Oracle Thin
Driver"/>
-	<classpathentry kind="lib" path="/nb_binding/lib/xpp3_min-1.1.4c.jar"/>
-	<classpathentry kind="lib" path="/nb_binding/lib/xstream-1.3.1.jar">
-		<attributes>
-			<attribute name="javadoc_location"
value="http://xstream.codehaus.org/javadoc"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry excluding="ch/viveo/query/test/resources/"
kind="src" path="src"/>
+	<classpathentry
excluding="bin-groovy/|src/|src/ch/viveo/query/test/resources/"
kind="src" path=""/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/nb_binding"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="con"
path="org.eclipse.datatools.connectivity.jdt.DRIVERLIBRARY/Oracle Thin
Driver"/>
+	<classpathentry kind="lib" path="/nb_binding/lib/xpp3_min-1.1.4c.jar"/>
+	<classpathentry kind="lib" path="/nb_binding/lib/xstream-1.3.1.jar">
+		<attributes>
+			<attribute name="javadoc_location"
value="http://xstream.codehaus.org/javadoc"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/queryengine/.settings/org.codehaus.groovy.eclipse.preferences.prefs
b/queryengine/.settings/org.codehaus.groovy.eclipse.preferences.prefs
old mode 100755
new mode 100644
index 1abf79e..c5e9a2e
--- a/queryengine/.settings/org.codehaus.groovy.eclipse.preferences.prefs
+++ b/queryengine/.settings/org.codehaus.groovy.eclipse.preferences.prefs
@@ -1,4 +1,4 @@
-#Tue May 05 14:16:49 PDT 2009
+#Sat Aug 08 14:15:43 PDT 2009
 eclipse.preferences.version=1
 groovy.compiler.output.path=bin-groovy
 support.groovy=true
diff --git a/queryengine/bin-groovy/README b/queryengine/bin-groovy/README
deleted file mode 100644
index 6dd996e..0000000
--- a/queryengine/bin-groovy/README
+++ /dev/null
@@ -1 +0,0 @@
-Folder for Groovy compilation.
diff --git a/queryengine/bin/.settings/org.codehaus.groovy.eclipse.preferences.prefs
b/queryengine/bin/.settings/org.codehaus.groovy.eclipse.preferences.prefs
old mode 100755
new mode 100644
index 1abf79e..c5e9a2e
--- a/queryengine/bin/.settings/org.codehaus.groovy.eclipse.preferences.prefs
+++ b/queryengine/bin/.settings/org.codehaus.groovy.eclipse.preferences.prefs
@@ -1,4 +1,4 @@
-#Tue May 05 14:16:49 PDT 2009
+#Sat Aug 08 14:15:43 PDT 2009
 eclipse.preferences.version=1
 groovy.compiler.output.path=bin-groovy
 support.groovy=true
diff --git a/queryengine/src/ch/viveo/query/TableBinding.groovy
b/queryengine/src/ch/viveo/query/TableBinding.groovy
index 29e0e58..410ebd6 100644
--- a/queryengine/src/ch/viveo/query/TableBinding.groovy
+++ b/queryengine/src/ch/viveo/query/TableBinding.groovy
@@ -7,6 +7,7 @@ import ch.viveo.ads_sql.TableInterface ;
 import ch.viveo.ads_sql.buffer.ClientBuffer;
 import ch.viveo.ads_sql.exceptions.*;
 import groovy.sql.Sql ;
+import groovy.sql.GroovyResultSet ;
 import java.util.logging.Logger;
 import java.util.logging.Level;
 import java.nio.ByteBuffer;
@@ -19,20 +20,20 @@ import java.lang.IllegalStateException
  *
  */
 public class TableBinding implements TableInterface {
+	private static final Logger log =
Logger.getLogger(getClass().getSimpleName());
+
 	private final Structure str;
 	private final Table tab;
 	private final def db;
 	private final def allFieldNames;
-	private final Set<Object> allColumnNames;
+	private final Set<String> allColumnNames;
 	private boolean valid;
 	private boolean open;
 	private def uri;
-	private def rowSet;
+	private GroovyResultSet resultSet;
 	private def queryParams;
 	private def queryKey;
 	private int queryMatchType;
-	private boolean rowSetUsed;
-	private static final Logger log =
Logger.getLogger(getClass().getSimpleName());
 	private final String readQuery;
 	private final String maxUriQuery;
 	private final String sequenceQuery;
@@ -195,8 +196,7 @@ public class TableBinding implements TableInterface {
 	
 	void select(int lockOption){
 		log.log(Level.FINEST, "Parameters: {0}", queryParams)
-		rowSet = db.rows(tab.keys.(lockOption ? "queryStringLock" :
"queryString") (queryKey, queryMatchType), queryParams);
-		rowSetUsed = false;
+		resultSet = db.rowCursor(tab.keys.(lockOption ? "queryStringLock" :
"queryString") (queryKey, queryMatchType), queryParams);
 	}
 	
 	public void selectRange(int keyNumber, int matchOption, ByteBuffer
startValues, ByteBuffer endValues) {
@@ -209,29 +209,23 @@ public class TableBinding implements TableInterface {
 	}

 	private reset() {
-		rowSet = null;
-		rowSetUsed = false
+		if (resultSet && !resultSet.isClosed())
+			resultSet.close();
 	}
 	
 	public int retrieveUris(ByteBuffer result, int lockOption) {
-		if (null == rowSet) {
+		if (null == resultSet) {
 			if (!queryKey)
 				throw new IllegalStateException("No row set available for ${tab.name}");
 			else {
 				select(lockOption);
-				log.log(Level.FINEST, "Select URIs returns {0}: {1}",
rowSet.size(), rowSet)
 			}
 		}
-		if (rowSetUsed)
-			return 0;
-		rowSetUsed = true;
 		IntBuffer urilist = result.asIntBuffer();
 		int count = 0;
-		rowSet.each {
-			if (urilist.position() < urilist.limit()) {
-				urilist.put(it.uri as int)
-				count ++;
-			}
+		while (urilist.position() < urilist.limit() && resultSet.next()) {
+			urilist.put(resultSet.uri as int)
+			count ++;
 		}
 		log.log(Level.FINEST, "retrieveUris returning {0} uris", count);
 		//TODO hold pagination state so next request returns following list elements
@@ -239,6 +233,7 @@ public class TableBinding implements TableInterface {
 	}
 	
 	public void close() {
+		reset();
 		valid = false;
 		open = false;
 		//TODO remove the reference to this in the Process instance
diff --git a/queryengine/src/ch/viveo/query/TableBindingTest.groovy
b/queryengine/src/ch/viveo/query/TableBindingTest.groovy
index 8e2a389..aa448d1 100644
--- a/queryengine/src/ch/viveo/query/TableBindingTest.groovy
+++ b/queryengine/src/ch/viveo/query/TableBindingTest.groovy
@@ -8,7 +8,6 @@ import org.junit.Test
 import org.junit.Before
 import org.junit.After;

-import groovy.sql.Sql;
 import java.nio.ByteBuffer;
 import java.nio.IntBuffer;

@@ -18,6 +17,9 @@ import ch.viveo.ads_sql.TableInterface
 import ch.viveo.ads_sql.buffer.ClientBuffer
 import ch.viveo.ads_sql.test.TestData

+import ch.viveo.query.mgr.Process;
+import ch.viveo.query.sql.SqlCursor;
+
 /**
  * @author John W. Bito
  *
@@ -27,13 +29,17 @@ public class TableBindingTest extends GroovyTestCase {
     def db = null;
     def str, res, fdf, keys;
     ByteBuffer buff;
+
+    public static final String TEST_DRIVER = 'oracle.jdbc.driver.OracleDriver';

     @Before
     public void setUp() throws Exception {
         resource = TestData.genericResource("clienp01.info.xml", this);
         fdf = new FDFTranslator().readXML(new FileReader(resource));
         str = FDFTranslator.createStructure(fdf);
-        db = Sql.newInstance("jdbc:oracle:thin:nbquali5/nbquali51@localhost:1521:nb");
+        Class.forName(TEST_DRIVER)
+        System.setProperty(Process.JDBC_DRIVER_PROPERTY, TEST_DRIVER)
+        db = SqlCursor.newInstance("jdbc:oracle:thin:nbquali5/nbquali51@localhost:1521:nb");
         def tab = new Table("uri_clienp01");
 		res = new TableBinding(str, tab, db);
 		keys = new KeyBinding(tab, str, fdf.key.code);
@@ -65,6 +71,10 @@ public class TableBindingTest extends GroovyTestCase {
 		def rec = readLast();
 		String query = "select * from uri_clienp01 where uri=${res.uri}";
 		def sqlData = db.firstRow(query);
+		sqlData.each { k, v ->
+			println k + "->" + v?.class + "=" + v
+			
+		}
 		assertEquals(sqlData["MAJ0H"], rec["MAJ0H"].value);
 		assertTrue(res.getUnboundColumns().isEmpty());
 		assertTrue(res.getUnboundFields().isEmpty());
@@ -121,7 +131,7 @@ public class TableBindingTest extends GroovyTestCase {
 		
 		res.selectRange(0, TableInterface.MATCHGEKEY1LEKEY2, start, end);
 		res.select(01);
-		assertEquals(12, res.rowSet.size());
+		assertEquals(4, res.queryParams.size());
 	}
 	
 	@Test
diff --git a/queryengine/src/ch/viveo/query/mgr/Process.groovy
b/queryengine/src/ch/viveo/query/mgr/Process.groovy
index 9613e2a..5bce4ed 100644
--- a/queryengine/src/ch/viveo/query/mgr/Process.groovy
+++ b/queryengine/src/ch/viveo/query/mgr/Process.groovy
@@ -4,13 +4,13 @@
 package ch.viveo.query.mgr ;

 import java.nio.ByteBuffer ;
-import groovy.sql.Sql;
 import java.sql.Connection;

 import ch.viveo.ads_sql.FDFTranslator;
 import ch.viveo.ads_sql.TableInterface;

 import ch.viveo.query.*;
+import ch.viveo.query.sql.SqlCursor;

 /**
  * Handle the lifecycle of PDs (Process Definition) and the resources
that map to SQL queries
@@ -28,6 +28,7 @@ public class Process{
 	def dbConnection = null;
 	
 	public static final String CONNECTION_PROPERTY = "ch.viveo.db.connect";
+	public static final String JDBC_DRIVER_PROPERTY = "ch.viveo.db.driver";
 	
 	FDFTranslator loader = null;
 	
@@ -49,10 +50,13 @@ public class Process{
 	private def getConnection() {
 		if (!dbConnection) {
 			String connSpec = System.getProperty(CONNECTION_PROPERTY);
+			String driverName = System.getProperty(JDBC_DRIVER_PROPERTY);
 			if (!connSpec)
 				throw new IllegalArgumentException("$CONNECTION_PROPERTY not set");
-			Class.forName("oracle.jdbc.driver.OracleDriver"); // TODO setup a
proper initialization
-			dbConnection = Sql.newInstance(connSpec);
+			if (driverName)
+				dbConnection = SqlCursor.newInstance(connSpec, driverName);
+			else
+				dbConnection = SqlCursor.newInstance(connSpec);
 		}
 		return dbConnection;
 	}
diff --git a/queryengine/src/ch/viveo/query/sql/SqlCursor.java
b/queryengine/src/ch/viveo/query/sql/SqlCursor.java
new file mode 100644
index 0000000..232ccd3
--- /dev/null
+++ b/queryengine/src/ch/viveo/query/sql/SqlCursor.java
@@ -0,0 +1,149 @@
+/**
+ *
+ */
+package ch.viveo.query.sql;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
+import groovy.sql.GroovyResultSet;
+import groovy.sql.GroovyResultSetProxy;
+import groovy.sql.Sql;
+
+/**
+ * @author IBM User
+ *
+ */
+public class SqlCursor extends Sql {
+
+	/**
+	 * @param dataSource
+	 */
+	public SqlCursor(DataSource dataSource) {
+		super(dataSource);
+		setCacheStatements(true);
+	}
+
+	/**
+	 * @param connection
+	 */
+	public SqlCursor(Connection connection) {
+		super(connection);
+		setCacheStatements(true);
+	}
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL.
+     *
+     * @param url a database url of the form
+     *            <code> jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @return a new Sql instance with a connection
+     * @throws SQLException if a database access error occurs
+     */
+    public static SqlCursor newInstance(String url) throws SQLException {
+        Connection connection = DriverManager.getConnection(url);
+        return new SqlCursor(connection);
+    }
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL
+     * and some properties.
+     *
+     * @param url        a database url of the form
+     *                   <code>
jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @param properties a list of arbitrary string tag/value pairs
+     *                   as connection arguments; normally at least a
"user" and
+     *                   "password" property should be included
+     * @return a new Sql instance with a connection
+     * @throws SQLException if a database access error occurs
+     */
+    public static SqlCursor newInstance(String url, Properties
properties) throws SQLException {
+        Connection connection = DriverManager.getConnection(url, properties);
+        return new SqlCursor(connection);
+    }
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL,
+     * some properties and a driver class name.
+     *
+     * @param url             a database url of the form
+     *                        <code>
jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @param properties      a list of arbitrary string tag/value pairs
+     *                        as connection arguments; normally at
least a "user" and
+     *                        "password" property should be included
+     * @param driverClassName the fully qualified class name of the
driver class
+     * @return a new Sql instance with a connection
+     * @throws SQLException           if a database access error occurs
+     * @throws ClassNotFoundException if the class cannot be found or loaded
+     */
+    public static SqlCursor newInstance(String url, Properties
properties, String driverClassName)
+            throws SQLException, ClassNotFoundException {
+        loadDriver(driverClassName);
+        return newInstance(url, properties);
+    }
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL,
+     * a username and a password.
+     *
+     * @param url      a database url of the form
+     *                 <code> jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @param user     the database user on whose behalf the connection
+     *                 is being made
+     * @param password the user's password
+     * @return a new Sql instance with a connection
+     * @throws SQLException if a database access error occurs
+     */
+    public static SqlCursor newInstance(String url, String user,
String password) throws SQLException {
+        Connection connection = DriverManager.getConnection(url,
user, password);
+        return new SqlCursor(connection);
+    }
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL,
+     * a username, a password and a driver class name.
+     *
+     * @param url             a database url of the form
+     *                        <code>
jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @param user            the database user on whose behalf the connection
+     *                        is being made
+     * @param password        the user's password
+     * @param driverClassName the fully qualified class name of the
driver class
+     * @return a new Sql instance with a connection
+     * @throws SQLException           if a database access error occurs
+     * @throws ClassNotFoundException if the class cannot be found or loaded
+     */
+    public static SqlCursor newInstance(String url, String user,
String password, String driverClassName) throws SQLException,
+            ClassNotFoundException {
+        loadDriver(driverClassName);
+        return newInstance(url, user, password);
+    }
+
+    /**
+     * Creates a new Sql instance given a JDBC connection URL
+     * and a driver class name.
+     *
+     * @param url             a database url of the form
+     *                        <code>
jdbc:<em>subprotocol</em>:<em>subname</em></code>
+     * @param driverClassName the fully qualified class name of the
driver class
+     * @return a new Sql instance with a connection
+     * @throws SQLException           if a database access error occurs
+     * @throws ClassNotFoundException if the class cannot be found or loaded
+     */
+    public static SqlCursor newInstance(String url, String
driverClassName) throws SQLException, ClassNotFoundException {
+        loadDriver(driverClassName);
+        return newInstance(url);
+    }
+
+    public GroovyResultSet rowCursor(String sql, List<Object> params)
throws SQLException {
+    	ResultSet rs = executePreparedQuery(sql, params);
+    	return new GroovyResultSetProxy(rs).getImpl();
+    }
+
+}
diff --git a/queryengine/src/nb.sql b/queryengine/src/nb.sql
index 277ff44..7c2c875 100644
--- a/queryengine/src/nb.sql
+++ b/queryengine/src/nb.sql
@@ -100,4 +100,8 @@ delete from clienp01 where uri > 1500;
 desc uri_clienp01;

 select distinct nom0x from clienp01
-select uri from clienp01 where nom0x = 'CL99898000'
\ No newline at end of file
+select uri from clienp01 where nom0x = 'CL99898000'
+
+alter table uri_clienp01 add  (time timestamp)
+alter table uri_clienp01 drop column time
+update uri_clienp01 set time = current_timestamp
\ No newline at end of file


On Fri, Aug 14, 2009 at 02:19, Robin
Rosenberg<robin.rosenberg.lists@dewire.com> wrote:
> f4f9ecd1875938baa42467dfd6a8134d75fe5de4

^ permalink raw reply related

* Re: merging individual files
From: Chris Marshall @ 2009-08-14 16:14 UTC (permalink / raw)
  To: git
In-Reply-To: <4A858B3B.3000208@drmicha.warpmail.net>

Michael J Gruber <git <at> drmicha.warpmail.net> writes:
> > If you're on br1, I would:
> > 
> > git rebase -i X^
> > # change "pick" to "edit" in front of X in the list you get
> > git checkout X^ -- f3 f4 f5
> > git commit --amend
> > git checkout X -- f3 f4 f5
> > git commit
> 
> followed by
> 
> git rebase --continue
> 
> of course ;)
> 
> > 
> > For the 2nd commit, using the -c option may be beneficial.
> > 
> > Cheers,
> > Michael
> > 
> 
> 

Michael:

Thanks so much for your help, this is a lot of fun!

It occurs to me that another way (that doesn't use rebase) would be this:
git branch -m br1 br1-old
git checkout br1-old
git reset HEAD~
git checkout -b br1
git add f1
git commit -m "f1"
git add f2 f3
git commit -m "f2"
git branch -d br1-old (history eraser button ;-)

git checkout master
git merge br1~ (which now only pulls f1's changes)
(work for a while)
git merge br1 (which now pulls f2 and f3).

I like this sequence because it's so explicit about what's going on.

Are there any conceptual problems going this route that I am missing that might
screw up history?

Chris Marshall

^ permalink raw reply

* Re: merging individual files
From: Michael J Gruber @ 2009-08-14 16:05 UTC (permalink / raw)
  Cc: Chris Marshall, git
In-Reply-To: <4A858298.4020702@drmicha.warpmail.net>

Michael J Gruber venit, vidit, dixit 14.08.2009 17:28:
> Chris Marshall venit, vidit, dixit 14.08.2009 16:31:
>> Michael J Gruber <git <at> drmicha.warpmail.net> writes:
>>>> This strikes me as not too bad of a procedure, as long as there is a 
>> graceful
>>>> way of determining the most recent common ancestor of br1 and master.  
>> What's
>>>> the simplest way of doing that?
>>>>
>>>
>>> That would be simply git merge-base master br1.
>>>
>>> BUT: The main problem here is that git is not file based, but
>>> revision/commit/tree based. In the above, you're basically losing all
>>> the history common_ancestor_commit..br1 which produced br1's version of
>>> f1 and f2, in the sense that a git log master will not show that part of
>>> the history at all.
>>
>> Well put, I agree.  One of the main arguments I am going to use to try to 
>> convince my fellows to switch from perforce to git is the usefulness of git 
>> blame.  I would be defeating that with my procedure.
>>
>>>
>>> If it makes sense to change f1 and f2 without changing f3 that probably
>>> means that the pertinent commit should have been split. Is it an option
>>> for you to rewrite br1's history? That would be the most gittish solution.
>>
>> Yes, I like the idea of rewriting br1's history.
>>
>> So, given that f1, f2, ..., fn were changed together in one commit X on br1, I 
>> want to break f1 and f2 out of X and put them into X', then leave the rest of 
>> the f3,...,fn changes in Y'.
>>
>> Let's say X was the last commit on br1.  
>>
>> What would the commands to do that look like?
>>
> 
> If you're on br1, I would:
> 
> git rebase -i X^
> # change "pick" to "edit" in front of X in the list you get
> git checkout X^ -- f3 f4 f5
> git commit --amend
> git checkout X -- f3 f4 f5
> git commit

followed by

git rebase --continue

of course ;)

> 
> For the 2nd commit, using the -c option may be beneficial.
> 
> Cheers,
> Michael
> 

^ permalink raw reply

* http-push sends MKCOL command to create remote directory MKCOL http://user@server:80/url/.git/refs/ that already exists
From: willievu @ 2009-08-14 15:42 UTC (permalink / raw)
  To: git


Steps will reproduce the problem:
1. create a bare & shared repository locally and copy to remote server
2. create a local repository. add and commit some files
3. git push to the remote server

$ git push --verbose --thin upload HEAD
Pushing to http://user@server/url/.git/
Password:
Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating 'refs/heads/master' using 'HEAD'
  from 0000000000000000000000000000000000000000
  to   0120f45ebfd90501868e990bfbb9f50fb0a8ebae

<<<<< Here, a MKCOL http://user@server:80/url/.git/refs/ request is sent.  
The WebDAV server returns a HTTP 500 Internal Server Error.  Then, the 
following message continues:

Unable to create branch path http://user@server/url/.git/refs/
Unable to lock remote branch refs/heads/master
error: failed to push some refs to 'http://user@server/url/.git/'

This is the server:

Server: Oracle9iAS/9.0.2.3.0 Oracle HTTP Server (Unix) mod_plsql/9.0.2.6.0b 
DAV/1.0.3.2.4-0119 (OraDAV enabled) mod_osso/9.0.2.0.0 mod_ossl/9.0.2.0.0 
mod_fastcgi/2.2.12 mod_perl/1.26 mod_oc4j/3.0

Is MKCOL expected even for existing directory in the remote repository?  Is
this a WebDAV server problem that 500 is returned?

-- 
View this message in context: http://n2.nabble.com/http-push-sends-MKCOL-command-to-create-remote-directory-MKCOL-http%3A--user%40server%3A80-url-.git-refs--that-already-exists-tp3445796p3445796.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [PATCH v3 2/3] fast-import: add option command
From: Shawn O. Pearce @ 2009-08-14 15:37 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Johannes Schindelin, Git List
In-Reply-To: <1250190156-4752-3-git-send-email-srabbelier@gmail.com>

Sverre Rabbelier <srabbelier@gmail.com> wrote:
> +`option`
> +~~~~~~~~
> +Processes the specified option so that git fast-import behaves in a
> +way that suits the frontend's needs.
> +Note that options specified by the frontend are overridden by any
> +options the user may specify to git fast-import itself.

Wha?  This disagrees with the code.

> +static void read_marks(void)
> +{
> +	char line[512];
> +	FILE *f = fopen(input_file, "r");
...
> +static void option_import_marks(const char *marks)
>  {
> -	char line[512];
> -	FILE *f = fopen(input_file, "r");

This is a nasty refactoring, I would prefer to see it done in its
own commit, "move option_import_marks so it can be called during
command processing".

> @@ -2517,9 +2556,16 @@ int main(int argc, const char **argv)
>  			parse_checkpoint();
>  		else if (!prefixcmp(command_buf.buf, "progress "))
>  			parse_progress();
> +		else if (!prefixcmp(command_buf.buf, "option "))
> +			parse_option();
>  		else
>  			die("Unsupported command: %s", command_buf.buf);
>  	}
> +
> +	// argv hasn't been parsed yet, do so
> +	if (!seen_non_option_command)
> +		parse_argv();

This is too late.  Options like --date-format or --max-pack-size or
--depth or --active-branches all influence the command processing
above.  Parsing these at the end means they have no affect on the
import, which is wrong.

Oh, and --active-branches or --max-pack-size or --depth are really
good examples of things that maybe you do want to override on the
command line.  They have impact only on memory usage of the running
import process, and the local disk usage.  Maybe the frontend has
given too many active branches for your physical memory, and you
want a lower threshold.

So yea, I really do think its a good idea for command line options
to override stream options, despite what Dscho may think.  :-)

-- 
Shawn.

^ permalink raw reply

* Re: merging individual files
From: Michael J Gruber @ 2009-08-14 15:28 UTC (permalink / raw)
  To: Chris Marshall; +Cc: git
In-Reply-To: <loom.20090814T135614-375@post.gmane.org>

Chris Marshall venit, vidit, dixit 14.08.2009 16:31:
> Michael J Gruber <git <at> drmicha.warpmail.net> writes:
>>> This strikes me as not too bad of a procedure, as long as there is a 
> graceful
>>> way of determining the most recent common ancestor of br1 and master.  
> What's
>>> the simplest way of doing that?
>>>
>>
>> That would be simply git merge-base master br1.
>>
>> BUT: The main problem here is that git is not file based, but
>> revision/commit/tree based. In the above, you're basically losing all
>> the history common_ancestor_commit..br1 which produced br1's version of
>> f1 and f2, in the sense that a git log master will not show that part of
>> the history at all.
> 
> Well put, I agree.  One of the main arguments I am going to use to try to 
> convince my fellows to switch from perforce to git is the usefulness of git 
> blame.  I would be defeating that with my procedure.
> 
>>
>> If it makes sense to change f1 and f2 without changing f3 that probably
>> means that the pertinent commit should have been split. Is it an option
>> for you to rewrite br1's history? That would be the most gittish solution.
> 
> Yes, I like the idea of rewriting br1's history.
> 
> So, given that f1, f2, ..., fn were changed together in one commit X on br1, I 
> want to break f1 and f2 out of X and put them into X', then leave the rest of 
> the f3,...,fn changes in Y'.
> 
> Let's say X was the last commit on br1.  
> 
> What would the commands to do that look like?
> 

If you're on br1, I would:

git rebase -i X^
# change "pick" to "edit" in front of X in the list you get
git checkout X^ -- f3 f4 f5
git commit --amend
git checkout X -- f3 f4 f5
git commit

For the 2nd commit, using the -c option may be beneficial.

Cheers,
Michael

^ permalink raw reply

* [PATCH] git-config: Parse config files leniently
From: Michael J Gruber @ 2009-08-14 15:10 UTC (permalink / raw)
  To: git; +Cc: David Reitter, Jakub Narebski, Junio C Hamano
In-Reply-To: <A5CDBB91-E889-4849-953A-2C1DB4A04513@gmail.com>

Currently, git config dies as soon as there is a parsing error. This is
especially unfortunate in case a user tries to correct config mistakes
using git config -e.

Instead, issue a warning only and treat the rest of the line as a
comment (ignore it). This benefits not only git config -e users.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Reported-by: David Reitter <david.reitter@gmail.com>
---
The diff and stat are overstatements. I had to shift that whole for loop
by one tab stop but diff (with or without --color-words) does not recognize
this. Nothing inside the loop is changed.
The outer while makes sure that
* we switch to comment mode after a parsing error
* we return eventually no matter whether the file ends with \n or not.

Test had to be adjusted as well.

 config.c                |   80 ++++++++++++++++++++++++----------------------
 t/t1303-wacky-config.sh |    4 +-
 2 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/config.c b/config.c
index e87edea..5e0af5d 100644
--- a/config.c
+++ b/config.c
@@ -207,50 +207,54 @@ static int git_parse_file(config_fn_t fn, void *data)
 	static const unsigned char *utf8_bom = (unsigned char *) "\xef\xbb\xbf";
 	const unsigned char *bomptr = utf8_bom;
 
-	for (;;) {
-		int c = get_next_char();
-		if (bomptr && *bomptr) {
-			/* We are at the file beginning; skip UTF8-encoded BOM
-			 * if present. Sane editors won't put this in on their
-			 * own, but e.g. Windows Notepad will do it happily. */
-			if ((unsigned char) c == *bomptr) {
-				bomptr++;
+	while (!config_file_eof) {
+		for (;;) {
+			int c = get_next_char();
+			if (bomptr && *bomptr) {
+				/* We are at the file beginning; skip UTF8-encoded BOM
+				 * if present. Sane editors won't put this in on their
+				 * own, but e.g. Windows Notepad will do it happily. */
+				if ((unsigned char) c == *bomptr) {
+					bomptr++;
+					continue;
+				} else {
+					/* Do not tolerate partial BOM. */
+					if (bomptr != utf8_bom)
+						break;
+					/* No BOM at file beginning. Cool. */
+					bomptr = NULL;
+				}
+			}
+			if (c == '\n') {
+				if (config_file_eof)
+					return 0;
+				comment = 0;
 				continue;
-			} else {
-				/* Do not tolerate partial BOM. */
-				if (bomptr != utf8_bom)
+			}
+			if (comment || isspace(c))
+				continue;
+			if (c == '#' || c == ';') {
+				comment = 1;
+				continue;
+			}
+			if (c == '[') {
+				baselen = get_base_var(var);
+				if (baselen <= 0)
 					break;
-				/* No BOM at file beginning. Cool. */
-				bomptr = NULL;
+				var[baselen++] = '.';
+				var[baselen] = 0;
+				continue;
 			}
-		}
-		if (c == '\n') {
-			if (config_file_eof)
-				return 0;
-			comment = 0;
-			continue;
-		}
-		if (comment || isspace(c))
-			continue;
-		if (c == '#' || c == ';') {
-			comment = 1;
-			continue;
-		}
-		if (c == '[') {
-			baselen = get_base_var(var);
-			if (baselen <= 0)
+			if (!isalpha(c))
+				break;
+			var[baselen] = tolower(c);
+			if (get_value(fn, data, var, baselen+1) < 0)
 				break;
-			var[baselen++] = '.';
-			var[baselen] = 0;
-			continue;
 		}
-		if (!isalpha(c))
-			break;
-		var[baselen] = tolower(c);
-		if (get_value(fn, data, var, baselen+1) < 0)
-			break;
+		warning("bad config file line %d in %s", config_linenr, config_file_name);
+		comment = 1;
 	}
-	die("bad config file line %d in %s", config_linenr, config_file_name);
+	return -1;
 }
 
 static int parse_unit_factor(const char *end, unsigned long *val)
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 080117c..be850c5 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -9,7 +9,7 @@ setup() {
 }
 
 check() {
-	echo "$2" >expected
+	printf "$2\n" >expected
 	git config --get "$1" >actual 2>&1
 	test_cmp actual expected
 }
@@ -44,7 +44,7 @@ LONG_VALUE=$(printf "x%01021dx a" 7)
 test_expect_success 'do not crash on special long config line' '
 	setup &&
 	git config section.key "$LONG_VALUE" &&
-	check section.key "fatal: bad config file line 2 in .git/config"
+	check section.key "warning: bad config file line 2 in .git/config\nwarning: bad config file line 2 in .git/config"
 '
 
 test_done
-- 
1.6.4.225.gb589e

^ permalink raw reply related

* Re: merging individual files
From: Chris Marshall @ 2009-08-14 14:31 UTC (permalink / raw)
  To: git
In-Reply-To: <4A851887.5010701@drmicha.warpmail.net>

Michael J Gruber <git <at> drmicha.warpmail.net> writes:
> > This strikes me as not too bad of a procedure, as long as there is a 
graceful
> > way of determining the most recent common ancestor of br1 and master.  
What's
> > the simplest way of doing that?
> > 
> 
> That would be simply git merge-base master br1.
> 
> BUT: The main problem here is that git is not file based, but
> revision/commit/tree based. In the above, you're basically losing all
> the history common_ancestor_commit..br1 which produced br1's version of
> f1 and f2, in the sense that a git log master will not show that part of
> the history at all.

Well put, I agree.  One of the main arguments I am going to use to try to 
convince my fellows to switch from perforce to git is the usefulness of git 
blame.  I would be defeating that with my procedure.

> 
> If it makes sense to change f1 and f2 without changing f3 that probably
> means that the pertinent commit should have been split. Is it an option
> for you to rewrite br1's history? That would be the most gittish solution.

Yes, I like the idea of rewriting br1's history.

So, given that f1, f2, ..., fn were changed together in one commit X on br1, I 
want to break f1 and f2 out of X and put them into X', then leave the rest of 
the f3,...,fn changes in Y'.

Let's say X was the last commit on br1.  

What would the commands to do that look like?

^ permalink raw reply

* Re: git config -> "fatal: bad config file"
From: Jakub Narebski @ 2009-08-14 14:28 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: David Reitter, git
In-Reply-To: <4A85724C.5060406@drmicha.warpmail.net>

Michael J Gruber <git@drmicha.warpmail.net> writes:
> David Reitter venit, vidit, dixit 14.08.2009 15:38:

> > I made a mistake editing my config file using "git config -e".  This  
> > caused git commands to fail.
> > 
> > Trying to fix the problem, I did
> > 
> > git config -e
> > fatal: bad config file line 7 in .git/config
> > 
> > I think the refusal to edit a broken config file is not a good idea.   
> > It's easy to fix for me of course by editing .git/config directly, but  
> > git-config should probably not read the config file at all.
> > 
> > Thanks for your consideration.
> > 
> 
> git needs to read the file because the editor could be configured there!
> The only option would be to make git config -e continue past that error.

Well, it shows you which file the error is, but I think as a special
case "git config [file] --edit" should show also (absolute?) pathname
of the file it tired to open.

core.editor can be in any place.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* Re: git config -> "fatal: bad config file"
From: David Reitter @ 2009-08-14 14:26 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git
In-Reply-To: <4A85724C.5060406@drmicha.warpmail.net>

On Aug 14, 2009, at 10:18 AM, Michael J Gruber wrote:

> git needs to read the file because the editor could be configured  
> there!
> The only option would be to make git config -e continue past that  
> error.


Syntax errors in .git/config could lead to warnings. Since the file is  
primarily line-oriented anyways (except for groups), recovery should  
be easy.

Also, you could have git-config -e edit a temporary file, check the  
file for errors after editing and then move it to .git/config.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox