* Re: [PATCH] perl: add new module Git::Config for cached 'git config' access
From: Jakub Narebski @ 2009-04-08 10:18 UTC (permalink / raw)
To: Sam Vilain; +Cc: Frank Lichtenheld, git, Petr Baudis
In-Reply-To: <49DC3ADD.5000902@catalyst.net.nz>
By the way, did you take a look how cached 'git config' access and
typecasting is done in gitweb? See commit b201927 (gitweb: Read
repo config using 'git config -z -l') and following similar commits.
On Wed, 8 April 2009, Sam Vilain wrote:
> Jakub Narebski wrote:
>>> - my ($item, $value) = m{(.*?)=(.*)};
>>> + my ($item, $value) = m{(.*?)\n((?s:.*))\0}
>>> + or die "failed to parse it; \$_='$_'";
>>
>> Errr... wouldn't it be better to simply use
>>
>> + my ($item, $value) = split("\n", $_, 2)
>>
>> here?
>
> Yeah, I guess that's easier to read and possibly faster; both are
> using the regexp engine and using COW strings though, so it's probably
> not as bad as one might think.
The version using 'split' has the advantage that for config variable
with no value (e.g. "[section] noval") it sets $item (why this variable
is called $item and not $var, $variable or $key, BTW.?) to fully
qualified variable name (e.g. "section.noval"), and sets $value to
undef, instead of failing like your original version using regexp.
And I also think that this version is easier to understand, and might be
a bit faster as well; but it is more important to be easier to
understand.
>> Have you tested Git::Config with a "null" value, i.e. something
>> like
>>
>> [section]
>> noval
>>
>> in the config file (which evaluates to 'true' with '--bool' option)?
>> Because from what I remember from the discussion on the
>> "git config --null --list" format the lack of "\n" is used to
>> distinguish between noval (which is equivalent to 'true'), and empty
>> value (which is equivalent to 'false')
>>
>> [boolean]
>> noval # equivalent to 'true'
>> empty1 = # equivalent to 'false'
>> empty2 = "" # equivalent to 'false'
>
> That I didn't consider. Below is a patch for this. Any more
> gremlins?
I have nor examined your patch in detail; I'll try to do it soon,
but with git config file parsing there lies following traps.
1. In fully qualified variable name section name and variable name
have to be compared case insensitive (or normalized, i.e.
lowercased), while subsection part (if it exists) is case sensitive.
2. When coercing type to bool, you need to remember (and test) that
there are values which are truish (no value, 'true', 'yes', non-zero
integer usually 1), values which are falsish (empry, 'false', 'no',
0); other values IIRC are truish too.
3. When coercing type to int, you need to remember about optional
value suffixes: 'k', 'm' or 'g'.
4. I don't know if you remembered about 'colorbool' and 'color'; the
latter would probably require some extra CPAN module for ANSI color
escapes... or copying color codes from the C version.
>
> Subject: perl: fix no value items in Git::Config
>
> When interpreted as boolean, items in the configuration which do not
> have an '=' are interpreted as true. Parse for this situation, and
> represent it with an object in the state hash which works a bit like
> undef, but isn't.
Why not represent it simply as an 'undef'? You can always distinguish
between not defined and not existing by using 'exists'...
> Sneak a couple of vim footer changes in too.
Hmmm...
>
> Signed-off-by: Sam Vilain <sam@vilain.net>
[...]
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH] perl: add new module Git::Config for cached 'git config' access
From: Sam Vilain @ 2009-04-08 10:44 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Sam Vilain, Frank Lichtenheld, git, Petr Baudis
In-Reply-To: <200904081218.39984.jnareb@gmail.com>
Jakub Narebski wrote:
> By the way, did you take a look how cached 'git config' access and
> typecasting is done in gitweb? See commit b201927 (gitweb: Read
> repo config using 'git config -z -l') and following similar commits.
>
Right ... sure, looks fairly straightforward. I guess gitweb could
potentially use this tested module instead of including that code
itself. Also various parts of git-svn... anything really.
I actually wrote this code because I wanted something a bit nicer for
writing the mirror-sync initial implementations. And I wanted to have a
bit of control over when values get committed, and save work for
reading, so I wrote this.
>> Any more gremlins?
>>
> I have nor examined your patch in detail; I'll try to do it soon,
> but with git config file parsing there lies following traps.
>
> 1. In fully qualified variable name section name and variable name
> have to be compared case insensitive (or normalized, i.e.
> lowercased), while subsection part (if it exists) is case sensitive.
>
I noticed that 'git config' hides this by normalising the case of what
it outputs with 'git config --list'; do you think anything special is
required in light of this?
> 2. When coercing type to bool, you need to remember (and test) that
> there are values which are truish (no value, 'true', 'yes', non-zero
> integer usually 1), values which are falsish (empry, 'false', 'no',
> 0); other values IIRC are truish too.
>
Yep, see the Git::Config::boolean mini-package which has a list of
those. I think I used the documented legal values, which are 'true',
'yes' and '1' for affirmative and 'false', 'no' and '0' for negative. I
guess I could make that include non-zero integers as well.
> 3. When coercing type to int, you need to remember about optional
> value suffixes: 'k', 'm' or 'g'.
>
Yep, covered on input and output :-). See Git::Config::integer for the
conversion functions.
> 4. I don't know if you remembered about 'colorbool' and 'color'; the
> latter would probably require some extra CPAN module for ANSI color
> escapes... or copying color codes from the C version.
>
Yeah, I thought those could probably be done with a follow-up patch.
It's just a matter of writing functions Git::Config::color::thaw and
::freeze.
> Why not represent it simply as an 'undef'? You can always distinguish
> between not defined and not existing by using 'exists'...
>
I don't like 'undef' being a data value. In this case I was already
using setting a value to undef to tell the module to remove the key from
the config file. But in any case you should not need to care what form
the values exist in the internal ->{read_state} hash, as you should
always be retrieving them using the ->config method, which will marshall
them into the type you want. Note it's always the same object, just
like Perl's &PL_undef via the C API.
>> Sneak a couple of vim footer changes in too.
>>
>
> Hmmm...
>
Guess someone noticed them. Oh well, rebase time ...
Thanks for your input Jakub, I'll incorporate your suggestions.
Sam
^ permalink raw reply
* Re: [RFC/PATCH] git-submodule: add support for --rebase.
From: Johannes Schindelin @ 2009-04-08 10:44 UTC (permalink / raw)
To: Peter Hutterer; +Cc: git
In-Reply-To: <20090408042212.GA4702@dingo.bne.redhat.com>
Hi,
On Wed, 8 Apr 2009, Peter Hutterer wrote:
> On Tue, Apr 07, 2009 at 02:38:37PM +0200, Johannes Schindelin wrote:
>
> > Peter wrote originally:
> >
> > > diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> > > index 3b8df44..117ad3d 100644
> > > --- a/Documentation/git-submodule.txt
> > > +++ b/Documentation/git-submodule.txt
> > > @@ -177,6 +178,12 @@ OPTIONS
> > > This option is only valid for the update command.
> > > Don't fetch new objects from the remote site.
> > >
> > > +--rebase::
> > > + This option is only valid for the update command.
> >
> > This is unnecessary, it was mentioned in the synopsis.
>
> Correct, but in the same file the options --cached, --no-fetch, and
> --summary-limit do state that they are only valid for the
> update/status/summary commands, respectively. For consistency, we should
> either add this sentence to --rebase, or remove them from the others. I
> personally prefer having it there, just to make it more obvious.
Fair enough!
> > > + Forward-port local commits to the index of the containing repository.
> >
> > This is a bit misleading/unclear. I'd rather have it read like this:
> >
> > Instead of detaching the HEAD to the revision committed in the
> > superproject, rebase the current branch onto that revision.
>
> Hehe. I had something like this before and then decided to copy/paste
> the line from the git-rebase man page :)
>
> Changed to: "Rebase the current branch onto the index of the containing
> repository instead of detaching the HEAD." (I vaguely remember the rule
> that sentences are easier to understand if you have "blah instead of
> foo" rather than "instead of foo, blah")
> The phrase "index of the containing repository" is commonly used in this
> man page, so I think it's best to stick with it. That better now?
Hmm.
You can really rebase only onto a commit. And the index is not a commit,
so I do not like the wording (not even in the rebase man page).
But let's see what other reviewers say... :-)
> > > + If a a merge failure prevents this process, you will have to resolve
> > > + these failures with linkgit:git-rebase[1].
> > > +
> > > <path>...::
> > > Paths to submodule(s). When specified this will restrict the command
> > > to only operate on the submodules found at the specified paths.
> > > diff --git a/git-submodule.sh b/git-submodule.sh
> > > index 7c2e060..6180bf4 100755
> > > --- a/git-submodule.sh
> > > +++ b/git-submodule.sh
> >
> > You might want to error out when --rebase was passed with another
> > command than "update".
>
> cmd_init(), cmd_summary(), etc. have catch-all rules for unknown options
> to display the usage, so this is covered. (e.g. line 439,
> git-submodule.sh)
Oh, okay!
Other than the wording, I am completely happy with this patch.
Ciao,
Dscho
^ permalink raw reply
* Re: Showing the version of a file that's in the Index.
From: Johannes Schindelin @ 2009-04-08 11:04 UTC (permalink / raw)
To: Teemu Likonen; +Cc: markus.heidelberg, Tim Visher, Git Mailing List
In-Reply-To: <87y6ubvix7.fsf@iki.fi>
Hi,
On Wed, 8 Apr 2009, Teemu Likonen wrote:
> On 2009-04-07 23:57 (+0200), Markus Heidelberg wrote:
>
> > Teemu Likonen, 07.04.2009:
> >> Or
> >>
> >> git show :file
> >
> > Huh, I use git-show daily for commits, but I completely forgot about it
> > for files when replying.
>
> It's nice for trees too:
>
> git show HEAD~3:
> git show master~1:directory/
But that's not in the index, and my patch to show cache-trees was
rejected.
Ciao,
Dscho
^ permalink raw reply
* Re: Alles wird Git
From: A Large Angry SCM @ 2009-04-08 11:20 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0904080420160.10279@pacific.mpi-cbg.de>
Johannes Schindelin wrote:
> Hi,
>
> On Tue, 7 Apr 2009, A Large Angry SCM wrote:
>
>> [CC list trimmed since I don't Junio is that interested in what this thread
>> has morphed into.]
>>
>> Johannes Schindelin wrote:
>>
>>> We could even use the opportunity for a little informal German
>>> GitTogether... "Alles wird Git!"?
>> Could you translate that for the Deutsch-challenged among us?
>
> No problem:
>
> Everything is going to be alright.
>
> (with the "alright" part misspelt so it reads "git" ;-)
>
>> According to the /current/ itinerary, the evenings I have free in Berlin
>> are Saturday Oct 3 and Monday Oct 5.
>
> Sir, we have a date.
Which date?
^ permalink raw reply
* [PATCH] process_{tree,blob}: Remove useless xstrdup calls
From: Björn Steinbrink @ 2009-04-08 11:28 UTC (permalink / raw)
To: Nicolas Pitre
Cc: Jakub Narebski, Sverre Rabbelier, david, Junio C Hamano,
Nicolas Sebrecht, Robin H. Johnson, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0904070903020.6741@xanadu.home>
The name of the processed object was duplicated for passing it to
add_object(), but that already calls path_name, which allocates a new
string anyway. So the memory allocated by the xstrdup calls just went
nowhere, leaking memory.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
---
This reduces the RSS usage for a "rev-list --all --objects" by about 10% on
the gentoo repo (fully packed) as well as linux-2.6.git:
gentoo:
| old | new
----------------|-------------------------------
RSS | 1537284 | 1388408
VSZ | 1816852 | 1667952
time elapsed | 1:49.62 | 1:48.99
min. page faults| 417178 | 379919
linux-2.6.git:
| old | new
----------------|-------------------------------
RSS | 324452 | 292996
VSZ | 491792 | 460376
time elapsed | 0:14.53 | 0:14.28
min. page faults| 89360 | 81613
list-objects.c | 2 --
reachable.c | 1 -
2 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/list-objects.c b/list-objects.c
index c8b8375..dd243c7 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -23,7 +23,6 @@ static void process_blob(struct rev_info *revs,
if (obj->flags & (UNINTERESTING | SEEN))
return;
obj->flags |= SEEN;
- name = xstrdup(name);
add_object(obj, p, path, name);
}
@@ -78,7 +77,6 @@ static void process_tree(struct rev_info *revs,
if (parse_tree(tree) < 0)
die("bad tree object %s", sha1_to_hex(obj->sha1));
obj->flags |= SEEN;
- name = xstrdup(name);
add_object(obj, p, path, name);
me.up = path;
me.elem = name;
diff --git a/reachable.c b/reachable.c
index 3b1c18f..b515fa2 100644
--- a/reachable.c
+++ b/reachable.c
@@ -48,7 +48,6 @@ static void process_tree(struct tree *tree,
obj->flags |= SEEN;
if (parse_tree(tree) < 0)
die("bad tree object %s", sha1_to_hex(obj->sha1));
- name = xstrdup(name);
add_object(obj, p, path, name);
me.up = path;
me.elem = name;
--
1.6.2.2.446.gfbdc0.dirty
^ permalink raw reply related
* Bug report - git show <tagname> together with --pretty=format
From: Cornelius @ 2009-04-08 12:56 UTC (permalink / raw)
To: git
Hi,
I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's
output for parsing the git data, so this is more than a minor issue for
me. When you normally do a git show on a tag name it's output resembles
the following:
tag <tagname>
Tagger: Cornelius <c.r1@gmx.de>
Date: Wed Apr 8 14:39:17 2009 +0200
tagmessage
commit 77e312e0527f87604e4c70ebf6040e79bb55d2ed
<snip>
Now when you do a git show <tagname>
--pretty=format:"ENDOFGITTAGOUTPUTMESAGEHERE%n%H" --
the Date: line is missing. Git 1.6.0.5 (which is avaible in my distro's
repos) doesn't have this issue. Please CC me, I'm not subcribed here.
Cornelius
^ permalink raw reply
* Sooo big that she will be amazed!
From: Caspar Thornton @ 2009-04-08 13:14 UTC (permalink / raw)
To: git
Imagine, how happy she will be if you take a blue pilule.
http://npmgng.gooddoctorsite.at/
^ permalink raw reply
* Re: [PATCH RFC 1/6] send-email: Add --delay for separating emails
From: Michael Witten @ 2009-04-08 14:25 UTC (permalink / raw)
To: Jeff King, Nicolas Sebrecht, Junio C Hamano; +Cc: git
On Tue, Apr 07, 2009 at 04:25:17PM -0500, Michael Witten wrote:
>> When sending a patch series, the emails often arrive at the final
>> destination out of order; though these emails should be chained
>> via the In-Reply-To headers, some mail-viewing systems display
>> by order of arrival instead.
>>
>> The --delay option provides a means for specifying that there
>> should be a certain number of seconds of delay between sending
>> emails, so that the arrival order can be controlled better.
On Tue, Apr 7, 2009 at 16:51, Jeff King wrote:
> I'm a little dubious how well this works in practice. Have you done
> any experiments?
I have indeed, and I got better results. Whether that was a fluke,
I can't say for sure.
> [Delivery delays] can be much larger than a few seconds, and this
> won't help at all there.
and
On Tue, Apr 7, 2009 at 18:17, Junio C Hamano wrote:
> I do not think giving N second interval at the sending end would
> help much in the real world. Between your submitting MUA (that's
> "git-send-email") and the client MUA, there are many hops involved...
> any single hop can batch the messages that arrive within a small time
> window before passing them to the next hop, and it can reorder the
> messages when it does so.
>
> In short, the only thing your --delay can control is the arrival
> interval at your outgoing MSA. The arrival interval and order of
> messages are outside your control for later hops.
For the most part, yes, I am operating under the assumption that email
is sent as soon as it is received by any intervening hop (no batch
accumulation). However, I'm also postulating that there always exists
an N that serves as an upperbound on the transit time, regardless of
batching.
That's where these comment comes into play:
On Tue, Apr 7, 2009 at 16:51, Jeff King wrote:
> The reason I am dubious is that you are presumably delaying only a few
> seconds (since anything more would be quite annoying to the user).
On Wed, Apr 8, 2009 at 01:03:
> A multi-second delay is downright annoying. As a sender, I don't think
> I would enable this option.
However, this sentiment doesn't make sense to me.
Firstly, I presume that someone is electing to use this option, so it is
almost by definition not annoying for that person.
Secondly, it seems reasonable to drop into another VC, screen window, or
terminal instance, and then set send-email a-running. For instance, with
a 14-patch series, one could set `--delay 60' and then let send-email
run happily for the next 14 minutes with nary a thought.
However, I think you're coming at it from a different angle:
On Wed, Apr 8, 2009 at 01:03, Jeff King wrote:
> But apparently many readers sort by date received. See this subthread:
>
> http://article.gmane.org/gmane.comp.version-control.git/110097
>
> I am generally of the opinion that if it is a big problem for people,
> they should get a better mail client. But I am also open to suggestions
> for helping receivers on crappy mail clients as long as those
> suggestions do not put a burden on the sender.
and
on Tue, Apr 7, 2009 at 17:08, Nicolas Sebrecht wrote:
> If the receiver wants the patch series be in a good ordered _for
> sure_, he has to switch to a client mail supporting the In-Reply-To
> chains.
Frankly, I don't care how other people's patch series appear to me. I care
about how mine appear to others. Is this irrational? Probably, but I'm kind
of OC; I want my patch series to look like it's in order for everyone.
This has nothing to do with what the receiver wants. This has everything
to do with what the sender wants. I want my patch series to be in order
even for wrongheaded receivers.
So, I never had any intention of forcing a delay on the sending end. It is
strictly for the sending end to use if desired.
On Tue, Apr 7, 2009 at 18:17, Junio C Hamano wrote:
> I think send-email already has hacks to timestamp the messages at
> least one-second apart by shifting the Date: field, so that the
> recipient MUA can sort by the departure timestamp if it wants to (and
> if it can), instead of the arrival timestamp. Is it not working well
> for you?
I have worked with 2 major mail clients that both display by date received:
* Mac OS X's Mail
* Gmail
I assume that a not-insignificant number of others also use these clients.
I don't mind letting send-email run in the background for a few minutes if
it means my patch series appear in order.
As you say, Jeff:
> On Wed, Apr 08, 2009 at 12:08:54AM +0200, Nicolas Sebrecht wrote:
>> IMHO, this improvement is broken by design. We try to fix a
>> receiver-only issue by a sender side fix.
>
> I almost said the same thing: it is really the receiver's problem.
> However, that doesn't mean the sender can't do simple things to help
> hint the right thing to the receiver. For example, we already munge the
> date fields to make sure the timestamp in each patch is increasing.
There's nothing simpler than slowing the rate of outgoing email. It doesn't
even have to be used; it is completely unintrusive and fully automated. It
even works with the confirmation. Best of all, it didn't take much code to
implement.
Sincerely,
Michael Witten
^ permalink raw reply
* Re: [PATCH RFC 1/6] send-email: Add --delay for separating emails
From: Michael Witten @ 2009-04-08 14:35 UTC (permalink / raw)
To: Jeff King, Nicolas Sebrecht, Junio C Hamano; +Cc: git
In-Reply-To: <49dcb464.06d7720a.66ca.ffffbd30@mx.google.com>
On Wed, Apr 8, 2009 at 09:25, Michael Witten <mfwitten@gmail.com> wrote:
> For instance, with
> a 14-patch series, one could set `--delay 60' and then let send-email
> run happily for the next 14 minutes with nary a thought.
As implemented, it would only take 13 minutes.
For a 5-patch series:
* Patch 1/5 sent
* delay 60 seconds
* Patch 2/5 sent
* delay 60 seconds
* Patch 3/5 sent
* delay 60 seconds
* Patch 4/5 sent
* delay 60 seconds
* Patch 5/5 sent
* send email exits immediately
^ permalink raw reply
* Re: Bug report - git show <tagname> together with --pretty=format
From: Michael J Gruber @ 2009-04-08 15:28 UTC (permalink / raw)
To: Cornelius; +Cc: git
In-Reply-To: <49DC9F07.4090105@gmx.de>
Cornelius venit, vidit, dixit 08.04.2009 14:56:
> Hi,
> I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's
> output for parsing the git data, so this is more than a minor issue for
> me. When you normally do a git show on a tag name it's output resembles
> the following:
> tag <tagname>
> Tagger: Cornelius <c.r1@gmx.de>
> Date: Wed Apr 8 14:39:17 2009 +0200
>
>
> tagmessage
> commit 77e312e0527f87604e4c70ebf6040e79bb55d2ed
> <snip>
>
> Now when you do a git show <tagname>
> --pretty=format:"ENDOFGITTAGOUTPUTMESAGEHERE%n%H" --
> the Date: line is missing. Git 1.6.0.5 (which is avaible in my distro's
> repos) doesn't have this issue. Please CC me, I'm not subcribed here.
> Cornelius
It's not a bug, it's a feature ;)
In fact, git show used to ignore format specifiers for the tag part and
apply them to the commit part only. Since
ea718e6 (show <tag>: reuse pp_user_info() instead of duplicating code,
2009-01-02)
(which is in v1.6.2) it applies the format to both, which is why there
is no tag date unless you ask for it (or use the default format).
Michael
^ permalink raw reply
* [PATCH 1/2] Clarify the gitmodules and submodules docs
From: pbaker @ 2009-04-08 15:33 UTC (permalink / raw)
To: git; +Cc: pbaker
Added some explanation to the docs to clear up some confusing parts of git-submodules that appeared frequently on the mailing list.
Signed-off-by: pbaker <pbaker@retrodict.com>
---
As I dug into the reasoning and structure of git-submodule as part of GSoC preparation, I also ran across frequently asked questions on the mailing list. From this background, I added some explanation to the docs to clear up some confusing parts of git-submodules.
- pbaker
Documentation/git-submodule.txt | 9 ++++++---
Documentation/gitmodules.txt | 8 +++++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 3b8df44..1ca8184 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -50,9 +50,12 @@ This command will manage the tree entries and contents of the
gitmodules file for you, as well as inspect the status of your
submodules and update them.
When adding a new submodule to the tree, the 'add' subcommand
-is to be used. However, when pulling a tree containing submodules,
-these will not be checked out by default;
-the 'init' and 'update' subcommands will maintain submodules
+is to be used. This creates a record in the gitmodules file for each
+submodule. When the file is committed and pulled by others it serves as an
+in-tree reference for where to obtain the submodule.
+
+When pulling a tree containing submodules, these will not be checked out by
+default; the 'init' and 'update' subcommands will maintain submodules
checked out and at appropriate revision in your working tree.
You can briefly inspect the up-to-date status of your submodules
using the 'status' subcommand and get a detailed overview of the
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
index d1a17e2..8f03310 100644
--- a/Documentation/gitmodules.txt
+++ b/Documentation/gitmodules.txt
@@ -15,7 +15,13 @@ DESCRIPTION
The `.gitmodules` file, located in the top-level directory of a git
working tree, is a text file with a syntax matching the requirements
-of linkgit:git-config[1].
+of linkgit:git-config[1]. As this file is managed by Git, it tracks the
+records of a project's submodules. Information stored in this file is used
+as a hint to prime the authoritative version of the record stored in the
+project configuration file. User specific record changes (e.g. to account
+for differences in submodule URLs due to networking situations) should be
+made to the configuration file, while record changes to be propagated (e.g.
+due to a relocation of the submodule source) should be made to this file.
The file contains one subsection per submodule, and the subsection value
is the name of the submodule. Each submodule section also contains the
--
1.6.2.1.316.gedbc2
^ permalink raw reply related
* Re: [PATCH 1/2] Clarify the gitmodules and submodules docs
From: P Baker @ 2009-04-08 15:45 UTC (permalink / raw)
To: pbaker; +Cc: git
In-Reply-To: <1239204833-39795-1-git-send-email-pbaker@retrodict.com>
Whoops. Sorry for the spam, trying to fix git-send-email whitespace
errors as per Junio's request. I apologize.
P Baker
On 4/8/09, pbaker <pbaker@retrodict.com> wrote:
> Added some explanation to the docs to clear up some confusing parts of git-submodules that appeared frequently on the mailing list.
>
> Signed-off-by: pbaker <pbaker@retrodict.com>
> ---
>
> As I dug into the reasoning and structure of git-submodule as part of GSoC preparation, I also ran across frequently asked questions on the mailing list. From this background, I added some explanation to the docs to clear up some confusing parts of git-submodules.
>
> - pbaker
>
> Documentation/git-submodule.txt | 9 ++++++---
> Documentation/gitmodules.txt | 8 +++++++-
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index 3b8df44..1ca8184 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -50,9 +50,12 @@ This command will manage the tree entries and contents of the
> gitmodules file for you, as well as inspect the status of your
> submodules and update them.
> When adding a new submodule to the tree, the 'add' subcommand
> -is to be used. However, when pulling a tree containing submodules,
> -these will not be checked out by default;
> -the 'init' and 'update' subcommands will maintain submodules
> +is to be used. This creates a record in the gitmodules file for each
> +submodule. When the file is committed and pulled by others it serves as an
> +in-tree reference for where to obtain the submodule.
> +
> +When pulling a tree containing submodules, these will not be checked out by
> +default; the 'init' and 'update' subcommands will maintain submodules
> checked out and at appropriate revision in your working tree.
> You can briefly inspect the up-to-date status of your submodules
> using the 'status' subcommand and get a detailed overview of the
> diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt
> index d1a17e2..8f03310 100644
> --- a/Documentation/gitmodules.txt
> +++ b/Documentation/gitmodules.txt
> @@ -15,7 +15,13 @@ DESCRIPTION
>
> The `.gitmodules` file, located in the top-level directory of a git
> working tree, is a text file with a syntax matching the requirements
> -of linkgit:git-config[1].
> +of linkgit:git-config[1]. As this file is managed by Git, it tracks the
> +records of a project's submodules. Information stored in this file is used
> +as a hint to prime the authoritative version of the record stored in the
> +project configuration file. User specific record changes (e.g. to account
> +for differences in submodule URLs due to networking situations) should be
> +made to the configuration file, while record changes to be propagated (e.g.
> +due to a relocation of the submodule source) should be made to this file.
>
> The file contains one subsection per submodule, and the subsection value
> is the name of the submodule. Each submodule section also contains the
>
> --
> 1.6.2.1.316.gedbc2
>
>
^ permalink raw reply
* [EGIT PATCH 1/2] Make Git property page cope with empty repositories and not yet born branches
From: Robin Rosenberg @ 2009-04-08 15:49 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../preferences/GitProjectPropertyPage.java | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
index 4c97cc8..d3afd97 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
@@ -94,7 +94,13 @@ private void fillValues(Repository repository) throws IOException {
final ObjectId objectId = repository
.resolve(repository.getFullBranch());
- id.setText(objectId.name());
+ if (objectId == null) {
+ if (repository.getAllRefs().size() == 0)
+ id.setText("None (empty repository)");
+ else
+ id.setText("None (unborn branch)");
+ } else
+ id.setText(objectId.name());
}
/**
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH 2/2] Externalize strings in GitPropertyPage
From: Robin Rosenberg @ 2009-04-08 15:49 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1239205781-28009-1-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/ui/UIText.java | 21 ++++++++++++++++++++
.../preferences/GitProjectPropertyPage.java | 15 +++++++------
.../src/org/spearce/egit/ui/uitext.properties | 7 ++++++
3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 5a1e328..f14eada 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -98,6 +98,27 @@
public static String GitCloneWizard_errorCannotCreate;
/** */
+ public static String GitProjectPropertyPage_LabelBranch;
+
+ /** */
+ public static String GitProjectPropertyPage_LabelGitDir;
+
+ /** */
+ public static String GitProjectPropertyPage_LabelId;
+
+ /** */
+ public static String GitProjectPropertyPage_LabelState;
+
+ /** */
+ public static String GitProjectPropertyPage_LabelWorkdir;
+
+ /** */
+ public static String GitProjectPropertyPage_ValueEmptyRepository;
+
+ /** */
+ public static String GitProjectPropertyPage_ValueUnbornBranch;
+
+ /** */
public static String RepositorySelectionPage_sourceSelectionTitle;
/** */
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
index d3afd97..79cf60e 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitProjectPropertyPage.java
@@ -21,6 +21,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.PropertyPage;
import org.spearce.egit.core.project.RepositoryMapping;
+import org.spearce.egit.ui.UIText;
import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.lib.Repository;
@@ -53,11 +54,11 @@ protected Control createContents(Composite parent) {
layout.verticalSpacing = 0;
composite.setLayout(layout);
- gitDir = createLabeledReadOnlyText(composite, "Git directory:");
- workDir = createLabeledReadOnlyText(composite, "Working directory:");
- branch = createLabeledReadOnlyText(composite, "Branch:");
- id = createLabeledReadOnlyText(composite, "Id:");
- state = createLabeledReadOnlyText(composite, "Current state:");
+ gitDir = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelGitDir);
+ workDir = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelWorkdir);
+ branch = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelBranch);
+ id = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelId);
+ state = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelState);
// Get the project that is the source of this property page
IProject project = null;
@@ -96,9 +97,9 @@ private void fillValues(Repository repository) throws IOException {
.resolve(repository.getFullBranch());
if (objectId == null) {
if (repository.getAllRefs().size() == 0)
- id.setText("None (empty repository)");
+ id.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository);
else
- id.setText("None (unborn branch)");
+ id.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch);
} else
id.setText(objectId.name());
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 692df5f..1e1a29d 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -46,6 +46,13 @@ GitCloneWizard_title=Import Git Repository
GitCloneWizard_jobName=Cloning from {0}
GitCloneWizard_failed=Git repository clone failed.
GitCloneWizard_errorCannotCreate=Cannot create directory {0}.
+GitProjectPropertyPage_LabelBranch=Branch:
+GitProjectPropertyPage_LabelGitDir=Git directory:
+GitProjectPropertyPage_LabelId=Id:
+GitProjectPropertyPage_LabelState=Current state:
+GitProjectPropertyPage_LabelWorkdir=Working directory:
+GitProjectPropertyPage_ValueEmptyRepository=None (empty repository)
+GitProjectPropertyPage_ValueUnbornBranch=None (unborn branch)
RepositorySelectionPage_sourceSelectionTitle=Source Git Repository
RepositorySelectionPage_sourceSelectionDescription=Enter the location of the source repository.
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH] Improve end-of-file detection in DirCache
From: Robin Rosenberg @ 2009-04-08 15:50 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
When reading from an BufferInputStream attached to a
FileInputStream the available() method seems to return
the number of unread bytes in the buffer plus the unread
number of bytes in the file.
There is no guarantee for this behaviour so this quick fix
might not be as stable as we would wish.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
http://code.google.com/p/egit/issues/detail?id=66
---
.../src/org/spearce/jgit/dircache/DirCache.java | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java
index 8eb4022..657762e 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCache.java
@@ -45,7 +45,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.util.Comparator;
@@ -344,8 +343,6 @@ public void clear() {
private void readFrom(final FileInputStream inStream) throws IOException,
CorruptObjectException {
- final FileChannel fd = inStream.getChannel();
- final long sizeOnDisk = fd.size();
final BufferedInputStream in = new BufferedInputStream(inStream);
// Read the index header and verify we understand it.
@@ -369,9 +366,16 @@ private void readFrom(final FileInputStream inStream) throws IOException,
sortedEntries[i] = new DirCacheEntry(infos, i * INFO_LEN, in);
lastModified = liveFile.lastModified();
- // After the file entries are index extensions.
- //
- while (fd.position() - in.available() < sizeOnDisk - 20) {
+ /*
+ * InputStream.available() on file input streams seems to return the
+ * rest of the file i.e. buffer size + unread file on disk. There is no
+ * guarantee for this so we need to fix this or we may miss extensions
+ * when reading the index in a few races cases.
+ *
+ * That is currently no disaster though.
+ */
+ while (in.available() > 20) {
+ // After the file entries are index extensions.
NB.readFully(in, hdr, 0, 8);
switch (NB.decodeInt32(hdr, 0)) {
case EXT_TREE: {
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH 1/4] Add actual test for success to ConnectOperationTest
From: Robin Rosenberg @ 2009-04-08 15:51 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
Also remove a few obsolete lines (irrelevant asserts)
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../op/T0001_ConnectProviderOperationTest.java | 16 +++-------------
1 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
index 092c048..1d332a3 100644
--- a/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
@@ -89,19 +89,6 @@ public void testNewUnsharedFile() throws CoreException, IOException,
lck.setNewObjectId(id);
assertEquals(RefUpdate.Result.NEW, lck.forceUpdate());
- // helper asserts, this is not what we are really testing
- assertTrue("blob missing", new File(gitDir,
- "objects/2e/2439c32d01f0ef39644d561945e8f4b2239489").exists());
-
- assertTrue("tree missing", new File(gitDir,
- "objects/87/a105cc4bc0a79885d07ec560c3eee49438acf0").exists());
- assertTrue("tree missing", new File(gitDir,
- "objects/08/ccc3d91a14d337a45f355d3d63bd97fd5e4db9").exists());
- assertTrue("tree missing", new File(gitDir,
- "objects/9d/aeec817090098f05eeca858e3a552d78b0a346").exists());
- assertTrue("commit missing", new File(gitDir,
- "objects/09/6f1a84091b90b6d9fb12f95848da69496305c1").exists());
-
ConnectProviderOperation operation = new ConnectProviderOperation(
project.getProject(), null);
operation.run(null);
@@ -125,5 +112,8 @@ protected IStatus run(IProgressMonitor monitor) {
Thread.sleep(1000);
}
System.out.println("DONE");
+
+ assertNotNull(RepositoryProvider.getProvider(project.getProject()));
+
}
}
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH 2/4] Add a method to RepositoryMapping to get the directory for not-yet-mapped projects
From: Robin Rosenberg @ 2009-04-08 15:51 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1239205891-28236-1-git-send-email-robin.rosenberg@dewire.com>
Usually a RepositoryMapping has an associated Repository. Not so when it is returned
from the RepositoryFinded.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../egit/core/project/RepositoryMapping.java | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
index e9df630..b49f380 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
@@ -234,4 +234,11 @@ public static RepositoryMapping getMapping(final IResource resource) {
return ((GitProvider)rp).getData().getRepositoryMapping(resource);
}
+
+ /**
+ * @return the name of the .git directory
+ */
+ public String getGitDir() {
+ return gitdirPath;
+ }
}
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH 4/4] Multi-project connect to Git provider
From: Robin Rosenberg @ 2009-04-08 15:51 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1239205891-28236-3-git-send-email-robin.rosenberg@dewire.com>
Eclipse supports connecting multiple projects to a repository. This
patch implements this for Git.
The sharing Wizard has been rewritten and create support moved out
of the ConnectOperation class to the wizard.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../core/T0003_AdaptableFileTreeIteratorTest.java | 2 +-
.../egit/core/internal/mapping/T0002_history.java | 2 +-
.../op/T0001_ConnectProviderOperationTest.java | 11 +-
.../src/org/spearce/egit/core/CoreText.java | 8 +-
.../src/org/spearce/egit/core/coretext.properties | 4 +-
.../egit/core/op/ConnectProviderOperation.java | 112 ++++------
.../src/org/spearce/egit/ui/UIText.java | 17 +-
.../ui/internal/clone/GitProjectsImportPage.java | 2 +-
.../ui/internal/sharing/ExistingOrNewPage.java | 235 ++++++++++++++++----
.../egit/ui/internal/sharing/SharingWizard.java | 53 ++---
.../src/org/spearce/egit/ui/uitext.properties | 11 +-
11 files changed, 283 insertions(+), 174 deletions(-)
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/T0003_AdaptableFileTreeIteratorTest.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/T0003_AdaptableFileTreeIteratorTest.java
index 1e2fe03..63e0798 100644
--- a/org.spearce.egit.core.test/src/org/spearce/egit/core/T0003_AdaptableFileTreeIteratorTest.java
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/T0003_AdaptableFileTreeIteratorTest.java
@@ -44,7 +44,7 @@ protected void setUp() throws Exception {
fileWriter.close();
final ConnectProviderOperation operation = new ConnectProviderOperation(
- project.getProject(), null);
+ project.getProject());
operation.run(null);
}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java
index 148e61e..735540e 100644
--- a/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java
@@ -78,7 +78,7 @@ protected void setUp() throws Exception {
assertEquals(RefUpdate.Result.NEW, lck.forceUpdate());
ConnectProviderOperation operation = new ConnectProviderOperation(
- project.getProject(), null);
+ project.getProject());
operation.run(null);
}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
index 1d332a3..f891262 100644
--- a/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
@@ -35,7 +35,7 @@
public void testNoRepository() throws CoreException {
ConnectProviderOperation operation = new ConnectProviderOperation(
- project.getProject(), null);
+ project.getProject());
operation.run(null);
// We are shared because we declared as shared
@@ -43,12 +43,15 @@ public void testNoRepository() throws CoreException {
assertTrue(!gitDir.exists());
}
- public void testNewRepository() throws CoreException {
+ public void testNewRepository() throws CoreException, IOException {
File gitDir = new File(project.getProject().getWorkspace().getRoot()
.getRawLocation().toFile(), ".git");
+ Repository repository = new Repository(gitDir);
+ repository.create();
+ repository.close();
ConnectProviderOperation operation = new ConnectProviderOperation(
- project.getProject(), gitDir);
+ project.getProject());
operation.run(null);
assertTrue(RepositoryProvider.isShared(project.getProject()));
@@ -90,7 +93,7 @@ public void testNewUnsharedFile() throws CoreException, IOException,
assertEquals(RefUpdate.Result.NEW, lck.forceUpdate());
ConnectProviderOperation operation = new ConnectProviderOperation(
- project.getProject(), null);
+ project.getProject());
operation.run(null);
final boolean f[] = new boolean[1];
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
index 46a7ef6..6b2627b 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
@@ -28,13 +28,7 @@
public static String ConnectProviderOperation_connecting;
/** */
- public static String ConnectProviderOperation_creating;
-
- /** */
- public static String ConnectProviderOperation_recordingMapping;
-
- /** */
- public static String ConnectProviderOperation_updatingCache;
+ public static String ConnectProviderOperation_ConnectingProject;
/** */
public static String DisconnectProviderOperation_disconnecting;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties b/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
index a911889..663c996 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
@@ -16,9 +16,7 @@
##
ConnectProviderOperation_connecting=Connecting Git team provider.
-ConnectProviderOperation_creating=Creating new Git repository.
-ConnectProviderOperation_recordingMapping=Saving repository mappings.
-ConnectProviderOperation_updatingCache=Updating workspace cache.
+ConnectProviderOperation_ConnectingProject=Connecting project {0}
DisconnectProviderOperation_disconnecting=Disconnecting Git team provider.
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/ConnectProviderOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/ConnectProviderOperation.java
index 7fc82ec..274fabb 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/ConnectProviderOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/ConnectProviderOperation.java
@@ -8,8 +8,6 @@
*******************************************************************************/
package org.spearce.egit.core.op;
-import java.io.File;
-import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.resources.IProject;
@@ -19,6 +17,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.spearce.egit.core.Activator;
import org.spearce.egit.core.CoreText;
@@ -26,29 +25,31 @@
import org.spearce.egit.core.project.GitProjectData;
import org.spearce.egit.core.project.RepositoryFinder;
import org.spearce.egit.core.project.RepositoryMapping;
-import org.spearce.jgit.lib.Repository;
/**
- * Connects Eclipse to an existing Git repository, or creates a new one.
+ * Connects Eclipse to an existing Git repository
*/
public class ConnectProviderOperation implements IWorkspaceRunnable {
- private final IProject project;
-
- private final File newGitDir;
+ private final IProject[] projects;
/**
* Create a new connection operation to execute within the workspace.
*
* @param proj
* the project to connect to the Git team provider.
- * @param newdir
- * git repository to create if the user requested a new
- * repository be constructed for this project; null to scan for
- * an existing repository and connect to that.
*/
- public ConnectProviderOperation(final IProject proj, final File newdir) {
- project = proj;
- newGitDir = newdir;
+ public ConnectProviderOperation(final IProject proj) {
+ this(new IProject[] { proj });
+ }
+
+ /**
+ * Create a new connection operation to execute within the workspace.
+ *
+ * @param projects
+ * the projects to connect to the Git team provider.
+ */
+ public ConnectProviderOperation(final IProject[] projects) {
+ this.projects = projects;
}
public void run(IProgressMonitor m) throws CoreException {
@@ -56,63 +57,42 @@ public void run(IProgressMonitor m) throws CoreException {
m = new NullProgressMonitor();
}
- m.beginTask(CoreText.ConnectProviderOperation_connecting, 100);
+ m.beginTask(CoreText.ConnectProviderOperation_connecting,
+ 100 * projects.length);
try {
- final Collection<RepositoryMapping> repos = new ArrayList<RepositoryMapping>();
-
- if (newGitDir != null) {
- try {
- final Repository db;
-
- m.subTask(CoreText.ConnectProviderOperation_creating);
- Activator.trace("Creating repository " + newGitDir);
-
- db = new Repository(newGitDir);
- db.create();
- repos.add(new RepositoryMapping(project, db.getDirectory()));
- db.close();
-
- // If we don't refresh the project directory right
- // now we won't later know that a .git directory
- // exists within it and we won't mark the .git
- // directory as a team-private member. Failure
- // to do so might allow someone to delete
- // the .git directory without us stopping them.
- //
- project.refreshLocal(IResource.DEPTH_ONE,
- new SubProgressMonitor(m, 10));
+ for (IProject project : projects) {
+ m.setTaskName(NLS.bind(
+ CoreText.ConnectProviderOperation_ConnectingProject,
+ project.getName()));
+ Activator.trace("Locating repository for " + project); //$NON-NLS-1$
+ Collection<RepositoryMapping> repos = new RepositoryFinder(
+ project).find(new SubProgressMonitor(m, 40));
+ if (repos.size() == 1) {
+ GitProjectData projectData = new GitProjectData(project);
+ try {
+ projectData.setRepositoryMappings(repos);
+ projectData.store();
+ } catch (CoreException ce) {
+ GitProjectData.delete(project);
+ throw ce;
+ } catch (RuntimeException ce) {
+ GitProjectData.delete(project);
+ throw ce;
+ }
+ RepositoryProvider
+ .map(project, GitProvider.class.getName());
+ projectData = GitProjectData.get(project);
+ project.refreshLocal(IResource.DEPTH_INFINITE,
+ new SubProgressMonitor(m, 50));
m.worked(10);
- } catch (Throwable err) {
- throw Activator.error(
- CoreText.ConnectProviderOperation_creating, err);
+ } else {
+ Activator
+ .trace("Attempted to share project without repository ignored :" //$NON-NLS-1$
+ + project);
+ m.worked(60);
}
- } else {
- Activator.trace("Finding existing repositories.");
- repos.addAll(new RepositoryFinder(project)
- .find(new SubProgressMonitor(m, 20)));
}
-
- m.subTask(CoreText.ConnectProviderOperation_recordingMapping);
- GitProjectData projectData = new GitProjectData(project);
- projectData.setRepositoryMappings(repos);
- projectData.store();
-
- try {
- RepositoryProvider.map(project, GitProvider.class.getName());
- } catch (CoreException ce) {
- GitProjectData.delete(project);
- throw ce;
- } catch (RuntimeException ce) {
- GitProjectData.delete(project);
- throw ce;
- }
-
- projectData = GitProjectData.get(project);
- project.refreshLocal(IResource.DEPTH_INFINITE,
- new SubProgressMonitor(m, 50));
-
- m.subTask(CoreText.ConnectProviderOperation_updatingCache);
} finally {
m.done();
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index f14eada..654e155 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -68,22 +68,31 @@
public static String GenericOperationFailed;
/** */
+ public static String ExistingOrNewPage_CreateButton;
+
+ /** */
public static String ExistingOrNewPage_title;
/** */
public static String ExistingOrNewPage_description;
/** */
- public static String ExistingOrNewPage_groupHeader;
+ public static String ExistingOrNewPage_ErrorFailedToCreateRepository;
+
+ /** */
+ public static String ExistingOrNewPage_ErrorFailedToRefreshRepository;
+
+ /** */
+ public static String ExistingOrNewPage_HeaderPath;
/** */
- public static String ExistingOrNewPage_useExisting;
+ public static String ExistingOrNewPage_HeaderProject;
/** */
- public static String ExistingOrNewPage_createNew;
+ public static String ExistingOrNewPage_HeaderRepository;
/** */
- public static String ExistingOrNewPage_createInParent;
+ public static String ExistingOrNewPage_SymbolicValueEmptyMapping;
/** */
public static String GitCloneWizard_title;
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
index 5d82edc..8e02cd1 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
@@ -711,7 +711,7 @@ private boolean createExistingProject(final ProjectRecord record,
monitor, openTicks));
if (share) {
ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation(
- project, null);
+ project);
connectProviderOperation
.run(new SubProgressMonitor(monitor, 20));
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/ExistingOrNewPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/ExistingOrNewPage.java
index b3ea769..8676f0a 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/ExistingOrNewPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/ExistingOrNewPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
+ * Copyright (C) 2009, Robin Rosenberg
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -7,80 +7,221 @@
*******************************************************************************/
package org.spearce.egit.ui.internal.sharing;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.spearce.egit.core.Activator;
+import org.spearce.egit.core.project.RepositoryFinder;
+import org.spearce.egit.core.project.RepositoryMapping;
import org.spearce.egit.ui.UIIcons;
import org.spearce.egit.ui.UIText;
+import org.spearce.jgit.lib.Repository;
+/**
+ * Wizard page for connecting projects to Git repositories.
+ */
class ExistingOrNewPage extends WizardPage {
- final SharingWizard myWizard;
- private Button createInParent;
- ExistingOrNewPage(final SharingWizard w) {
+ private final SharingWizard myWizard;
+ private Button button;
+ private Tree tree;
+ private Text repositoryToCreate;
+ private IPath minumumPath;
+
+ ExistingOrNewPage(SharingWizard w) {
super(ExistingOrNewPage.class.getName());
setTitle(UIText.ExistingOrNewPage_title);
setDescription(UIText.ExistingOrNewPage_description);
setImageDescriptor(UIIcons.WIZBAN_CONNECT_REPO);
- myWizard = w;
+ this.myWizard = w;
}
- public void createControl(final Composite parent) {
- final Group g;
- final Button useExisting;
- final Button createNew;
-
- g = new Group(parent, SWT.NONE);
- g.setText(UIText.ExistingOrNewPage_groupHeader);
- g.setLayout(new RowLayout(SWT.VERTICAL));
-
- useExisting = new Button(g, SWT.RADIO);
- useExisting.setText(UIText.ExistingOrNewPage_useExisting);
- useExisting.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(final SelectionEvent e) {
- widgetSelected(e);
+ public void createControl(Composite parent) {
+ Group g = new Group(parent, SWT.NONE);
+ g.setLayout(new GridLayout(3,false));
+ g.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
+ tree = new Tree(g, SWT.BORDER|SWT.MULTI);
+ tree.setHeaderVisible(true);
+ tree.setLayout(new GridLayout());
+ tree.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(3,1).create());
+ TreeColumn c1 = new TreeColumn(tree,SWT.NONE);
+ c1.setText(UIText.ExistingOrNewPage_HeaderProject);
+ c1.setWidth(100);
+ TreeColumn c2 = new TreeColumn(tree,SWT.NONE);
+ c2.setText(UIText.ExistingOrNewPage_HeaderPath);
+ c2.setWidth(400);
+ TreeColumn c3 = new TreeColumn(tree,SWT.NONE);
+ c3.setText(UIText.ExistingOrNewPage_HeaderRepository);
+ c3.setWidth(200);
+ for (IProject project : myWizard.projects) {
+ TreeItem treeItem = new TreeItem(tree, SWT.NONE);
+ treeItem.setData(project);
+ treeItem.setText(0, project.getName());
+ treeItem.setText(1, project.getLocation().toOSString());
+ RepositoryFinder repositoryFinder = new RepositoryFinder(project);
+ Collection<RepositoryMapping> find;
+ try {
+ find = repositoryFinder.find(new NullProgressMonitor());
+ if (find.size() == 0)
+ treeItem.setText(2, ""); //$NON-NLS-1$
+ else {
+ Iterator<RepositoryMapping> mi = find.iterator();
+ RepositoryMapping m = mi.next();
+ if (m.getGitDir() == null)
+ treeItem.setText(2,UIText.ExistingOrNewPage_SymbolicValueEmptyMapping);
+ else
+ treeItem.setText(2, m.getGitDir());
+ while (mi.hasNext()) {
+ TreeItem treeItem2 = new TreeItem(treeItem, SWT.NONE);
+ if (m.getGitDir() == null)
+ treeItem2.setText(2,UIText.ExistingOrNewPage_SymbolicValueEmptyMapping);
+ else
+ treeItem2.setText(2,m.getGitDir());
+ }
+ }
+ } catch (CoreException e) {
+ TreeItem treeItem2 = new TreeItem(treeItem, SWT.BOLD|SWT.ITALIC);
+ treeItem2.setText(e.getMessage());
}
+ }
- public void widgetSelected(final SelectionEvent e) {
- myWizard.setUseExisting();
- createInParent.setEnabled(false);
+ button = new Button(g, SWT.PUSH);
+ button.setLayoutData(GridDataFactory.fillDefaults().create());
+ button.setText(UIText.ExistingOrNewPage_CreateButton);
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ File gitDir = new File(repositoryToCreate.getText(),".git");
+ try {
+ Repository repository = new Repository(gitDir);
+ repository.create();
+ for (IProject project : getProjects()) {
+ // If we don't refresh the project directories right
+ // now we won't later know that a .git directory
+ // exists within it and we won't mark the .git
+ // directory as a team-private member. Failure
+ // to do so might allow someone to delete
+ // the .git directory without us stopping them.
+ // (Half lie, we should optimize so we do not
+ // refresh when the .git is not within the project)
+ //
+ if (!gitDir.toString().contains("..")) //$NON-NLS-1$
+ project.refreshLocal(IResource.DEPTH_ONE,
+ new NullProgressMonitor());
+ }
+ } catch (IOException e1) {
+ MessageDialog.openError(getShell(), UIText.ExistingOrNewPage_ErrorFailedToCreateRepository, gitDir.toString() + ":\n" + e1.getMessage());
+ Activator.logError("Failed to create repository at " + gitDir, e1); //$NON-NLS-1$
+ } catch (CoreException e2) {
+ Activator.logError(UIText.ExistingOrNewPage_ErrorFailedToRefreshRepository + gitDir, e2);
+ }
+ for (TreeItem ti : tree.getSelection()) {
+ ti.setText(2, gitDir.toString());
+ }
+ updateCreateOptions();
+ getContainer().updateButtons();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
}
});
- useExisting.setSelection(true);
-
- createNew = new Button(g, SWT.RADIO);
- createNew.setEnabled(myWizard.canCreateNew());
- createNew.setText(UIText.ExistingOrNewPage_createNew);
- createNew.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(final SelectionEvent e) {
- widgetSelected(e);
+ repositoryToCreate = new Text(g, SWT.SINGLE | SWT.BORDER);
+ repositoryToCreate.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1,1).create());
+ repositoryToCreate.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event e) {
+ if (e.text == null)
+ return;
+ IPath fromOSString = Path.fromOSString(e.text);
+ button.setEnabled(minumumPath
+ .matchingFirstSegments(fromOSString) == fromOSString
+ .segmentCount());
}
-
- public void widgetSelected(final SelectionEvent e) {
- myWizard.setCreateNew();
- createInParent.setEnabled(true);
+ });
+ Text l = new Text(g,SWT.NONE);
+ l.setEnabled(false);
+ l.setEditable(false);
+ l.setText(File.separatorChar + ".git"); //$NON-NLS-1$
+ l.setLayoutData(GridDataFactory.fillDefaults().create());
+ tree.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ updateCreateOptions();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Empty
}
});
+ updateCreateOptions();
+ setControl(g);
+ }
- createInParent = new Button(g, SWT.CHECK);
- createInParent.setEnabled(createNew.getSelection());
- createInParent.setText(UIText.ExistingOrNewPage_createInParent);
- createInParent.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
+ private void updateCreateOptions() {
+ minumumPath = null;
+ IPath p = null;
+ for (TreeItem ti : tree.getSelection()) {
+ String path = ti.getText(2);
+ if (!path.equals("")) { //$NON-NLS-1$
+ p = null;
+ break;
+ }
+ String gitDirParentCandidate = ti.getText(1);
+ IPath thisPath = Path.fromOSString(gitDirParentCandidate);
+ if (p == null)
+ p = thisPath;
+ else {
+ int n = p.matchingFirstSegments(thisPath);
+ p = p.removeLastSegments(p.segmentCount() - n);
}
+ }
+ minumumPath = p;
+ if (p != null) {
+ repositoryToCreate.setText(p.toOSString());
+ } else {
+ repositoryToCreate.setText(""); //$NON-NLS-1$
+ }
+ button.setEnabled(p != null);
+ repositoryToCreate.setEnabled(p != null);
+ getContainer().updateButtons();
+ }
- public void widgetSelected(SelectionEvent e) {
- myWizard.setUseParent(createInParent.getSelection());
+ @Override
+ public boolean isPageComplete() {
+ if (tree.getSelectionCount() == 0)
+ return false;
+ for (TreeItem ti : tree.getSelection()) {
+ String path = ti.getText(2);
+ if (path.equals("")) { //$NON-NLS-1$
+ return false;
}
- });
- createInParent.setSelection(true);
- myWizard.setUseParent(createInParent.getSelection());
- setControl(g);
+ }
+ return true;
+ }
+
+ public IProject[] getProjects() {
+ IProject[] ret = new IProject[tree.getSelection().length];
+ for (int i = 0; i < ret.length; ++i)
+ ret[i] = (IProject)tree.getSelection()[i].getData();
+ return ret;
}
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/SharingWizard.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/SharingWizard.java
index 292baf2..1e89ab2 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/SharingWizard.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/sharing/SharingWizard.java
@@ -8,7 +8,6 @@
*******************************************************************************/
package org.spearce.egit.ui.internal.sharing;
-import java.io.File;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
@@ -20,6 +19,7 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.ui.IConfigurationWizard;
+import org.eclipse.team.ui.IConfigurationWizardExtension;
import org.eclipse.ui.IWorkbench;
import org.spearce.egit.core.op.ConnectProviderOperation;
import org.spearce.egit.ui.Activator;
@@ -27,16 +27,13 @@
/**
* The dialog used for activating Team>Share, i.e. to create a new
- * Git repository or associate a project with one.
+ * Git repository or associate projects with one.
*/
-public class SharingWizard extends Wizard implements IConfigurationWizard {
- private IProject project;
+public class SharingWizard extends Wizard implements IConfigurationWizard,
+ IConfigurationWizardExtension {
+ IProject[] projects;
- private boolean create;
-
- private File newGitDir;
-
- private boolean useParent;
+ private ExistingOrNewPage existingPage;
/**
* Construct the Git Sharing Wizard for connecting Git project to Eclipse
@@ -46,39 +43,23 @@ public SharingWizard() {
setNeedsProgressMonitor(true);
}
- public void init(final IWorkbench workbench, final IProject p) {
- project = p;
- calculateNewGitDir();
+ public void init(IWorkbench workbench, IProject[] p) {
+ this.projects = new IProject[p.length];
+ System.arraycopy(p, 0, this.projects, 0, p.length);
}
- private void calculateNewGitDir() {
- File pdir = project.getLocation().toFile();
- if (useParent)
- pdir = pdir.getParentFile();
- newGitDir = new File(pdir, ".git");
+ public void init(final IWorkbench workbench, final IProject p) {
+ projects = new IProject[] { p };
}
public void addPages() {
- addPage(new ExistingOrNewPage(this));
- }
-
- boolean canCreateNew() {
- return !newGitDir.exists();
- }
-
- void setCreateNew() {
- if (canCreateNew()) {
- create = true;
- }
- }
-
- void setUseExisting() {
- create = false;
+ existingPage = new ExistingOrNewPage(this);
+ addPage(existingPage);
}
public boolean performFinish() {
final ConnectProviderOperation op = new ConnectProviderOperation(
- project, create ? newGitDir : null);
+ existingPage.getProjects());
try {
getContainer().run(true, false, new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor)
@@ -110,8 +91,8 @@ public void run(final IProgressMonitor monitor)
}
}
- void setUseParent(boolean selection) {
- useParent = selection;
- calculateNewGitDir();
+ @Override
+ public boolean canFinish() {
+ return existingPage.isPageComplete();
}
}
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 1e1a29d..1d21c81 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -35,12 +35,15 @@ SharingWizard_failed=Failed to initialize Git team provider.
GenericOperationFailed={0} Failed
+ExistingOrNewPage_CreateButton=&Create...
ExistingOrNewPage_title=Configure Git Repository
ExistingOrNewPage_description=Select Git Repository Location
-ExistingOrNewPage_groupHeader=Repository Location
-ExistingOrNewPage_useExisting=Search for existing Git repositories
-ExistingOrNewPage_createNew=Create a new Git repository for this project
-ExistingOrNewPage_createInParent=Create repository in project's parent directory
+ExistingOrNewPage_ErrorFailedToCreateRepository=Failed to create repository
+ExistingOrNewPage_ErrorFailedToRefreshRepository=Failed to refresh project after creating repo at
+ExistingOrNewPage_HeaderPath=Path
+ExistingOrNewPage_HeaderProject=Project
+ExistingOrNewPage_HeaderRepository=Repository
+ExistingOrNewPage_SymbolicValueEmptyMapping=<empty repository mapping>
GitCloneWizard_title=Import Git Repository
GitCloneWizard_jobName=Cloning from {0}
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* [EGIT PATCH 3/4] Use explicit bundle name in UIText to aid IDE integration
From: Robin Rosenberg @ 2009-04-08 15:51 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1239205891-28236-2-git-send-email-robin.rosenberg@dewire.com>
When the bundle name is specified as a raw string Eclipse will pick up
the location of the uitext.properties file and display the actual string
value when hovering over UIText declarations. It also allows direct
navigation to the uitext.properties string from a declaration.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/core/CoreText.java | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
index d81a008..46a7ef6 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
@@ -106,7 +106,6 @@
public static String PushOperation_taskNameNormalRun;
static {
- final Class c = CoreText.class;
- initializeMessages(c.getPackage().getName() + ".coretext", c);
+ initializeMessages("org.spearce.egit.core.coretext", CoreText.class);
}
}
--
1.6.2.2.446.gfbdc0
^ permalink raw reply related
* Re: Bug report - git show <tagname> together with --pretty=format
From: Santi Béjar @ 2009-04-08 16:37 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Cornelius, git
In-Reply-To: <49DCC295.7010908@drmicha.warpmail.net>
2009/4/8 Michael J Gruber <git@drmicha.warpmail.net>:
> Cornelius venit, vidit, dixit 08.04.2009 14:56:
>> Hi,
>> I've a problem with git 1.6.2.2 (self compiled) and git show. I use it's
>> output for parsing the git data,
In addition to what Michael said, you should use the plumbing commands
instead of the porcelain (see man git). They are specifically for use
with scripts and parse their output. The output from the porcelain
commands can change.
Santi
^ permalink raw reply
* Re: [ANNOUNCE] git_fast_filter
From: Elijah Newren @ 2009-04-08 16:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0904081144580.9157@intel-tinevez-2-302>
Hi,
On Wed, Apr 8, 2009 at 3:45 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> On Tue, 7 Apr 2009, Elijah Newren wrote:
>
>> Just thought I'd make this available, in case there's others with niche
>> needs that find it useful...
>
> Have you seen
>
> http://thread.gmane.org/gmane.comp.version-control.git/52323
>
> I was rather disappointed that skimo left the patch series in a rather
> half-useful state.
No, I had not. Looks useful, though it appears to be missing a number
of options from git-filter-branch, such as --subdirectory-filter,
--tree-filter, and --prune-empty. I'm guessing that's related to your
"half-useful" comment?
I was particularly interested in --tree-filter for my rewrite, since I
needed it (to remove all cvs keywords and a few other touch-ups) and
it was the slowest of the filters I'd be using. Problem is, in a
repository with 40,000 commits and 70,000 files in the latest commits,
--tree-filter is unacceptably slow. On average, a commit would have
about 35,000 files (assuming approximately linear growth over the
commit history), meaning that I'd have to modify 40,000 x 35,000 files
= 1,400,000,000 files[1]. However, on average, less than a dozen
files changed per commit, so there are less than 40,000 x 12 = 480,000
unique files that actually need to be rewritten. git-fast-export
provides (and git-fast-import expects) just those half million files,
and rewriting half a million files instead of 1.4 billion files is the
difference between a 45 minute rewrite and a 3 month one.
I didn't see a way to easily avoid the 1.4 billion file rewrite using
git-filter-branch (or git-rewrite-commits had I known about it), and
writing something to parse and modify git-fast-export output seemed
like the easiest solution. Perhaps I could have written some fancy
index-filter script that recorded original and modified file sha1sums
somewhere and used that to only check out certain files and rewrite
them, but such an idea hadn't occurred to me (and I'm not sure it
would have been the better route even if it had). Maybe there's
something I missed that would have made this easy, though?
Elijah
[1] For simplicity, I'm ignoring the 'binary' files that should not
have any cvs-keyword unmunging performed on them. However, it does
present an issue, particularly with extra process forks, since you
need to determine which files are safe to modify. I used libmagic
(the library behind the unix 'file' command) to avoid the need to run
'file' repeatedly.
^ permalink raw reply
* Re: [PATCH 1/3] git remote update: Report error for non-existing groups
From: Jeff King @ 2009-04-08 17:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Finn Arne Gangstad, git
In-Reply-To: <7vy6ubo8tn.fsf@gitster.siamese.dyndns.org>
On Wed, Apr 08, 2009 at 01:20:36AM -0700, Junio C Hamano wrote:
> I don't know what users want to see when they say "default" explicitly
> without having an explicit configuration. Should it do the same thing as
> "git remote update"?
I'm not sure we have a choice anymore; is it worth breaking
compatibility to "fix" something that doesn't actually seem to be
harming anyone?
-Peff
^ permalink raw reply
* need help with git show :1:...
From: layer @ 2009-04-08 17:41 UTC (permalink / raw)
To: git
I remember this working for me in the not too distant past.
I'm using git version 1.6.1.3. Perhaps it was an older version of git
when it worked for me.
quadra% ls -l src/c/sock.c
-rw-r--r-- 1 layer fi 57909 Mar 9 13:32 src/c/sock.c
quadra% git show :2:src/c/sock.c
fatal: ambiguous argument ':2:src/c/sock.c': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
quadra% git show :1:c/sock.c
fatal: ambiguous argument ':1:c/sock.c': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
quadra% git show :1:sock.c
fatal: ambiguous argument ':1:sock.c': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
quadra% git show :1:/src/c/sock.c
fatal: ambiguous argument ':1:/src/c/sock.c': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
If I cd to "src/c" and do "git show :1:sock.c" the same thing happens.
Thanks.
^ permalink raw reply
* Re: need help with git show :1:...
From: layer @ 2009-04-08 17:57 UTC (permalink / raw)
To: git
I didn't make it clear, but I am in the process of resolve conflicts
from a merge in the repo where those commands were executed.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox