* [PATCH] Fix sourcing "test-lib.sh" using dash shell in "t3003-ls-files-narrow-match.sh"
From: Christian Couder @ 2009-01-05 13:30 UTC (permalink / raw)
To: Junio C Hamano, Nguyen Thai Ngoc Duy; +Cc: git
dash barfs, on my old Ubuntu box, when "test-lib.sh" is sourced
without "./".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
t/t3003-ls-files-narrow-match.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
This patch applies to "pu".
diff --git a/t/t3003-ls-files-narrow-match.sh b/t/t3003-ls-files-narrow-match.sh
index 9879525..b576bca 100755
--- a/t/t3003-ls-files-narrow-match.sh
+++ b/t/t3003-ls-files-narrow-match.sh
@@ -2,7 +2,7 @@
test_description='This test is for narrow spec matching'
-. test-lib.sh
+. ./test-lib.sh
D="$(cd ..;pwd)"/t3003
--
1.6.1.143.gfd590.dirty
^ permalink raw reply related
* Re: [EGIT PATCH] Sorting commit items by click on the table header in commit dialog.
From: Robin Rosenberg @ 2009-01-05 7:35 UTC (permalink / raw)
To: Vasyl' Vavrychuk, Shawn O. Pearce; +Cc: git
In-Reply-To: <gjre95$4cs$1@ger.gmane.org>
söndag 04 januari 2009 23:46:47 skrev Vasyl' Vavrychuk:
> In order to implement new feature I have replaced class associated with every table row.
> CommitItem class encapsulate data that commit dialog manipulates with.
> Comparators are written using idiom from http://tobega.blogspot.com/2008/05/beautiful-enums.html.
> Clicks on a certain column are handled in HeaderSelectionListener class.
Hmm. This one cannot be applied on top of master. There is only only one commit on Dec 8
that involves the same file, so If you could rebase that would be nice. Other than that it looks ok.
Please also Cc me and Shawn on patches to reduce the risk of them getting lost.
-- robin
^ permalink raw reply
* Re: git-rev-parse --symbolic-abbrev-name
From: Miklos Vajna @ 2009-01-05 6:45 UTC (permalink / raw)
To: Arnaud Lacombe; +Cc: Junio C Hamano, Karl Chen, David Aguilar, Git mailing list
In-Reply-To: <1a69a9d80901042135w5f1c4aa2jd56ff1d9e4ffd38a@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 274 bytes --]
On Mon, Jan 05, 2009 at 12:35:23AM -0500, Arnaud Lacombe <lacombar@gmail.com> wrote:
> ps: btw, Documentation/git-format-patch.txt does not describe the -M
> flag, not does it describe the -B flag
But has a 'include::diff-options.txt[]', so the generated manpage does.
;-)
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: announce: TortoiseGit 0.2 preview released
From: Ping Yin @ 2009-01-05 6:40 UTC (permalink / raw)
To: Frank Li; +Cc: git, tortoisegit-announce
In-Reply-To: <1976ea660901040715l36667c7dld5f686e8c3624d1b@mail.gmail.com>
Wonderful work! Thanks.
On Sun, Jan 4, 2009 at 11:15 PM, Frank Li <lznuaa@gmail.com> wrote:
> After heavy developing, TortoiseGit 0.2 preview release published.
> TortoiseGit 0.2 can finish regular work, such as commit, show log,
> diff version, create tag, create branch, create patchs.
>
> Download:
> http://code.google.com/p/tortoisegit/downloads/list
>
> Version 0.2.0.0 preview version:
> Features:
> 1. Add TortoisgeMerge as default compare tools
> 2. Pull, Fetch, Push
> 3. Create Branch\Tag
> 4. Switch branch \Chechout
> 5. Compare with previous version
> 6. Clone(only support local repository, see known issue for detail)
> 7. Log Dialog support filter
> 8. Check for modifications
> 9. Revert local change
> 10.Create Patch Serial
> 11.Apply Patch Serial
> 12.Add file to repository(see know issue)
> 13.Export to zip file
>
> Bug Fix:
> 1. A2W cause stack overwrite bug when git output is long.
>
>
> Known Issue:
> 1. ProcessDlg will wait for ever when clone remote repository(ssh, http,git).
> 2. push fetch and pull don't support password mode. Just support
> public key problem.
> 3. Just fetch first 100 log item.
> 4. If install TortoiseGit before MsysGit, you need modify register
> HKEY_LOCAL_MACHINE\Software\TortoiseGit\\MsysGit\
> Let it point to correct msysgit install path.
> 5. Add File, please commit and show unversion file, the choose add
> file, then right clict, Choose Add file
> 6. To new initial repository, You will not see add file again in
> commit dialog box if give up commit when choose add
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* http push to WebDAV server fails (apache 2.2 under Win) - possible bug!?
From: Harald Weppner @ 2009-01-05 6:26 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 5232 bytes --]
Hi there,
just trying to get started to host a remote repository on a WebDAV
share (served by apache2.2 on Windows). When I attempt to push from my
local repository it indicates a 405 failure on a PUT of a
*opaquelocktoken:* resource (cf. apache access log below). I don't
know WebDAV in detail to know what's going wrong here but the colon in
the resource name looks suspicious as it's not a permitted character
under Windows. Could this indeed be a problem of not escaping the
resource name properly?
Thanks & cheerio, Harry.
> git push -v origin master
Pushing to http://user@example.com/webdav/repos/example.git/
Fetching remote heads...
refs/
refs/heads/
refs/tags/
updating 'refs/heads/master'
from 0000000000000000000000000000000000000000
to d310d475c459f7440a9a4ab8ae518f3a91011eb2
sending 12 objects
PUT 9d68391c5426d3b3c69a6b4c43c1110d13a710d5 failed, aborting (22/405)
PUT 57964966cd88e6a3a61c46ed4b186f26d5133dab failed, aborting (22/405)
PUT 7e03ccd9dcbb5a2770cc5e52aa168a97897ce01b failed, aborting (22/405)
PUT 67d59f8095ad0b5d90b50b05634038c831871f05 failed, aborting (22/405)
PUT 726f7925fa8539c202558d1cf7567c173fed6b42 failed, aborting (22/405)
error: failed to push some refs to 'http://user@example.com/webdav/repos/example.git/'
Here's how the apache error log looks like
[Sun Jan 04 21:51:27 2009] [error] [client xxx.xxx.xx.xxx] File does
not exist: C:/xampp/webdav/repos/example.git/info/refs
[Sun Jan 04 21:51:27 2009] [error] [client xxx.xxx.xx.xxx] File does
not exist: C:/xampp/webdav/repos/example.git/objects/info/packs
and this is apache's access log (showing the 405 errors)
[04/Jan/2009:21:51:26 -0800] "PROPFIND /webdav/repos/example.git/ HTTP/
1.1" 207 588 "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "HEAD /webdav/repos/example.git/info/refs
HTTP/1.1" 404 - "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "HEAD /webdav/repos/example.git/objects/
info/packs HTTP/1.1" 404 - "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "PROPFIND /webdav/repos/example.git/refs/
HTTP/1.1" 207 2637 "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "PROPFIND /webdav/repos/example.git/refs/
heads/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "PROPFIND /webdav/repos/example.git/refs/
tags/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:27 -0800] "MKCOL /webdav/repos/example.git/refs
HTTP/1.1" 301 433 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "MKCOL /webdav/repos/example.git/refs/
HTTP/1.1" 405 1060 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "MKCOL /webdav/repos/example.git/refs/
heads HTTP/1.1" 301 439 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "MKCOL /webdav/repos/example.git/refs/
heads/ HTTP/1.1" 405 1060 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "LOCK /webdav/repos/example.git/refs/
heads/master HTTP/1.1" 200 471 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "PROPFIND /webdav/repos/example.git/
objects/d3/ HTTP/1.1" 404 1138 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "PROPFIND /webdav/repos/example.git/
objects/24/ HTTP/1.1" 404 1138 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "PROPFIND /webdav/repos/example.git/
objects/62/ HTTP/1.1" 404 1138 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "PROPFIND /webdav/repos/example.git/
objects/ca/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:28 -0800] "PROPFIND /webdav/repos/example.git/
objects/9c/ HTTP/1.1" 404 1138 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/7e/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/6f/ HTTP/1.1" 404 1138 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/72/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/67/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/57/ HTTP/1.1" 207 951 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PROPFIND /webdav/repos/example.git/
objects/9d/ HTTP/1.1" 207 950 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PUT /webdav/repos/example.git/objects/9d/
68391c5426d3b3c69a6b4c43c1110d13a710d5_opaquelocktoken:
35019a69-7377-2545-a7fa-0f7888f6e3bc HTTP/1.1" 405 1058 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PUT /webdav/repos/example.git/objects/
57/964966cd88e6a3a61c46ed4b186f26d5133dab_opaquelocktoken:
35019a69-7377-2545-a7fa-0f7888f6e3bc HTTP/1.1" 405 1058 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PUT /webdav/repos/example.git/objects/7e/
03ccd9dcbb5a2770cc5e52aa168a97897ce01b_opaquelocktoken:
35019a69-7377-2545-a7fa-0f7888f6e3bc HTTP/1.1" 405 1058 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PUT /webdav/repos/example.git/objects/67/
d59f8095ad0b5d90b50b05634038c831871f05_opaquelocktoken:
35019a69-7377-2545-a7fa-0f7888f6e3bc HTTP/1.1" 405 1058 "-" "git/1.6.1"
[04/Jan/2009:21:51:29 -0800] "PUT /webdav/repos/example.git/objects/
72/6f7925fa8539c202558d1cf7567c173fed6b42_opaquelocktoken:
35019a69-7377-2545-a7fa-0f7888f6e3bc HTTP/1.1" 405 1058 "-" "git/1.6.1"
[04/Jan/2009:21:51:30 -0800] "UNLOCK /webdav/repos/example.git/refs/
heads/master HTTP/1.1" 204 - "-" "git/1.6.1"
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2425 bytes --]
^ permalink raw reply
* Re: configure clobbers LDFLAGS
From: Jeff King @ 2009-01-05 6:00 UTC (permalink / raw)
To: prj; +Cc: Junio C Hamano, git
In-Reply-To: <m3tz8e32ru.fsf@multivac.cwru.edu>
On Sun, Jan 04, 2009 at 09:27:41PM -0500, Paul Jarc wrote:
> In a couple of tests, configure clobbers the LDFLAGS value set by the
> caller. This patch fixes it.
Thanks for the patch. It looks obviously correct to me, and the problem
was just some typos introduced by 798a9450.
Junio, I think this should go onto maint.
> (I'm not subscribed; Mail-Followup-To set.)
The usual behavior on this list is to reply to the sender, cc'ing the
list and any previous to or cc's. So MFT is unnecessary and generally
frowned upon here.
Also, if you are planning on sending more patches, the usual practice is
for them to be inline rather than attached, with the commit message as
the body and any cover letter (like MFT discussion) after the
triple-dash; git format-patch will generate this format for you. More
information is in Documentation/SubmittingPatches.
-Peff
^ permalink raw reply
* Re: git-branch --print-current
From: Jeff King @ 2009-01-05 5:50 UTC (permalink / raw)
To: Junio C Hamano
Cc: Shawn O. Pearce, demerphq, Karl Chen, Miklos Vajna, David Aguilar,
Git mailing list
In-Reply-To: <7vsknys8y1.fsf@gitster.siamese.dyndns.org>
On Sun, Jan 04, 2009 at 07:55:34PM -0800, Junio C Hamano wrote:
> > I agree, its nuts to be there. But this also does show up in 1.6.1.
> > What's odd is the output of rev-parse --git-dir is wrong:
> >
> > $ cd .git/refs
> > $ git rev-parse --git-dir
> > .
> >
> > Its *not* ".", its "..", I'm *in* the directory. This throws off
> > a lot of the other operations we do in __git_ps1, like detecting
> > the repository state by checking MERGE_HEAD or rebase-apply.
> >
> > I think we should fix rev-parse --git-dir if we can, not the bash
> > completion code.
>
> Sigh, yeah, that is what I thought would be happening.
I took a quick look at this. I think there is something fundamentally
wrong with the logic for reporting relative git-dir. It basically ends
up doing something like (this is in setup_git_directory_gently, but the
value is just printed directly in rev-parse):
while (1) {
if (is_git_dir(".")) {
setenv("GIT_DIR", ".");
break;
}
chdir("..");
}
So yes, it's true at the end of that loop that we the git dir _is_ ".",
but that isn't suitable for telling any other processes who didn't
follow the chdir with us.
The quick fix is for rev-parse to turn that into an absolute path. I
don't know if that breaks any callers.
A better fix is probably for setup_git_directory to not require changing
the directory (or to chdir back to the original at the end, and set the
GIT_DIR in a properly relative manner).
-Peff
^ permalink raw reply
* Re: git-rev-parse --symbolic-abbrev-name
From: Arnaud Lacombe @ 2009-01-05 5:35 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Junio C Hamano, Karl Chen, David Aguilar, Git mailing list
In-Reply-To: <20090104223819.GI21154@genesis.frugalware.org>
Hi,
On Sun, Jan 4, 2009 at 5:38 PM, Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Sun, Jan 04, 2009 at 03:23:03PM -0500, Arnaud Lacombe <lacombar@gmail.com> wrote:
>> ps: I choose --symbolic-short-name as the opposite of
>> --symbolic-full-name for consistency.
>> ps2: sorry for the bogus mime-type
>
> That's not a problem, just don't attach your patch. Please read
> Documentation/SubmittingPatches.
>
ok, looks, I did these patch this morning quickly, didn't commit
anything or so. If there worth anything, then I'll spent time
commiting, doing nice integration, documentation, whatsoever ... Just
need a quick yes or no, these as patch are really trivial.
- Arnaud
ps: btw, Documentation/git-format-patch.txt does not describe the -M
flag, not does it describe the -B flag
^ permalink raw reply
* Re: git has modified files after clean checkout
From: Caleb Cushing @ 2009-01-05 5:11 UTC (permalink / raw)
To: Thomas Rast; +Cc: David Aguilar, git
In-Reply-To: <81bfc67a0901012149u23c8c9avb6f47817a56750c7@mail.gmail.com>
testing 1.6.1 release (not head) and still see the issue. right now
I'm assuming disabling autocrlf = input would help. regardless is this
behavior a bug or anticipated?
--
Caleb Cushing
http://xenoterracide.blogspot.com
^ permalink raw reply
* Re: git-branch --print-current
From: Junio C Hamano @ 2009-01-05 3:55 UTC (permalink / raw)
To: Shawn O. Pearce
Cc: demerphq, Karl Chen, Miklos Vajna, David Aguilar,
Git mailing list
In-Reply-To: <20090105021832.GA20973@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Junio C Hamano <gitster@pobox.com> wrote:
>> demerphq <demerphq@gmail.com> writes:
>>
>> > The version im using, from git version 1.6.0.4.724.ga0d3a produces the
>> > following error:
>> >
>> > cut: ./HEAD: No such file or directory
>> >
>> > when in the .git/refs directory.
>>
>> Personally, I think you are nuts to be in .git/refs and want to use that
>> information for anything useful, but if it is an easy enough fix, a patch
>> would be useful.
>
> I agree, its nuts to be there. But this also does show up in 1.6.1.
> What's odd is the output of rev-parse --git-dir is wrong:
>
> $ cd .git/refs
> $ git rev-parse --git-dir
> .
>
> Its *not* ".", its "..", I'm *in* the directory. This throws off
> a lot of the other operations we do in __git_ps1, like detecting
> the repository state by checking MERGE_HEAD or rebase-apply.
>
> I think we should fix rev-parse --git-dir if we can, not the bash
> completion code.
Sigh, yeah, that is what I thought would be happening.
^ permalink raw reply
* [PATCH] Permit a wider range of repository names in jgit daemon requests
From: Shawn O. Pearce @ 2009-01-05 2:46 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <200901040048.01520.robin.rosenberg@dewire.com>
The earlier restriction was too narrow for some applications, for
example repositories named "jgit.dev" and "jgit.test" are perfectly
valid Git repositories and should still be able to be served by
the daemon.
By blocking out only uses of ".." as a path component and Windows
UNC paths (by blocking "\") we can reasonably prevent the client
from escaping the base dirctories configured in the daemon.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> tisdag 23 december 2008 01:27:23 skrev Shawn O. Pearce:
> > + private static final Pattern SAFE_REPOSITORY_NAME = Pattern
> > + .compile("^[A-Za-z][A-Za-z0-9/_ -]+(\\.git)?$");
>
> This restriction is too strict. Wouldn't any path not containing ".." be valid? In particular this did not work with my "EGIT.contrib" repo. I
> have a lot of repos with names llike "name.purpose". Just adding
> '.' to the character set isn't really enough.
Yup.
.../src/org/spearce/jgit/transport/Daemon.java | 42 +++++++++----------
1 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java b/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
index 646c88d..d39fd04 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/Daemon.java
@@ -51,7 +51,6 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.regex.Pattern;
import org.spearce.jgit.lib.Repository;
@@ -62,9 +61,6 @@
private static final int BACKLOG = 5;
- private static final Pattern SAFE_REPOSITORY_NAME = Pattern
- .compile("^[A-Za-z][A-Za-z0-9/_ -]+(\\.git)?$");
-
private InetSocketAddress myAddress;
private final DaemonService[] services;
@@ -292,24 +288,26 @@ synchronized (exports) {
return db;
}
- if (SAFE_REPOSITORY_NAME.matcher(name).matches()) {
- final File[] search;
- synchronized (exportBase) {
- search = exportBase.toArray(new File[exportBase.size()]);
- }
- for (final File f : search) {
- db = openRepository(new File(f, name));
- if (db != null)
- return db;
-
- db = openRepository(new File(f, name + ".git"));
- if (db != null)
- return db;
-
- db = openRepository(new File(f, name + "/.git"));
- if (db != null)
- return db;
- }
+ if (name.startsWith("../") || name.contains("/../")
+ || name.contains("\\"))
+ return null;
+
+ final File[] search;
+ synchronized (exportBase) {
+ search = exportBase.toArray(new File[exportBase.size()]);
+ }
+ for (final File f : search) {
+ db = openRepository(new File(f, name));
+ if (db != null)
+ return db;
+
+ db = openRepository(new File(f, name + ".git"));
+ if (db != null)
+ return db;
+
+ db = openRepository(new File(f, name + "/.git"));
+ if (db != null)
+ return db;
}
return null;
}
--
1.6.1.94.g9388
--
Shawn.
^ permalink raw reply related
* configure clobbers LDFLAGS
From: Paul Jarc @ 2009-01-05 2:27 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
(I'm not subscribed; Mail-Followup-To set.)
In a couple of tests, configure clobbers the LDFLAGS value set by the
caller. This patch fixes it.
paul
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: git-ldflags.diff --]
[-- Type: text/x-patch, Size: 813 bytes --]
diff --git a/configure.ac b/configure.ac
index 8821b50..0a5fc8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,7 +127,7 @@ else
SAVE_LDFLAGS="${LDFLAGS}"
LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
- LDFLAGS="${SAVE_LD_FLAGS}"
+ LDFLAGS="${SAVE_LDFLAGS}"
])
if test "$ld_wl_rpath" = "yes"; then
AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
@@ -136,7 +136,7 @@ else
SAVE_LDFLAGS="${LDFLAGS}"
LDFLAGS="${SAVE_LDFLAGS} -rpath /"
AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
- LDFLAGS="${SAVE_LD_FLAGS}"
+ LDFLAGS="${SAVE_LDFLAGS}"
])
if test "$ld_rpath" = "yes"; then
AC_SUBST(CC_LD_DYNPATH, [-rpath])
^ permalink raw reply related
* Re: [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Shawn O. Pearce @ 2009-01-05 2:19 UTC (permalink / raw)
To: Vasyl' Vavrychuk; +Cc: git
In-Reply-To: <gjrgip$al9$1@ger.gmane.org>
Vasyl' Vavrychuk <vvavrychuk@gmail.com> wrote:
> Not sure what is right:
> public abstract class AnyObjectId implements Comparable<ObjectId> {
> or
> public abstract class AnyObjectId implements Comparable<AnyObjectId> {
>
> IMHO second, but class AnyObjectId contains some compareTo(ObjectId).
Hmmph. That probably can be AnyObjectId. At one point we only had
ObjectId, then AnyObjectId was introduced as a base so we can have
the immutable AnyObjectId and the mutable MutableObjectId subclasses.
compareTo doesn't care about the mutable state of its argument, this
is probably left-over code that didn't get converted when we added
the AnyObjectId base class.
So it should be the second, and the compareTo method should be made
to match that.
--
Shawn.
^ permalink raw reply
* Re: git-branch --print-current
From: Shawn O. Pearce @ 2009-01-05 2:18 UTC (permalink / raw)
To: Junio C Hamano
Cc: demerphq, Karl Chen, Miklos Vajna, David Aguilar,
Git mailing list
In-Reply-To: <7v1vvitwio.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> demerphq <demerphq@gmail.com> writes:
>
> > The version im using, from git version 1.6.0.4.724.ga0d3a produces the
> > following error:
> >
> > cut: ./HEAD: No such file or directory
> >
> > when in the .git/refs directory.
>
> Personally, I think you are nuts to be in .git/refs and want to use that
> information for anything useful, but if it is an easy enough fix, a patch
> would be useful.
I agree, its nuts to be there. But this also does show up in 1.6.1.
What's odd is the output of rev-parse --git-dir is wrong:
$ cd .git/refs
$ git rev-parse --git-dir
.
Its *not* ".", its "..", I'm *in* the directory. This throws off
a lot of the other operations we do in __git_ps1, like detecting
the repository state by checking MERGE_HEAD or rebase-apply.
I think we should fix rev-parse --git-dir if we can, not the bash
completion code.
--
Shawn.
^ permalink raw reply
* Re: [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Vasyl' Vavrychuk @ 2009-01-05 1:13 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: Shawn O. Pearce, git
In-Reply-To: <200901050004.41531.robin.rosenberg.lists@dewire.com>
Robin Rosenberg wrote:
> söndag 04 januari 2009 23:20:19 skrev Vasyl' Vavrychuk:
>> Also fixed:
>> 1. "The 'Eclipse-LazyStart' header is deprecated, use 'Bundle-ActivationPolicy'" warning.
>> 2. Possible NullPointerException warning.
>> 3. Unnecessery function parameter warning.
>
> Thanks for your interest in the projects.
> Most changes from a 30 seconds review look reasonable.
> However we don't apply changes this way. From your comments it seems we'd require about
> five patches since the changes are of very different types.
I thought that commit is trivial. But maybe series of patches will be better because of an ability to revert what we want.
>
> -- robin
>
>> diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> index ee5f277..e8bcc79 100644
>> --- a/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> +++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
>> org.spearce.egit.ui,
>> org.spearce.jgit,
>> org.eclipse.core.filesystem
>> -Eclipse-LazyStart: true
>> +Bundle-ActivationPolicy: lazy
>
> Any pointers on this? (so I can learn)
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/bundle_manifest.html
The Eclipse-AutoStart and Eclipse-LazyStart headers have been deprecated in Eclipse 3.4
>
>> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> index c01c1c3..61c32ce 100644
>> --- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> @@ -50,11 +50,11 @@
>> GitFileHistory(final IResource rsrc, final int flags,
>> final IProgressMonitor monitor) {
>> resource = rsrc;
>> - walk = buildWalk(flags);
>> + walk = buildWalk(/*flags*/);
>> revisions = buildRevisions(monitor, flags);
>> }
>> - private KidWalk buildWalk(final int flags) {
>> + private KidWalk buildWalk(/*final int flags*/) {
> Can't we just drop the parameter completely and wipe every trace of it?
OK
>> final RepositoryMapping rm = RepositoryMapping.getMapping(resource);
>> if (rm == null) {
>> Activator.logError("Git not attached to project "
>> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> index 04130db..db5f20b 100644
>> --- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> @@ -48,9 +48,9 @@
>> * a Git repository.
>> */
>> public class GitProjectData {
>> - private static final Map projectDataCache = new HashMap();
>> + private static final Map<IProject, GitProjectData> projectDataCache = new HashMap<IProject, GitProjectData>();
>>
>> - private static final Map repositoryCache = new HashMap();
>> + private static final Map<File, WeakReference> repositoryCache = new HashMap<File, WeakReference>();
> Been thinking about doing this myself but always found something more interesting to do. Good.
Hope that we will have a generic version of SWT/JFace sometime. Because now I do not know how to handle an inter operation between generic collections and SWT, use SuppressWarning there maybe?
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> index dcc53cd..4700510 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> @@ -175,8 +175,9 @@ public void back(int delta) {
>> // space so this prunes our search more quickly.
>> //
>> ptr -= Constants.OBJECT_ID_LENGTH;
>> - while (raw[--ptr] != ' ')
>> - /* nothing */;
>> + while (raw[--ptr] != ' ') {
>> + /* nothing */
>> + }
> Not sure if this buys us anything. I wouldn't react if original code was either way, but
> changing it seems unnecessary.
With an old version I get "Empty control-flow statement" warning, I've checked org.eclipse.jdt.core.prefs file, there is:
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
^ permalink raw reply
* Re: [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Vasyl' Vavrychuk @ 2009-01-05 1:08 UTC (permalink / raw)
To: git; +Cc: Shawn O. Pearce, git
In-Reply-To: <200901050004.41531.robin.rosenberg.lists@dewire.com>
Robin Rosenberg wrote:
> söndag 04 januari 2009 23:20:19 skrev Vasyl' Vavrychuk:
>> Also fixed:
>> 1. "The 'Eclipse-LazyStart' header is deprecated, use 'Bundle-ActivationPolicy'" warning.
>> 2. Possible NullPointerException warning.
>> 3. Unnecessery function parameter warning.
>
> Thanks for your interest in the projects.
> Most changes from a 30 seconds review look reasonable.
> However we don't apply changes this way. From your comments it seems we'd require about
> five patches since the changes are of very different types.
I thought that commit is trivial. But maybe series of patches will be better because of an ability to revert what we want.
>
> -- robin
>
>> diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> index ee5f277..e8bcc79 100644
>> --- a/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> +++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
>> @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
>> org.spearce.egit.ui,
>> org.spearce.jgit,
>> org.eclipse.core.filesystem
>> -Eclipse-LazyStart: true
>> +Bundle-ActivationPolicy: lazy
>
> Any pointers on this? (so I can learn)
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/bundle_manifest.html
The Eclipse-AutoStart and Eclipse-LazyStart headers have been deprecated in Eclipse 3.4
>
>> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> index c01c1c3..61c32ce 100644
>> --- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
>> @@ -50,11 +50,11 @@
>> GitFileHistory(final IResource rsrc, final int flags,
>> final IProgressMonitor monitor) {
>> resource = rsrc;
>> - walk = buildWalk(flags);
>> + walk = buildWalk(/*flags*/);
>> revisions = buildRevisions(monitor, flags);
>> }
>> - private KidWalk buildWalk(final int flags) {
>> + private KidWalk buildWalk(/*final int flags*/) {
> Can't we just drop the parameter completely and wipe every trace of it?
OK
>> final RepositoryMapping rm = RepositoryMapping.getMapping(resource);
>> if (rm == null) {
>> Activator.logError("Git not attached to project "
>> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> index 04130db..db5f20b 100644
>> --- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
>> @@ -48,9 +48,9 @@
>> * a Git repository.
>> */
>> public class GitProjectData {
>> - private static final Map projectDataCache = new HashMap();
>> + private static final Map<IProject, GitProjectData> projectDataCache = new HashMap<IProject, GitProjectData>();
>>
>> - private static final Map repositoryCache = new HashMap();
>> + private static final Map<File, WeakReference> repositoryCache = new HashMap<File, WeakReference>();
> Been thinking about doing this myself but always found something more interesting to do. Good.
Hope that we will have a generic version of SWT/JFace sometime. Because now I do not know how to handle an inter operation between generic collections and SWT, use SuppressWarning there maybe?
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> index dcc53cd..4700510 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
>> @@ -175,8 +175,9 @@ public void back(int delta) {
>> // space so this prunes our search more quickly.
>> //
>> ptr -= Constants.OBJECT_ID_LENGTH;
>> - while (raw[--ptr] != ' ')
>> - /* nothing */;
>> + while (raw[--ptr] != ' ') {
>> + /* nothing */
>> + }
> Not sure if this buys us anything. I wouldn't react if original code was either way, but
> changing it seems unnecessary.
With an old version I get "Empty control-flow statement" warning, I've checked org.eclipse.jdt.core.prefs file, there is:
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
^ permalink raw reply
* Re: git-branch --print-current
From: Junio C Hamano @ 2009-01-05 0:41 UTC (permalink / raw)
To: demerphq
Cc: Shawn O. Pearce, Karl Chen, Miklos Vajna, David Aguilar,
Git mailing list
In-Reply-To: <9b18b3110901040535m1f67cb7er95823d31443ee971@mail.gmail.com>
demerphq <demerphq@gmail.com> writes:
> The version im using, from git version 1.6.0.4.724.ga0d3a produces the
> following error:
>
> cut: ./HEAD: No such file or directory
>
> when in the .git/refs directory.
Personally, I think you are nuts to be in .git/refs and want to use that
information for anything useful, but if it is an easy enough fix, a patch
would be useful.
Shawn?
^ permalink raw reply
* Re: [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Vasyl' Vavrychuk @ 2009-01-04 23:26 UTC (permalink / raw)
To: git
In-Reply-To: <gjrcni$9q$1@ger.gmane.org>
Not sure what is right:
public abstract class AnyObjectId implements Comparable<ObjectId> {
or
public abstract class AnyObjectId implements Comparable<AnyObjectId> {
IMHO second, but class AnyObjectId contains some compareTo(ObjectId).
Also not sure if this bunch of changes is complete enough. Maybe it's better to make more fixes in this direction and then commit.
^ permalink raw reply
* Re: [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Robin Rosenberg @ 2009-01-04 23:04 UTC (permalink / raw)
To: Vasyl' Vavrychuk, Shawn O. Pearce; +Cc: git
In-Reply-To: <gjrcni$9q$1@ger.gmane.org>
söndag 04 januari 2009 23:20:19 skrev Vasyl' Vavrychuk:
> Also fixed:
> 1. "The 'Eclipse-LazyStart' header is deprecated, use 'Bundle-ActivationPolicy'" warning.
> 2. Possible NullPointerException warning.
> 3. Unnecessery function parameter warning.
Thanks for your interest in the projects. Most changes from a 30 seconds review look reasonable.
However we don't apply changes this way. From your comments it seems we'd require about
five patches since the changes are of very different types.
-- robin
> diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
> index ee5f277..e8bcc79 100644
> --- a/org.spearce.egit.core.test/META-INF/MANIFEST.MF
> +++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
> @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
> org.spearce.egit.ui,
> org.spearce.jgit,
> org.eclipse.core.filesystem
> -Eclipse-LazyStart: true
> +Bundle-ActivationPolicy: lazy
Any pointers on this? (so I can learn)
> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
> index c01c1c3..61c32ce 100644
> --- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
> @@ -50,11 +50,11 @@
> GitFileHistory(final IResource rsrc, final int flags,
> final IProgressMonitor monitor) {
> resource = rsrc;
> - walk = buildWalk(flags);
> + walk = buildWalk(/*flags*/);
> revisions = buildRevisions(monitor, flags);
> }
> - private KidWalk buildWalk(final int flags) {
> + private KidWalk buildWalk(/*final int flags*/) {
Can't we just drop the parameter completely and wipe every trace of it?
> final RepositoryMapping rm = RepositoryMapping.getMapping(resource);
> if (rm == null) {
> Activator.logError("Git not attached to project "
> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
> index 04130db..db5f20b 100644
> --- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
> @@ -48,9 +48,9 @@
> * a Git repository.
> */
> public class GitProjectData {
> - private static final Map projectDataCache = new HashMap();
> + private static final Map<IProject, GitProjectData> projectDataCache = new HashMap<IProject, GitProjectData>();
>
> - private static final Map repositoryCache = new HashMap();
> + private static final Map<File, WeakReference> repositoryCache = new HashMap<File, WeakReference>();
Been thinking about doing this myself but always found something more interesting to do. Good.
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
> index dcc53cd..4700510 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
> @@ -175,8 +175,9 @@ public void back(int delta) {
> // space so this prunes our search more quickly.
> //
> ptr -= Constants.OBJECT_ID_LENGTH;
> - while (raw[--ptr] != ' ')
> - /* nothing */;
> + while (raw[--ptr] != ' ') {
> + /* nothing */
> + }
Not sure if this buys us anything. I wouldn't react if original code was either way, but
changing it seems unnecessary.
-- robin
^ permalink raw reply
* Re: [PATCH next] git-cherry usage: correct nesting of commit-ish options
From: Miklos Vajna @ 2009-01-04 22:47 UTC (permalink / raw)
To: Markus Heidelberg; +Cc: gitster, git
In-Reply-To: <200901041901.18801.markus.heidelberg@web.de>
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
On Sun, Jan 04, 2009 at 07:01:18PM +0100, Markus Heidelberg <markus.heidelberg@web.de> wrote:
> > AFAIK sending patches against next is not preferred at all.
>
> From Documentation/SubmittingPatches:
>
> If you are preparing a work based on "next" branch,
> that is fine, but please mark it as such.
Ouch, then sorry for the misinformation. (Especially that it turns out
Junio added that line in 45d2b286.)
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [EGIT PATCH] Sorting commit items by click on the table header in commit dialog.
From: Vasyl' Vavrychuk @ 2009-01-04 22:46 UTC (permalink / raw)
To: git
In order to implement new feature I have replaced class associated with every table row.
CommitItem class encapsulate data that commit dialog manipulates with.
Comparators are written using idiom from http://tobega.blogspot.com/2008/05/beautiful-enums.html.
Clicks on a certain column are handled in HeaderSelectionListener class.
Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
---
.../egit/ui/internal/actions/CommitAction.java | 2 +-
.../egit/ui/internal/dialogs/CommitDialog.java | 248 ++++++++++++++------
2 files changed, 176 insertions(+), 74 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
index d703048..779596c 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/CommitAction.java
@@ -139,7 +139,7 @@ private void loadPreviousCommit() {
private void performCommit(CommitDialog commitDialog, String commitMessage)
throws TeamException {
// System.out.println("Commit Message: " + commitMessage);
- IFile[] selectedItems = commitDialog.getSelectedItems();
+ IFile[] selectedItems = commitDialog.getSelectedFiles();
HashMap<Repository, Tree> treeMap = new HashMap<Repository, Tree>();
try {
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index 4f932f2..a0598ff 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -15,6 +15,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import org.eclipse.core.resources.IFile;
@@ -28,9 +29,11 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
@@ -62,56 +65,38 @@
*/
public class CommitDialog extends Dialog {
+ class CommitContentProvider implements IStructuredContentProvider {
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // Empty
+ }
+
+ public void dispose() {
+ // Empty
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return items.toArray();
+ }
+
+ }
+
class CommitLabelProvider extends WorkbenchLabelProvider implements
ITableLabelProvider {
public String getColumnText(Object obj, int columnIndex) {
- IFile file = (IFile) obj;
- if (columnIndex == 1)
- return file.getProject().getName() + ": "
- + file.getProjectRelativePath();
+ CommitItem item = (CommitItem) obj;
- else if (columnIndex == 0) {
- String prefix = "Unknown";
+ switch (columnIndex) {
+ case 0:
+ return item.status;
- try {
- RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(file.getProject());
-
- Repository repo = repositoryMapping.getRepository();
- GitIndex index = repo.getIndex();
- Tree headTree = repo.mapTree("HEAD");
-
- String repoPath = repositoryMapping
- .getRepoRelativePath(file);
- TreeEntry headEntry = headTree.findBlobMember(repoPath);
- boolean headExists = headTree.existsBlob(repoPath);
-
- Entry indexEntry = index.getEntry(repoPath);
- if (headEntry == null) {
- prefix = "Added";
- if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Added, index diff";
- } else if (indexEntry == null) {
- prefix = "Removed";
- } else if (headExists
- && !headEntry.getId().equals(
- indexEntry.getObjectId())) {
- prefix = "Modified";
-
-
- if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Mod., index diff";
- } else if (!new File(repositoryMapping.getWorkDir(), indexEntry.getName()).isFile()) {
- prefix = "Rem., not staged";
- } else if (indexEntry.isModified(repositoryMapping.getWorkDir())) {
- prefix = "Mod., not staged";
- }
-
- } catch (Exception e) {
- }
+ case 1:
+ return item.file.getProject().getName() + ": "
+ + item.file.getProjectRelativePath();
- return prefix;
+ default:
+ return null;
}
- return null;
}
public Image getColumnImage(Object element, int columnIndex) {
@@ -121,7 +106,7 @@ public Image getColumnImage(Object element, int columnIndex) {
}
}
- ArrayList<IFile> files;
+ ArrayList<CommitItem> items = new ArrayList<CommitItem>();
/**
* @param parentShell
@@ -227,30 +212,17 @@ public void widgetDefaultSelected(SelectionEvent arg0) {
TableColumn statCol = new TableColumn(resourcesTable, SWT.LEFT);
statCol.setText("Status");
statCol.setWidth(150);
+ statCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByStatus));
TableColumn resourceCol = new TableColumn(resourcesTable, SWT.LEFT);
resourceCol.setText("File");
resourceCol.setWidth(415);
+ resourceCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByFile));
filesViewer = new CheckboxTableViewer(resourcesTable);
- filesViewer.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- // Empty
- }
-
- public void dispose() {
- // Empty
- }
-
- public Object[] getElements(Object inputElement) {
- return files.toArray();
- }
-
- });
+ filesViewer.setContentProvider(new CommitContentProvider());
filesViewer.setLabelProvider(new CommitLabelProvider());
- filesViewer.setInput(files);
+ filesViewer.setInput(items);
filesViewer.setAllChecked(true);
filesViewer.getTable().setMenu(getContextMenu());
@@ -271,15 +243,15 @@ public void handleEvent(Event arg0) {
try {
ArrayList<GitIndex> changedIndexes = new ArrayList<GitIndex>();
for (Iterator<Object> it = sel.iterator(); it.hasNext();) {
- IFile file = (IFile) it.next();
+ CommitItem commitItem = (CommitItem) it.next();
- IProject project = file.getProject();
+ IProject project = commitItem.file.getProject();
RepositoryMapping map = RepositoryMapping.getMapping(project);
Repository repo = map.getRepository();
GitIndex index = null;
index = repo.getIndex();
- Entry entry = index.getEntry(map.getRepoRelativePath(file));
+ Entry entry = index.getEntry(map.getRepoRelativePath(commitItem.file));
if (entry != null && entry.isModified(map.getWorkDir())) {
entry.update(new File(map.getWorkDir(), entry.getName()));
if (!changedIndexes.contains(index))
@@ -302,6 +274,47 @@ public void handleEvent(Event arg0) {
return menu;
}
+ private static String getFileStatus(IFile file) {
+ String prefix = "Unknown";
+
+ try {
+ RepositoryMapping repositoryMapping = RepositoryMapping
+ .getMapping(file.getProject());
+
+ Repository repo = repositoryMapping.getRepository();
+ GitIndex index = repo.getIndex();
+ Tree headTree = repo.mapTree("HEAD");
+
+ String repoPath = repositoryMapping.getRepoRelativePath(file);
+ TreeEntry headEntry = headTree.findBlobMember(repoPath);
+ boolean headExists = headTree.existsBlob(repoPath);
+
+ Entry indexEntry = index.getEntry(repoPath);
+ if (headEntry == null) {
+ prefix = "Added";
+ if (indexEntry.isModified(repositoryMapping.getWorkDir()))
+ prefix = "Added, index diff";
+ } else if (indexEntry == null) {
+ prefix = "Removed";
+ } else if (headExists
+ && !headEntry.getId().equals(indexEntry.getObjectId())) {
+ prefix = "Modified";
+
+ if (indexEntry.isModified(repositoryMapping.getWorkDir()))
+ prefix = "Mod., index diff";
+ } else if (!new File(repositoryMapping.getWorkDir(), indexEntry
+ .getName()).isFile()) {
+ prefix = "Rem., not staged";
+ } else if (indexEntry.isModified(repositoryMapping.getWorkDir())) {
+ prefix = "Mod., not staged";
+ }
+
+ } catch (Exception e) {
+ }
+
+ return prefix;
+ }
+
/**
* @return The message the user entered
*/
@@ -323,7 +336,7 @@ public void setCommitMessage(String s) {
private boolean amending = false;
private boolean amendAllowed = true;
- private ArrayList<IFile> selectedItems = new ArrayList<IFile>();
+ private ArrayList<IFile> selectedFiles = new ArrayList<IFile>();
private String previousCommitMessage = "";
/**
@@ -331,15 +344,51 @@ public void setCommitMessage(String s) {
*
* @param items
*/
- public void setSelectedItems(IFile[] items) {
- Collections.addAll(selectedItems, items);
+ public void setSelectedFiles(IFile[] items) {
+ Collections.addAll(selectedFiles, items);
}
/**
* @return the resources selected by the user to commit.
*/
- public IFile[] getSelectedItems() {
- return selectedItems.toArray(new IFile[0]);
+ public IFile[] getSelectedFiles() {
+ return selectedFiles.toArray(new IFile[0]);
+ }
+
+ class HeaderSelectionListener extends SelectionAdapter {
+
+ private CommitItem.Order order;
+
+ private boolean reversed;
+
+ public HeaderSelectionListener(CommitItem.Order order) {
+ this.order = order;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableColumn column = (TableColumn)e.widget;
+ Table table = column.getParent();
+
+ if (column == table.getSortColumn()) {
+ reversed = !reversed;
+ } else {
+ reversed = false;
+ }
+ table.setSortColumn(column);
+
+ Comparator<CommitItem> comparator;
+ if (reversed) {
+ comparator = order.descending();
+ table.setSortDirection(SWT.DOWN);
+ } else {
+ comparator = order;
+ table.setSortDirection(SWT.UP);
+ }
+
+ filesViewer.setComparator(new CommitViewerComparator(comparator));
+ }
+
}
@Override
@@ -350,9 +399,9 @@ protected void okPressed() {
amending = amendingButton.getSelection();
Object[] checkedElements = filesViewer.getCheckedElements();
- selectedItems.clear();
+ selectedFiles.clear();
for (Object obj : checkedElements)
- selectedItems.add((IFile) obj);
+ selectedFiles.add(((CommitItem) obj).file);
if (commitMessage.trim().length() == 0) {
MessageDialog.openWarning(getShell(), "No message", "You must enter a commit message");
@@ -368,7 +417,7 @@ protected void okPressed() {
}
} else author = null;
- if (selectedItems.isEmpty() && !amending) {
+ if (selectedFiles.isEmpty() && !amending) {
MessageDialog.openWarning(getShell(), "No items selected", "No items are currently selected to be committed.");
return;
}
@@ -382,7 +431,13 @@ protected void okPressed() {
* @param files potentially affected by a new commit
*/
public void setFileList(ArrayList<IFile> files) {
- this.files = files;
+ items.clear();
+ for (IFile file : files) {
+ CommitItem item = new CommitItem();
+ item.status = getFileStatus(file);
+ item.file = file;
+ items.add(item);
+ }
}
@Override
@@ -468,3 +523,50 @@ protected int getShellStyle() {
return super.getShellStyle() | SWT.RESIZE;
}
}
+
+class CommitItem {
+ String status;
+
+ IFile file;
+
+ public static enum Order implements Comparator<CommitItem> {
+ ByStatus() {
+
+ public int compare(CommitItem o1, CommitItem o2) {
+ return o1.status.compareTo(o2.status);
+ }
+
+ },
+
+ ByFile() {
+
+ public int compare(CommitItem o1, CommitItem o2) {
+ return o1.file.getProjectRelativePath().toString().
+ compareTo(o2.file.getProjectRelativePath().toString());
+ }
+
+ };
+
+ public Comparator<CommitItem> ascending() {
+ return this;
+ }
+
+ public Comparator<CommitItem> descending() {
+ return Collections.reverseOrder(this);
+ }
+ }
+}
+
+class CommitViewerComparator extends ViewerComparator {
+
+ public CommitViewerComparator(Comparator comparator){
+ super(comparator);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return getComparator().compare(e1, e2);
+ }
+
+}
--
1.5.6.1.1071.g76fb
^ permalink raw reply related
* Re: git-rev-parse --symbolic-abbrev-name
From: Miklos Vajna @ 2009-01-04 22:38 UTC (permalink / raw)
To: Arnaud Lacombe; +Cc: Junio C Hamano, Karl Chen, David Aguilar, Git mailing list
In-Reply-To: <1a69a9d80901041223r1f3d2956ne05996793bb23e97@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
On Sun, Jan 04, 2009 at 03:23:03PM -0500, Arnaud Lacombe <lacombar@gmail.com> wrote:
> ps: I choose --symbolic-short-name as the opposite of
> --symbolic-full-name for consistency.
> ps2: sorry for the bogus mime-type
That's not a problem, just don't attach your patch. Please read
Documentation/SubmittingPatches.
Thanks.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: unclear description of git-rm on kernel.org
From: Miklos Vajna @ 2009-01-04 22:35 UTC (permalink / raw)
To: alec resnick; +Cc: git
In-Reply-To: <62a60dd90901041410j283866e5ja39c3bda447fed36@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
On Sun, Jan 04, 2009 at 05:10:11PM -0500, alec resnick <alec@sproutward.org> wrote:
> I was trying to remove a number of files from a git repo I had. I
> read http://kernel.org/pub/software/scm/git/docs/v1.4.4.4/git-rm.html
Ugh, why are you reading that ancient version?
I would try:
http://www.kernel.org/pub/software/scm/git/docs/git-rm.html
> I'd be happy to make the changes to the webpage; I don't know how to
> do that or if it's appropriate.
They are generated from asciidoc files from the Documentation/ dir, but
documentation fixes are welcome against 1.6.1.x or master only, I'm
afraid.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [EGIT PATCH] Fixed trivial warnings. Mainly parametrized raw types, added serialVersionUID, removed unnecessery throws.
From: Vasyl' Vavrychuk @ 2009-01-04 22:20 UTC (permalink / raw)
To: git
Also fixed:
1. "The 'Eclipse-LazyStart' header is deprecated, use 'Bundle-ActivationPolicy'" warning.
2. Possible NullPointerException warning.
3. Unnecessery function parameter warning.
Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
---
org.spearce.egit.core.test/META-INF/MANIFEST.MF | 2 +-
org.spearce.egit.core/META-INF/MANIFEST.MF | 2 +-
.../egit/core/internal/storage/GitFileHistory.java | 4 +-
.../spearce/egit/core/project/GitProjectData.java | 18 +++----
.../egit/core/project/RepositoryFinder.java | 5 +-
org.spearce.egit.ui/META-INF/MANIFEST.MF | 2 +-
.../egit/ui/internal/actions/RepositoryAction.java | 2 +-
.../tst/org/spearce/jgit/lib/T0002_Tree.java | 4 +-
org.spearce.jgit/META-INF/MANIFEST.MF | 2 +-
.../jgit/errors/InvalidPatternException.java | 2 +
.../jgit/errors/NoClosingBracketException.java | 1 +
.../jgit/errors/RevisionSyntaxException.java | 1 +
.../src/org/spearce/jgit/lib/AnyObjectId.java | 6 +--
.../src/org/spearce/jgit/lib/GitIndex.java | 29 +++++------
.../src/org/spearce/jgit/lib/ObjectIdMap.java | 1 -
.../src/org/spearce/jgit/lib/ObjectWriter.java | 1 -
.../src/org/spearce/jgit/lib/TreeIterator.java | 2 +-
.../jgit/lib/TreeVisitorWithCurrentDirectory.java | 5 +-
.../src/org/spearce/jgit/revwalk/RevWalk.java | 3 +-
.../jgit/transport/DefaultSshSessionFactory.java | 2 +-
.../spearce/jgit/treewalk/CanonicalTreeParser.java | 5 +-
.../src/org/spearce/jgit/util/Base64.java | 52 ++++++++++++--------
22 files changed, 76 insertions(+), 75 deletions(-)
diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
index ee5f277..e8bcc79 100644
--- a/org.spearce.egit.core.test/META-INF/MANIFEST.MF
+++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
@@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.spearce.egit.ui,
org.spearce.jgit,
org.eclipse.core.filesystem
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.core.resources,
org.eclipse.jdt.core,
org.eclipse.jdt.junit,
diff --git a/org.spearce.egit.core/META-INF/MANIFEST.MF b/org.spearce.egit.core/META-INF/MANIFEST.MF
index 6c95084..43fc566 100644
--- a/org.spearce.egit.core/META-INF/MANIFEST.MF
+++ b/org.spearce.egit.core/META-INF/MANIFEST.MF
@@ -16,5 +16,5 @@ Export-Package: org.spearce.egit.core.internal.storage;x-friends:="org.spearce.e
org.spearce.egit.core,
org.spearce.egit.core.op,
org.spearce.egit.core.project
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
index c01c1c3..61c32ce 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/storage/GitFileHistory.java
@@ -50,11 +50,11 @@
GitFileHistory(final IResource rsrc, final int flags,
final IProgressMonitor monitor) {
resource = rsrc;
- walk = buildWalk(flags);
+ walk = buildWalk(/*flags*/);
revisions = buildRevisions(monitor, flags);
}
- private KidWalk buildWalk(final int flags) {
+ private KidWalk buildWalk(/*final int flags*/) {
final RepositoryMapping rm = RepositoryMapping.getMapping(resource);
if (rm == null) {
Activator.logError("Git not attached to project "
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
index 04130db..db5f20b 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
@@ -48,9 +48,9 @@
* a Git repository.
*/
public class GitProjectData {
- private static final Map projectDataCache = new HashMap();
+ private static final Map<IProject, GitProjectData> projectDataCache = new HashMap<IProject, GitProjectData>();
- private static final Map repositoryCache = new HashMap();
+ private static final Map<File, WeakReference> repositoryCache = new HashMap<File, WeakReference>();
private static RepositoryChangeListener[] repositoryChangeListeners = {};
@@ -193,7 +193,7 @@ private synchronized static void uncache(final IProject p) {
}
private synchronized static GitProjectData lookup(final IProject p) {
- return (GitProjectData) projectDataCache.get(p);
+ return projectDataCache.get(p);
}
private synchronized static Repository lookupRepository(final File gitDir)
@@ -206,11 +206,11 @@ private synchronized static Repository lookupRepository(final File gitDir)
}
}
- final Reference r = (Reference) repositoryCache.get(gitDir);
+ final Reference r = repositoryCache.get(gitDir);
Repository d = r != null ? (Repository) r.get() : null;
if (d == null) {
d = new Repository(gitDir);
- repositoryCache.put(gitDir, new WeakReference(d));
+ repositoryCache.put(gitDir, new WeakReference<Repository>(d));
}
return d;
}
@@ -229,9 +229,9 @@ public static void reconfigureWindowCache() {
private final IProject project;
- private final Collection mappings;
+ private final Collection<RepositoryMapping> mappings = new ArrayList<RepositoryMapping>();
- private final Set protectedResources;
+ private final Set<IResource> protectedResources = new HashSet<IResource>();
/**
* Construct a {@link GitProjectData} for the mapping
@@ -241,8 +241,6 @@ public static void reconfigureWindowCache() {
*/
public GitProjectData(final IProject p) {
project = p;
- mappings = new ArrayList();
- protectedResources = new HashSet();
}
/**
@@ -257,7 +255,7 @@ public IProject getProject() {
*
* @param newMappings
*/
- public void setRepositoryMappings(final Collection newMappings) {
+ public void setRepositoryMappings(final Collection<RepositoryMapping> newMappings) {
mappings.clear();
mappings.addAll(newMappings);
remapAll();
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryFinder.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryFinder.java
index c33f3a0..2b4b16f 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryFinder.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryFinder.java
@@ -47,7 +47,7 @@
public class RepositoryFinder {
private final IProject proj;
- private final Collection results;
+ private final Collection<RepositoryMapping> results = new ArrayList<RepositoryMapping>();
/**
* Create a new finder to locate Git repositories for a project.
@@ -58,7 +58,6 @@
*/
public RepositoryFinder(final IProject p) {
proj = p;
- results = new ArrayList();
}
/**
@@ -72,7 +71,7 @@ public RepositoryFinder(final IProject p) {
* Eclipse was unable to access its workspace, and threw up on
* us. We're throwing it back at the caller.
*/
- public Collection find(IProgressMonitor m) throws CoreException {
+ public Collection<RepositoryMapping> find(IProgressMonitor m) throws CoreException {
if (m == null) {
m = new NullProgressMonitor();
}
diff --git a/org.spearce.egit.ui/META-INF/MANIFEST.MF b/org.spearce.egit.ui/META-INF/MANIFEST.MF
index ec1df4d..019ef6e 100644
--- a/org.spearce.egit.ui/META-INF/MANIFEST.MF
+++ b/org.spearce.egit.ui/META-INF/MANIFEST.MF
@@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.spearce.jgit,
org.spearce.egit.core,
org.eclipse.jsch.ui;bundle-version="1.1.100"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.jsch.core,
org.eclipse.jsch.internal.core
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/RepositoryAction.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/RepositoryAction.java
index 8c250ca..362437e 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/RepositoryAction.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/RepositoryAction.java
@@ -100,7 +100,7 @@ protected Repository getRepository(boolean warn) {
mapping = repositoryMapping;
if (repositoryMapping == null)
return null;
- if (repositoryMapping != null && mapping.getRepository() != repositoryMapping.getRepository()) {
+ if (mapping.getRepository() != repositoryMapping.getRepository()) {
if (warn)
MessageDialog.openError(getShell(), "Multiple Repositories Selection", "Cannot perform reset on multiple repositories simultaneously.\n\nPlease select items from only one repository.");
return null;
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java
index fcb4d96..97f299c 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0002_Tree.java
@@ -236,7 +236,7 @@ public void test006_addDeepTree() throws IOException {
public void test007_manyFileLookup() throws IOException {
final Tree t = new Tree(db);
- final List files = new ArrayList(26 * 26);
+ final List<FileTreeEntry> files = new ArrayList<FileTreeEntry>(26 * 26);
for (char level1 = 'a'; level1 <= 'z'; level1++) {
for (char level2 = 'a'; level2 <= 'z'; level2++) {
final String n = "." + level1 + level2 + "9";
@@ -251,7 +251,7 @@ public void test007_manyFileLookup() throws IOException {
assertNotNull(ents);
assertEquals(files.size(), ents.length);
for (int k = 0; k < ents.length; k++) {
- assertTrue("File " + ((FileTreeEntry) files.get(k)).getName()
+ assertTrue("File " + files.get(k).getName()
+ " is at " + k + ".", files.get(k) == ents[k]);
}
}
diff --git a/org.spearce.jgit/META-INF/MANIFEST.MF b/org.spearce.jgit/META-INF/MANIFEST.MF
index 36f92f2..459e8f3 100644
--- a/org.spearce.jgit/META-INF/MANIFEST.MF
+++ b/org.spearce.jgit/META-INF/MANIFEST.MF
@@ -16,7 +16,7 @@ Export-Package: org.spearce.jgit.dircache,
org.spearce.jgit.treewalk,
org.spearce.jgit.treewalk.filter,
org.spearce.jgit.util
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: com.jcraft.jsch;visibility:=reexport
diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/InvalidPatternException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/InvalidPatternException.java
index 15d159b..e7be0d6 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/errors/InvalidPatternException.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/errors/InvalidPatternException.java
@@ -42,6 +42,8 @@
*
*/
public class InvalidPatternException extends Exception {
+ private static final long serialVersionUID = 1L;
+
private final String pattern;
/**
diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/NoClosingBracketException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/NoClosingBracketException.java
index 1a93906..8fe9ab1 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/errors/NoClosingBracketException.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/errors/NoClosingBracketException.java
@@ -42,6 +42,7 @@
* side or a character class which is open to the right side.
*/
public class NoClosingBracketException extends InvalidPatternException {
+ private static final long serialVersionUID = 1L;
/**
* @param indexOfOpeningBracket
diff --git a/org.spearce.jgit/src/org/spearce/jgit/errors/RevisionSyntaxException.java b/org.spearce.jgit/src/org/spearce/jgit/errors/RevisionSyntaxException.java
index ac425bb..f943879 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/errors/RevisionSyntaxException.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/errors/RevisionSyntaxException.java
@@ -45,6 +45,7 @@
* properly formatted.
*/
public class RevisionSyntaxException extends IOException {
+ private static final long serialVersionUID = 1L;
private final String revstr;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
index a534202..f3e4534 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
@@ -52,7 +52,7 @@
* with this instance can alter at any time, if this instance is modified to
* represent a different object name.
*/
-public abstract class AnyObjectId implements Comparable {
+public abstract class AnyObjectId implements Comparable<ObjectId> {
static final int RAW_LEN = Constants.OBJECT_ID_LENGTH;
static final int STR_LEN = RAW_LEN * 2;
@@ -178,10 +178,6 @@ public int compareTo(final ObjectId other) {
return NB.compareUInt32(w5, other.w5);
}
- public int compareTo(final Object other) {
- return compareTo(((ObjectId) other));
- }
-
int compareTo(final byte[] bs, final int p) {
int cmp;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
index bafddef..7c3f1b4 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
@@ -107,18 +107,16 @@
private final Repository db;
- private Map entries = new TreeMap(new Comparator() {
- public int compare(Object arg0, Object arg1) {
- byte[] a = (byte[]) arg0;
- byte[] b = (byte[]) arg1;
- for (int i = 0; i < a.length && i < b.length; ++i) {
- int c = a[i] - b[i];
+ private Map<byte[], Entry> entries = new TreeMap<byte[], Entry>(new Comparator<byte[]>() {
+ public int compare(byte[] o1, byte[] o2) {
+ for (int i = 0; i < o1.length && i < o2.length; ++i) {
+ int c = o1[i] - o2[i];
if (c != 0)
return c;
}
- if (a.length < b.length)
+ if (o1.length < o2.length)
return -1;
- else if (a.length > b.length)
+ else if (o1.length > o2.length)
return 1;
return 0;
}
@@ -161,7 +159,7 @@ public void rereadIfNecessary() throws IOException {
*/
public Entry add(File wd, File f) throws IOException {
byte[] key = makeKey(wd, f);
- Entry e = (Entry) entries.get(key);
+ Entry e = entries.get(key);
if (e == null) {
e = new Entry(key, f, 0);
entries.put(key, e);
@@ -302,7 +300,7 @@ static boolean File_hasExecute() {
return FS.INSTANCE.supportsExecute();
}
- static byte[] makeKey(File wd, File f) throws IOException {
+ static byte[] makeKey(File wd, File f) {
if (!f.getPath().startsWith(wd.getPath()))
throw new Error("Path is not in working dir");
String relName = Repository.stripWorkDir(wd, f);
@@ -362,8 +360,7 @@ Entry(byte[] key, File f, int stage)
flags = (short) ((stage << 12) | name.length); // TODO: fix flags
}
- Entry(TreeEntry f, int stage)
- throws UnsupportedEncodingException {
+ Entry(TreeEntry f, int stage) {
ctime = -1; // hmm
mtime = -1;
dev = -1;
@@ -810,7 +807,7 @@ public ObjectId writeTree() throws IOException {
checkWriteOk();
ObjectWriter writer = new ObjectWriter(db);
Tree current = new Tree(db);
- Stack trees = new Stack();
+ Stack<Tree> trees = new Stack<Tree>();
trees.push(current);
String[] prevName = new String[0];
for (Iterator i = entries.values().iterator(); i.hasNext();) {
@@ -844,7 +841,7 @@ public ObjectId writeTree() throws IOException {
current.setId(writer.writeTree(current));
trees.pop();
if (!trees.isEmpty())
- current = (Tree) trees.peek();
+ current = trees.peek();
}
return current.getTreeId();
}
@@ -886,7 +883,7 @@ int longestCommonPath(String[] a, String[] b) {
* @return The index entries sorted
*/
public Entry[] getMembers() {
- return (Entry[]) entries.values().toArray(new Entry[entries.size()]);
+ return entries.values().toArray(new Entry[entries.size()]);
}
/**
@@ -897,7 +894,7 @@ int longestCommonPath(String[] a, String[] b) {
* @throws UnsupportedEncodingException
*/
public Entry getEntry(String path) throws UnsupportedEncodingException {
- return (Entry) entries.get(Repository.gitInternalSlash(Constants.encode(path)));
+ return entries.get(Repository.gitInternalSlash(Constants.encode(path)));
}
/**
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
index 600d0f4..d3c7f1d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectIdMap.java
@@ -178,7 +178,6 @@ public boolean isEmpty() {
return true;
}
- @SuppressWarnings("unchecked")
public V put(ObjectId key, V value) {
return submap(key).put(key, value);
}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
index 6c2cd4f..e84798a 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
@@ -289,7 +289,6 @@ public ObjectId computeBlobSha1(final long len, final InputStream is)
return writeObject(Constants.OBJ_BLOB, len, is, false);
}
- @SuppressWarnings("null")
ObjectId writeObject(final int type, long len, final InputStream is,
boolean store) throws IOException {
final File t;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeIterator.java
index 2344a3c..ec52078 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeIterator.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeIterator.java
@@ -76,7 +76,7 @@
* Visit leaves first, then node
*/
POSTORDER
- };
+ }
/**
* Construct a {@link TreeIterator} for visiting all non-tree nodes.
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java
index 55854b2..e227adb 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java
@@ -46,12 +46,11 @@
* Abstract TreeVisitor for visiting all files known by a Tree.
*/
public abstract class TreeVisitorWithCurrentDirectory implements TreeVisitor {
- private final ArrayList stack;
+ private final ArrayList<File> stack = new ArrayList<File>(16);
private File currentDirectory;
protected TreeVisitorWithCurrentDirectory(final File rootDirectory) {
- stack = new ArrayList(16);
currentDirectory = rootDirectory;
}
@@ -67,6 +66,6 @@ public void startVisitTree(final Tree t) throws IOException {
}
public void endVisitTree(final Tree t) throws IOException {
- currentDirectory = (File) stack.remove(stack.size() - 1);
+ currentDirectory = stack.remove(stack.size() - 1);
}
}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
index d7e4c58..8d25125 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
@@ -1014,8 +1014,7 @@ protected RevCommit createCommit(final AnyObjectId id) {
return new RevCommit(id);
}
- void carryFlagsImpl(final RevCommit c) throws MissingObjectException,
- IncorrectObjectTypeException, IOException {
+ void carryFlagsImpl(final RevCommit c) {
final int carry = c.flags & carryFlags;
if (carry != 0)
RevCommit.carryFlags(c, carry);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java b/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java
index 89beab7..0d522df 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/DefaultSshSessionFactory.java
@@ -153,7 +153,7 @@ private void knownHosts(final JSch sch) throws JSchException {
}
}
- private void identities() throws JSchException {
+ private void identities() {
final File home = FS.userHome();
if (home == null)
return;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
index dcc53cd..4700510 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
@@ -175,8 +175,9 @@ public void back(int delta) {
// space so this prunes our search more quickly.
//
ptr -= Constants.OBJECT_ID_LENGTH;
- while (raw[--ptr] != ' ')
- /* nothing */;
+ while (raw[--ptr] != ' ') {
+ /* nothing */
+ }
if (--ptr < Constants.OBJECT_ID_LENGTH) {
if (delta != 0)
throw new ArrayIndexOutOfBoundsException(delta);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/util/Base64.java b/org.spearce.jgit/src/org/spearce/jgit/util/Base64.java
index 8c45539..d81867b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/util/Base64.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/util/Base64.java
@@ -7,6 +7,9 @@
package org.spearce.jgit.util;
+import java.io.Closeable;
+import java.io.IOException;
+
/**
* Encodes and decodes to and from Base64 notation.
@@ -175,11 +178,20 @@
private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
+ private static void closeStream(Closeable stream) {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
/** Defeats instantiation. */
- private Base64(){}
-
-
+ private Base64() {
+ //suppress empty block warning
+ }
/* ******** E N C O D I N G M E T H O D S ******** */
@@ -353,10 +365,10 @@ public static String encodeObject( java.io.Serializable serializableObject, int
} // end catch
finally
{
- try{ oos.close(); } catch( Exception e ){}
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
+ closeStream(oos);
+ closeStream(gzos);
+ closeStream(b64os);
+ closeStream(baos);
} // end finally
// Return value according to relevant encoding.
@@ -486,9 +498,9 @@ public static String encodeBytes( byte[] source, int off, int len, int options )
} // end catch
finally
{
- try{ gzos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
+ closeStream(gzos);
+ closeStream(b64os);
+ closeStream(baos);
} // end finally
// Return value according to relevant encoding.
@@ -763,9 +775,9 @@ else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
} // end catch
finally
{
- try{ baos.close(); } catch( Exception e ){}
- try{ gzis.close(); } catch( Exception e ){}
- try{ bais.close(); } catch( Exception e ){}
+ closeStream(baos);
+ closeStream(gzis);
+ closeStream(bais);
} // end finally
} // end if: gzipped
@@ -804,17 +816,15 @@ public static Object decodeToObject( String encodedObject )
catch( java.io.IOException e )
{
e.printStackTrace();
- obj = null;
} // end catch
catch( java.lang.ClassNotFoundException e )
{
e.printStackTrace();
- obj = null;
} // end catch
finally
{
- try{ bais.close(); } catch( Exception e ){}
- try{ ois.close(); } catch( Exception e ){}
+ closeStream(bais);
+ closeStream(ois);
} // end finally
return obj;
@@ -849,7 +859,7 @@ public static boolean encodeToFile( byte[] dataToEncode, String filename )
} // end catch: IOException
finally
{
- try{ bos.close(); } catch( Exception e ){}
+ closeStream(bos);
} // end finally
return success;
@@ -882,7 +892,7 @@ public static boolean decodeToFile( String dataToDecode, String filename )
} // end catch: IOException
finally
{
- try{ bos.close(); } catch( Exception e ){}
+ closeStream(bos);
} // end finally
return success;
@@ -940,7 +950,7 @@ public static boolean decodeToFile( String dataToDecode, String filename )
} // end catch: IOException
finally
{
- try{ bis.close(); } catch( Exception e) {}
+ closeStream(bis);
} // end finally
return decodedData;
@@ -988,7 +998,7 @@ public static String encodeFromFile( String filename )
} // end catch: IOException
finally
{
- try{ bis.close(); } catch( Exception e) {}
+ closeStream(bis);
} // end finally
return encodedData;
--
1.5.6.1.1071.g76fb
^ permalink raw reply related
* unclear description of git-rm on kernel.org
From: alec resnick @ 2009-01-04 22:10 UTC (permalink / raw)
To: git
Hi!
I was trying to remove a number of files from a git repo I had. I
read http://kernel.org/pub/software/scm/git/docs/v1.4.4.4/git-rm.html
which I interpreted to mean that git-rm removed only from the index,
and not from the working tree. In retrospect, the short description
is clear: "git-rm - Remove files from the working tree and from the
index," but I was confused by the language:
"<file>…
Files to remove from the index and optionally, from the working
tree as well.
-f
Remove files from the working tree as well as from the index."
Because of "optionally" and the very existence of the "-f" option
suggests that you have to do something extra to ask git-rm to mess
with the working tree.
The manpage is much clearer, and while I recovered the files I
accidentally removed simply with git checkout, I suggest that the
webpage be made a bit clearer. In particular, adding info about how
to _only_ remove files from the index would be helpful.
I'd be happy to make the changes to the webpage; I don't know how to
do that or if it's appropriate.
Thanks!
-a.
^ 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