Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [egit-jgit] excluded patterns are decorated as being untracked

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:44:47

Robin Rosenberg [off-list ref] wrote:
Btw, Here is an attempt to match folders by Team ignore patterns too.

(OT: I did not format the code. (please try, and you'll see why). We'll have
to come up with something better than an 80-column format, it's so seventies)
Ignoring the patch for a second, I'm a die-hard 80 column format
person.  You can pry my 80 column wide terminals from me long after
I'm dead.

In Java it may seem like an 80 column limit is a problem, because
the code often gets nested deep and far to the right, such as in
this example here.  I find that just like in C, when code is this
far indented to the right in Java its too damn complex as-is and
should be refactored into smaller methods, and anonymous types
should perhaps be converted to named inner classes or top-level
classes of their own right.

My laptop display panel is only 1440 pixels wide.  By the time I
get my Eclipse workbench open I have about 90 characters wide for
the editor page, given how I place the other views and non-Eclipse
applications around the edges.  Pushing much beyond 80 characters
wide makes it very hard to read code quickly.

And no, I do not want to tote a laptop with a display that is 9000
pixels wide, thanks.

So IMHO, code in jgit+egit should try to target 80 characters wide
as much as possible.  If you can't hit that you need to rethink how
you have the code structured.  I've never refactored something into
smaller more modular methods (to hit the 80 target) and said "gee,
that refactoring made my code harder to understand, what with those
highly descriptive method names and javadoc I gave everything".

OK, now you can call me crazy.
 
quoted hunk ↗ jump to hunk
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
index 6521f1c..af16cdb 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
@@ -90,13 +90,20 @@ public class TrackOperation implements IWorkspaceRunnable {
 							public boolean visit(IResource resource) throws CoreException {
 								try {
 									String repoPath = rm.getRepoRelativePath(resource);
+									// We use add to reset the assume valid bit, so we check the bit
+									// first. If a resource within a ignored folder is marked
+									// we ignore it here, i.e. there is no way to unmark it expect
+									// by explicitly selecting and invoking track on it.
 									if (resource.getType() == IResource.FILE) {
 										Entry entry = index.getEntry(repoPath);
-										if (!Team.isIgnored((IFile)resource) || entry != null && entry.isAssumedValid()) {
+										if (!Team.isIgnoredHint(resource) || entry != null && entry.isAssumedValid()) {
 											entry = index.add(rm.getWorkDir(), new File(rm.getWorkDir(), repoPath));
 											entry.setAssumeValid(false);
 										}
 									}
+									if (Team.isIgnoredHint(resource))
+										return false;
+
 								} catch (IOException e) {
 									e.printStackTrace();
 									throw Activator.error(CoreText.AddOperation_failed, e);
-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help