Git development
 help / color / mirror / Atom feed
* Re: Should we discuss Windows-related changes on git@vger.kernel.org?
From: Johannes Schindelin @ 2008-07-11 11:56 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: Johannes Sixt, Junio C Hamano, msysGit, Git Mailing List
In-Reply-To: <DDFD7E3B-8401-4EA0-9BBA-C9D8E25998A3@zib.de>

Hi,

On Fri, 11 Jul 2008, Steffen Prohaska wrote:

> I decided to stop queuing changes in 4msysgit.  Instead I'd like to
> bring the diff between Junio's and 4msysgit's master to zero.  This
> seems to be achievable after Junio merged Hannes' MinGW changes.
> 
> I think all Windows-related changes to the git code base could be
> discussed directly on the main git list and the msysgit list would be
> reserved for the MinGW/MSYS runtime environment and the installer.

I disagree.  Judging from the mails I read on the git list, Junio gets 
really swamped by patches these days (what with our very productive GSoC 
students).

I really think that we should discuss the patches on the msysGit list 
first, whip them into shape, and then send them off.

Just think of those patches that were sent off, only to realize that they 
were no longer needed.  That should not have happened.

My 2p,
Dscho

^ permalink raw reply

* Re: Errors importing Apache Synapse SVN using Git
From: Michael J Gruber @ 2008-07-11 11:54 UTC (permalink / raw)
  To: git; +Cc: Eric Wong
In-Reply-To: <4875FA23.30603@wso2.com>

Asankha C. Perera venit, vidit, dixit 10.07.2008 14:01:
> Hi All
> 
> I am an Apache Synapse developer, and want to import the Synapse SVN 
> repo into Git, so that Ohloh can properly get the Synapse history 
> (http://www.ohloh.net/topics/1326?page=1#post_6287)
> 
> However, when I try the command: "git svn clone --trunk=trunk 
> --tags=tags --branches=branches http://svn.apache.org/repos/asf/synapse" 
> it seems to take forever, (or at least until the next network glitch), 
> and keeps filling up a file with just plain zeros ("0") : 
> ./.git/svn/trunk/.rev_db.13f79535-47bb-0310-9956-ffa450edef68

Okay, besides the zero offset, there seems to be big problem with the 
svn repo:

svn list -r 234478 http://svn.apache.org/repos/asf/synapse
branches/
site/
tags/
trunk/

svn list -r 234478 http://svn.apache.org/repos/asf|grep synapse

Right, nothing returned.

git-svn insists on using http://svn.apache.org/repos/asf as the base 
URL, which is basically correct, but doesn't work for this repo.

Even editing .git/config and .git/svn/metadata (after git svn init, 
befire the first fetch) to change the url doesn't help. git svn still 
uses .../asf. Is this as intended? cc'ing the git svn author.

Michael

^ permalink raw reply

* Re: [PATCH] bisect: test merge base if good rev is not an ancestor of bad rev
From: Johannes Schindelin @ 2008-07-11 11:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Michael Haggerty, Jeff King, git
In-Reply-To: <7vabgolxqa.fsf@gitster.siamese.dyndns.org>

Hi,

On Thu, 10 Jul 2008, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Thu, 10 Jul 2008, Junio C Hamano wrote:
> >
> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >> 
> > Of course it can be that the user commits a pilot error and says "but 
> > that unrelated version was good", while the fork point(s) between good 
> > and bad was bad (and this might be even the intention of the user, to 
> > find _one_ commit that introduced the bug).
> >
> > Speaking of plural, what if some of the merge bases are good, some are 
> > bad?
> >
> > Without carefully thinking it through, you might even _break_ the tool.
> 
> And you think it is better to make all of your _users_ think it through
> every time?  Isn't it more error prone?

Maybe I am alone here, but except for that occasion that triggered my 
"fixed/unfixed" patch, I did have to think, in order to use git-bisect.  I 
said "git bisect start && git bisect bad HEAD && git bisect good 
HEAD@{1.day.ago}", and then follow the instructions.

> > All I was proposing is keeping the current semantics, keeping the 
> > mechanism simple, and therefore reliable.
> 
> What I suggested to Christian (sorry, I've been busy and I still haven't 
> checked if that is what was implemented in the patch -- that is why I 
> suggested you to read the original thread) was:
> 
> 	- check good and bad to see if they are forked
> 
>         - iff they are,
> 
>           - have the user check merge bases and make sure they are all
>             good.  otherwise, the initial good/bad pair is unsuitable for
>             bisection, so explain the situation and quit [*1*];
> 
> 	  - otherwise, keep these good markers.
> 
> 	- do the usual bisection --- from this point on it is "simple and
>           reliable as it has always been".

Okay, that seems like a trivial and good patch.

> *1* We _could_ make things more complex by offering to swap good and bad
> at this point and then continue bisecting to find a commit to cherry-pick
> to forward port the fix.  Arguably, that step would be a new code and
> could start out to be buggy --- it _could_ be called destabilizing what
> has been reliable, but even then, it would be a separate codepath and a
> new bug will be something that triggers only when the user accepts that
> offer.  I do not see what the big deal is that you seem to be worried
> about.

That is what I am actually scared off.  That in the wake of a nice and 
trivial patch, things get muddied and complicated like back when "rebase 
-i -m" was made unusable for the layman.

Ciao,
Dscho

^ permalink raw reply

* Re: [EGIT PATCH 2/6] Using the page site selection turned out to be cumbersome.
From: Johannes Schindelin @ 2008-07-11 11:14 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Robin Rosenberg, git, Marek Zawirski
In-Reply-To: <20080711035249.GA32652@spearce.org>

Hi,

On Fri, 11 Jul 2008, Shawn O. Pearce wrote:

> "Shawn O. Pearce" <spearce@spearce.org> wrote:
> > Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> > 
> > > +         <action
> > > +               class="org.spearce.egit.ui.internal.actions.ResetAction"
> > > +               id="org.spearce.egit.ui.action1"
> > > +               label="Titta"

Just in case somebody thought Robin tried to slip in a perverse word: not 
so.  In Swedish, "Titta" means "look!".

Ciao,
Dscho

^ permalink raw reply

* Differences between git-applu and GNU patch (was: [JGIT PATCH 1/1] jgit: create a tag command)
From: Jakub Narebski @ 2008-07-11 10:50 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: Mike Ralphson, Shawn O. Pearce, Marek Zawirski, git
In-Reply-To: <200807102002.11044.robin.rosenberg.lists@dewire.com>

Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:

> torsdagen den 10 juli 2008 17.31.06 skrev Mike Ralphson:

> > 
> > Apologies this will be whitespace damaged, but it's trivial.
>
> Don't do like that again : Had to use patch -l to apply this.
> Why doesn't git am have that?

It is not git-am that should have implemented -l / --ignore-whitespace
option, but git-apply... well, beside passing it to git-apply of course.


I tried to look up how git-apply is implemented (builtin-apply.c),
but it looks like it implements patching itself, and I am not familiar
at all with this code... BTW. why applying patch is not left to xdiff
code?

It would be nice if git-apply implemented larger subset of GNU patch
options, for example --dry-run (which is similar but I think not
exactly the same as --check), --fuzz=<num> (how it differs from -C<n>?)
--strip=<num> as equivalent to -p<n>, -l / --ignore-whitespace, 
--reject-file=<rejectfile> together with --reject...
-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* [PATCH 4/4] Add a method to listen to changes in any repository
From: Robin Rosenberg @ 2008-07-11  9:48 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Marek Zawirski, Robin Rosenberg
In-Reply-To: <20080711042822.GC32633@spearce.org>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/jgit/lib/Repository.java       |   39 ++++++++++++++++++--
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 52f6750..af860b3 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -95,6 +95,7 @@ public class Repository {
 	private GitIndex index;
 
 	private List<RepositoryListener> listeners = new Vector<RepositoryListener>(); // thread safe
+	static private List<RepositoryListener> allListeners = new Vector<RepositoryListener>(); // thread safe
 
 	/**
 	 * Construct a representation of a Git repository.
@@ -1051,12 +1052,36 @@ public class Repository {
 		listeners.remove(l);
 	}
 
+	/**
+	 * Register a global {@link RepositoryListener} which will be notified
+	 * when a ref changes in any repository are detected.
+	 *
+	 * @param l
+	 */
+	public static void addAnyRepositoryChangedListener(final RepositoryListener l) {
+		allListeners.add(l);
+	}
+
+	/**
+	 * Remove a globally registered {@link RepositoryListener}
+	 * @param l
+	 */
+	public static void removeAnyRepositoryChangedListener(final RepositoryListener l) {
+		allListeners.remove(l);
+	}
+
 	void fireRefsMaybeChanged() {
 		if (refs.lastRefModification != refs.lastNotifiedRefModification) {
 			refs.lastNotifiedRefModification = refs.lastRefModification;
 			final RefsChangedEvent event = new RefsChangedEvent(this);
-			for (final RepositoryListener l :
-				listeners.toArray(new RepositoryListener[0])) {
+			List<RepositoryListener> all;
+			synchronized (listeners) {
+				all = new ArrayList<RepositoryListener>(listeners);
+			}
+			synchronized (allListeners) {
+				all.addAll(allListeners);
+			}
+			for (final RepositoryListener l : all) {
 				l.refsChanged(event);
 			}
 		}
@@ -1064,8 +1089,14 @@ public class Repository {
 
 	void fireIndexChanged() {
 		final IndexChangedEvent event = new IndexChangedEvent(this);
-		for (final RepositoryListener l :
-			listeners.toArray(new RepositoryListener[0])) {
+		List<RepositoryListener> all;
+		synchronized (listeners) {
+			all = new ArrayList<RepositoryListener>(listeners);
+		}
+		synchronized (allListeners) {
+			all.addAll(allListeners);
+		}
+		for (final RepositoryListener l : all) {
 			l.indexChanged(event);
 		}
 	}
-- 
1.5.6.2.220.g44701

^ permalink raw reply related

* [PATCH 7/7] Add a job to refresh projects when the index changes.
From: Robin Rosenberg @ 2008-07-11  9:32 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Marek Zawirski, Robin Rosenberg
In-Reply-To: <20080711043317.GD32633@spearce.org>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/egit/ui/Activator.java         |   85 +++++++++++++++++++-
 1 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
index 3e02c44..89e6579 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
@@ -11,16 +11,20 @@ package org.spearce.egit.ui;
 import java.net.Authenticator;
 import java.net.ProxySelector;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.eclipse.core.net.proxy.IProxyService;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.ISchedulingRule;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jsch.core.IJSchService;
@@ -30,7 +34,10 @@ import org.eclipse.ui.themes.ITheme;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.spearce.egit.core.project.RepositoryMapping;
+import org.spearce.jgit.lib.IndexChangedEvent;
+import org.spearce.jgit.lib.RefsChangedEvent;
 import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.RepositoryListener;
 import org.spearce.jgit.transport.SshSessionFactory;
 
 /**
@@ -137,6 +144,7 @@ public class Activator extends AbstractUIPlugin {
 
 	private boolean traceVerbose;
 	private RCS rcs;
+	private RIRefresh refreshJob;
 
 	/**
 	 * Constructor for the egit ui plugin singleton
@@ -151,6 +159,71 @@ public class Activator extends AbstractUIPlugin {
 		setupSSH(context);
 		setupProxy(context);
 		setupRepoChangeScanner();
+		setupRepoIndexRefresh();
+	}
+
+	private void setupRepoIndexRefresh() {
+		refreshJob = new RIRefresh();
+		Repository.addAnyRepositoryChangedListener(refreshJob);
+	}
+
+	static class RIRefresh extends Job implements RepositoryListener {
+
+		RIRefresh() {
+			super("Git index refresh Job");
+		}
+
+		private Set<IProject> projectsToScan = new LinkedHashSet<IProject>();
+
+		@Override
+		protected IStatus run(IProgressMonitor monitor) {
+			IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+			monitor.beginTask("Refreshing git managed projects", projects.length);
+
+			while (projectsToScan.size() > 0) {
+				IProject p;
+				synchronized (projectsToScan) {
+					if (projectsToScan.size() == 0)
+						break;
+					Iterator<IProject> i = projectsToScan.iterator();
+					p = i.next();
+					i.remove();
+				}
+				ISchedulingRule rule = p.getWorkspace().getRuleFactory().refreshRule(p);
+				try {
+					getJobManager().beginRule(rule, monitor);
+					p.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
+				} catch (CoreException e) {
+					logError("Failed to refresh projects from index changes", e);
+					return new Status(IStatus.ERROR, getPluginId(), e.getMessage());
+				} finally {
+					getJobManager().endRule(rule);
+				}
+			}
+			monitor.done();
+			return Status.OK_STATUS;
+		}
+
+		public void indexChanged(IndexChangedEvent e) {
+			IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+			Set<IProject> toRefresh= new HashSet<IProject>();
+			for (IProject p : projects) {
+				RepositoryMapping mapping = RepositoryMapping.getMapping(p);
+				if (mapping != null && mapping.getRepository() == e.getRepository()) {
+					toRefresh.add(p);
+				}
+			}
+			synchronized (projectsToScan) {
+				projectsToScan.addAll(toRefresh);
+			}
+			if (projectsToScan.size() > 0)
+				schedule();
+		}
+
+		public void refsChanged(RefsChangedEvent e) {
+			// Do not react here
+		}
+
 	}
 
 	static class RCS extends Job {
@@ -236,10 +309,14 @@ public class Activator extends AbstractUIPlugin {
 
 	public void stop(final BundleContext context) throws Exception {
 		trace("Trying to cancel " + rcs.getName() + " job");
-		if (!rcs.cancel()) {
-			rcs.join();
-		}
-		trace("rcs.getName() " + rcs.getName() + " cancelled ok");
+		rcs.cancel();
+		trace("Trying to cancel " + refreshJob.getName() + " job");
+		refreshJob.cancel();
+
+		rcs.join();
+		refreshJob.join();
+
+		trace("Jobs terminated");
 		super.stop(context);
 		plugin = null;
 	}
-- 
1.5.6.2.220.g44701

^ permalink raw reply related

* Re: [PATCH 0/3] Git::Repo API and gitweb caching
From: Jakub Narebski @ 2008-07-11  9:33 UTC (permalink / raw)
  To: Lea Wiemann; +Cc: Git Mailing List, John Hawley, Petr Baudis
In-Reply-To: <4876B223.4070707@gmail.com>

On Fri, 11 July 2008, Lea Wiemann wrote:

> As follow-ups to this message, I'll be sending three patches for
> 
> 1) adding the Mechanize tests,

Somehow I didn't get Cc-ed this patch...

> The Mechanize tests succeed before and after patch (3) is applied, so
> I'm reasonably confident that my refactoring didn't introduce any
> (major) bugs.

If I remember correctly Mechanize tests detected some bugs in gitweb
(nice!), but there were swept under the rug, i.e. put as TODO.

Does that mean that those errors were corrected, or that refactoring
"just" didn't break anything more?

> On my to-do list:
> 
> - Benchmarks.  I'm planning to time a replay of kernel.org's gitweb logs
> on the test server, with and without caching.  Nothing fancy.  (The
> performance of the test setup on odin3.kernel.org is not representative
> of gitweb's actual performance under load.)

Do you plan to compare other gitweb caching implementations? I mean
here old kernel.org caching by J.H., and repo.or.cz caching (only for
projects list page) by Pasky.

> - Implement support for Last-Modified or ETags, since those basically
> fall out for free with the current implementation.  (This will require
> mod_perl, since CGI doesn't allow for accessing arbitrary request
> headers AFAIK.)

>From CGI(3pm):

       http()
           Called with no arguments returns the list of HTTP environment vari-
           ables, including such things as HTTP_USER_AGENT, HTTP_ACCEPT_LANGUAGE,
           and HTTP_ACCEPT_CHARSET, corresponding to the like-named HTTP header
           fields in the request.  Called with the name of an HTTP header field,
           returns its value.  Capitalization and the use of hyphens versus under-
           scores are not significant.

           For example, all three of these examples are equivalent:

              $requested_language = http('Accept-language');
              $requested_language = http('Accept_language');
              $requested_language = http('HTTP_ACCEPT_LANGUAGE');


>From http://hoohoo.ncsa.uiuc.edu/cgi/env.html

  In addition to these, the header lines received from the client, if
  any, are placed into the environment with the prefix HTTP_ followed
  by the header name. Any '-' characters in the header name are changed
  to '_' characters. The server may exclude any headers which it has
  already processed, such as Authorization, Content-type, and
  Content-length. If necessary, the server may choose to exclude any
  or all of these headers if including them would exceed any system
  environment limits.

So you _can_ access 'If-Modified-Since', 'If-None-Match' (by web browsers)
and 'If-Not-Modified-Since', 'If-Match' (by caches) from CGI.

> That will make the site a tad more responsive, I hope,
> and it will also hugely reduce the load for RSS/Atom requests, which
> currently make up almost half of all requests to kernel.org's gitweb and
> get served in full each time (i.e. "200 OK" instead of "304 Not Modified").

Currently only one "shortcut" is that gitweb respects HEAD request
(returning only HTTP headers) for feeds, and if I remember correctly
only for feeds.  I don't know however how much work gitweb does before
HEAD request shortcut.

> - Make gitweb use more parts of the Git::Repo API; in particular, the
> commit and tag parsing code should be ripped out, and gitweb should use
> the (much prettier) Git::Commit/Git::Tag API instead.  Perhaps some more
> functions (like ls_tree) can be generalized into the API as well; I went
> the easy route for now and simply replaced most "open '-|'" calls with
> $repo->cmd_output calls.

I think that ls_tree and git-ls-tree output parsing should be
generalized into Git::Tree API as well.


I'll try to review the rest of patches by tomorrow...
-- 
Jakub Narebski
Poland

^ permalink raw reply

* [PATCH] Create a listener structure for changes to refs and index
From: Robin Rosenberg @ 2008-07-11  9:27 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git, Marek Zawirski, Robin Rosenberg
In-Reply-To: <20080711042251.GB32633@spearce.org>

This version does not tell you which refs have changed, nor
what changes have happened. There is not scanning for externally
initiated changes either, though such changes can be found when
a JGit client wants to read index or refs information.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../egit/ui/internal/history/GitHistoryPage.java   |   31 +++++++++-
 .../src/org/spearce/jgit/lib/GitIndex.java         |    3 +
 .../org/spearce/jgit/lib/IndexChangedEvent.java    |   55 +++++++++++++++++
 .../src/org/spearce/jgit/lib/RefDatabase.java      |   19 ++++++
 .../src/org/spearce/jgit/lib/RefsChangedEvent.java |   55 +++++++++++++++++
 .../src/org/spearce/jgit/lib/Repository.java       |   41 +++++++++++++
 .../org/spearce/jgit/lib/RepositoryAdapter.java    |   54 ++++++++++++++++
 .../spearce/jgit/lib/RepositoryChangedEvent.java   |   64 ++++++++++++++++++++
 .../org/spearce/jgit/lib/RepositoryListener.java   |   63 +++++++++++++++++++
 9 files changed, 384 insertions(+), 1 deletions(-)
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/IndexChangedEvent.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/RefsChangedEvent.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryAdapter.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryChangedEvent.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryListener.java

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
index 6b55185..7e2f726 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java
@@ -61,7 +61,10 @@ import org.spearce.egit.ui.UIIcons;
 import org.spearce.egit.ui.UIPreferences;
 import org.spearce.egit.ui.UIText;
 import org.spearce.jgit.lib.AnyObjectId;
+import org.spearce.jgit.lib.IndexChangedEvent;
+import org.spearce.jgit.lib.RefsChangedEvent;
 import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.RepositoryListener;
 import org.spearce.jgit.revplot.PlotCommit;
 import org.spearce.jgit.revwalk.RevCommit;
 import org.spearce.jgit.revwalk.RevFlag;
@@ -73,7 +76,7 @@ import org.spearce.jgit.treewalk.filter.PathFilterGroup;
 import org.spearce.jgit.treewalk.filter.TreeFilter;
 
 /** Graphical commit history viewer. */
-public class GitHistoryPage extends HistoryPage {
+public class GitHistoryPage extends HistoryPage implements RepositoryListener {
 	private static final String PREF_COMMENT_WRAP = UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_WRAP;
 
 	private static final String PREF_COMMENT_FILL = UIPreferences.RESOURCEHISTORY_SHOW_COMMENT_FILL;
@@ -230,6 +233,32 @@ public class GitHistoryPage extends HistoryPage {
 		layout();
 	}
 
+	private Runnable refschangedRunnable;
+
+	public void refsChanged(final RefsChangedEvent e) {
+		if (getControl().isDisposed())
+			return;
+
+		synchronized (this) {
+			if (refschangedRunnable == null) {
+				refschangedRunnable = new Runnable() {
+					public void run() {
+						if (!getControl().isDisposed()) {
+							Activator.trace("Executing async repository changed event");
+							refschangedRunnable = null;
+							inputSet();
+						}
+					}
+				};
+				getControl().getDisplay().asyncExec(refschangedRunnable);
+			}
+		}
+	}
+
+	public void indexChanged(final IndexChangedEvent e) {
+		// We do not use index information here now
+	}
+
 	private void finishContextMenu() {
 		popupMgr.add(new Separator());
 		popupMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
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 5be404e..c7a4402 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
@@ -146,6 +146,7 @@ public class GitIndex {
 	public void rereadIfNecessary() throws IOException {
 		if (cacheFile.exists() && cacheFile.lastModified() != lastCacheTime) {
 			read();
+			db.fireIndexChanged();
 		}
 	}
 
@@ -269,6 +270,8 @@ public class GitIndex {
 						"Could not rename temporary index file to index");
 			changed = false;
 			statDirty = false;
+			lastCacheTime = cacheFile.lastModified();
+			db.fireIndexChanged();
 		} finally {
 			if (!lock.delete())
 				throw new IOException(
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/IndexChangedEvent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexChangedEvent.java
new file mode 100644
index 0000000..30a40d1
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexChangedEvent.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.lib;
+
+/**
+ * This class passes information about a changed Git index to a
+ * {@link RepositoryListener}
+ *
+ * Currently only a reference to the repository is passed.
+ */
+public class IndexChangedEvent extends RepositoryChangedEvent {
+	IndexChangedEvent(final Repository repository) {
+		super(repository);
+	}
+
+	@Override
+	public String toString() {
+		return "IndexChangedEvent[" + getRepository() + "]";
+	}
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
index 9e3e020..ebfa7f5 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
@@ -81,6 +81,12 @@ class RefDatabase {
 
 	private long packedRefsLength;
 
+	long lastRefModification;
+
+	long lastNotifiedRefModification;
+
+	static int refModificationCounter;
+
 	RefDatabase(final Repository r) {
 		db = r;
 		gitDir = db.getDirectory();
@@ -132,6 +138,8 @@ class RefDatabase {
 
 	void stored(final String name, final ObjectId id, final long time) {
 		looseRefs.put(name, new CachedRef(Ref.Storage.LOOSE, name, id, time));
+		setModified();
+		db.fireRefsMaybeChanged();
 	}
 
 	/**
@@ -155,6 +163,12 @@ class RefDatabase {
 		}
 		if (!lck.commit())
 			throw new ObjectWritingException("Unable to write " + name);
+		setModified();
+		db.fireRefsMaybeChanged();
+	}
+
+	void setModified() {
+		lastRefModification = refModificationCounter++;
 	}
 
 	Ref readRef(final String partialName) throws IOException {
@@ -192,6 +206,7 @@ class RefDatabase {
 		readPackedRefs(avail);
 		readLooseRefs(avail, REFS_SLASH, refsDir);
 		readOneLooseRef(avail, Constants.HEAD, new File(gitDir, Constants.HEAD));
+		db.fireRefsMaybeChanged();
 		return avail;
 	}
 
@@ -321,6 +336,8 @@ class RefDatabase {
 			return r != null ? r : new Ref(Ref.Storage.LOOSE, target, null);
 		}
 
+		setModified();
+
 		final ObjectId id;
 		try {
 			id = ObjectId.fromString(line);
@@ -378,6 +395,7 @@ class RefDatabase {
 			packedRefsLastModified = currTime;
 			packedRefsLength = currLen;
 			packedRefs = newPackedRefs;
+			setModified();
 		} catch (FileNotFoundException noPackedRefs) {
 			// Ignore it and leave the new map empty.
 			//
@@ -414,4 +432,5 @@ class RefDatabase {
 			lastModified = mtime;
 		}
 	}
+
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefsChangedEvent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefsChangedEvent.java
new file mode 100644
index 0000000..c8936c7
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefsChangedEvent.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.lib;
+
+/**
+ * This class passes information about a changed Git index to a
+ * {@link RepositoryListener}
+ *
+ * Currently only a reference to the repository is passed.
+ */
+public class RefsChangedEvent extends RepositoryChangedEvent {
+	RefsChangedEvent(final Repository repository) {
+		super(repository);
+	}
+
+	@Override
+	public String toString() {
+		return "RefsChangedEvent[" + getRepository() + "]";
+	}
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index 04d9b13..6f78652 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -49,7 +49,9 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
 import org.spearce.jgit.errors.IncorrectObjectTypeException;
 import org.spearce.jgit.errors.RevisionSyntaxException;
@@ -92,6 +94,8 @@ public class Repository {
 
 	private GitIndex index;
 
+	private List<RepositoryListener> listeners = new Vector<RepositoryListener>(); // thread safe
+
 	/**
 	 * Construct a representation of a Git repository.
 	 * 
@@ -1028,4 +1032,41 @@ public class Repository {
 	public File getWorkDir() {
 		return getDirectory().getParentFile();
 	}
+
+	/**
+	 * Register a {@link RepositoryListener} which will be notified
+	 * when ref changes are detected.
+	 *
+	 * @param l
+	 */
+	public void addRepositoryChangedListener(final RepositoryListener l) {
+		listeners.add(l);
+	}
+
+	/**
+	 * Remove a registered {@link RepositoryListener}
+	 * @param l
+	 */
+	public void removeRepositoryChangedListener(final RepositoryListener l) {
+		listeners.remove(l);
+	}
+
+	void fireRefsMaybeChanged() {
+		if (refs.lastRefModification != refs.lastNotifiedRefModification) {
+			refs.lastNotifiedRefModification = refs.lastRefModification;
+			final RefsChangedEvent event = new RefsChangedEvent(this);
+			for (final RepositoryListener l :
+				listeners.toArray(new RepositoryListener[listeners.size()])) {
+				l.refsChanged(event);
+			}
+		}
+	}
+
+	void fireIndexChanged() {
+		final IndexChangedEvent event = new IndexChangedEvent(this);
+		for (final RepositoryListener l :
+			listeners.toArray(new RepositoryListener[listeners.size()])) {
+			l.indexChanged(event);
+		}
+	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryAdapter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryAdapter.java
new file mode 100644
index 0000000..d1ff07d
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryAdapter.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.lib;
+
+/**
+ * A default {@link RepositoryListener} that does nothing except invoke an
+ * optional general method for any repository change.
+ */
+public class RepositoryAdapter implements RepositoryListener {
+
+	public void indexChanged(final IndexChangedEvent e) {
+		// Empty
+	}
+
+	public void refsChanged(final RefsChangedEvent e) {
+		// Empty
+	}
+
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryChangedEvent.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryChangedEvent.java
new file mode 100644
index 0000000..b58df87
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryChangedEvent.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.lib;
+
+/**
+ * This class passes information about changed refs to a
+ * {@link RepositoryListener}
+ *
+ * Currently only a reference to the repository is passed.
+ */
+public class RepositoryChangedEvent {
+	private final Repository repository;
+
+	RepositoryChangedEvent(final Repository repository) {
+		this.repository = repository;
+	}
+
+	/**
+	 * @return the repository that was changed
+	 */
+	public Repository getRepository() {
+		return repository;
+	}
+
+	@Override
+	public String toString() {
+		return "RepositoryChangedEvent[" + repository + "]";
+	}
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryListener.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryListener.java
new file mode 100644
index 0000000..ceb14ce
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryListener.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.lib;
+
+/**
+ * A RepositoryListener gets notification about changes in refs or repository.
+ * <p>
+ * It currently does <em>not</em> get notification about which items are
+ * changed.
+ */
+public interface RepositoryListener {
+	/**
+	 * Invoked when a ref changes
+	 *
+	 * @param e
+	 *            information about the changes.
+	 */
+	void refsChanged(RefsChangedEvent e);
+
+	/**
+	 * Invoked when the index changes
+	 *
+	 * @param e
+	 *            information about the changes.
+	 */
+	void indexChanged(IndexChangedEvent e);
+
+}
-- 
1.5.6.2.220.g44701

^ permalink raw reply related

* Re: [PATCH 1/2] help.c: Add support for htmldir relative to git_exec_path()
From: Johannes Sixt @ 2008-07-11  9:02 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: Junio C Hamano, Git Mailing List, Johannes Schindelin
In-Reply-To: <4668B2FF-2B2B-4221-8151-F0AEA681983C@zib.de>

Zitat von Steffen Prohaska <prohaska@zib.de>:
>
> On Jul 4, 2008, at 2:35 PM, Johannes Schindelin wrote:
>
> > On Fri, 4 Jul 2008, Junio C Hamano wrote:
> >
> >> Could you check if there are copy-and-pasted duplicated code you can
> >> factor out before continuing this direction?
> >
> > Note also that Hannes tried very hard to get rid of those ugly "#ifdef
> > __MINGW32__"s by declaring/overriding functions in git-compat-util.h.
> >
> > I think that is such a good practice that we should not stop here.
>
> I'll send three patches that address Junio's and Dscho's comments:
>
>   [PATCH 1/3] Move code interpreting path relative to exec-dir to new
> function system_path()
>   [PATCH 2/3] help.c: Add support for htmldir relative to
> git_exec_path()
>   [PATCH 3/3] help (Windows): Display HTML in default browser using
> Windows' shell API
>
>
> Hannes,
> the patches I'll send probably conflict with your planned work on
> GIT_EXEC_PATH that has been discussed on the msysgit list.  I think
> you could built on my series and modify system_path().

Thanks. I haven't done a lot in that direction, yet, so your patches will be
helpful.

But according to the conclusion of our recent discussion

http://thread.gmane.org/gmane.comp.version-control.msysgit/2633/focus=2669

I shall modify system_path() to construct paths relative to the git executable,
which is essentially Makefile's $(bindir), not git_exec_path().

-- Hannes

^ permalink raw reply

* Re: Ext4 patchqueue corrupted ?
From: Petr Baudis @ 2008-07-11  8:47 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: Theodore Tso, Ming Ming Cao, linux-ext4@vger.kernel.org, git
In-Reply-To: <20080711034606.GA779@skywalker>

  Hi,

On Fri, Jul 11, 2008 at 09:16:06AM +0530, Aneesh Kumar K.V wrote:
> [master@ext4-patch-queue]$ git pull
> warning: no common commits
> remote: Total 0 (delta 0), reused 0 (delta 0)
> error: unable to find ec90e41198ede71d186bb7075e2edea7a6daae5a
> fatal: object ec90e41198ede71d186bb7075e2edea7a6daae5a not found
> 
> kvaneesh@skywalker:/tmp$git clone git://repo.or.cz/ext4-patch-queue.git
> Initialized empty Git repository in /tmp/ext4-patch-queue/.git/
> remote: Total 0 (delta 0), reused 0 (delta 0)
> remote: aborting due to possible repository corruption on the remote side.
> error: waitpid (async) failed
> fatal: error in sideband demultiplexer
> 
> The web interface doesn't list any commits.

  very puzzling; I have backed up the broken objects store, can you
repush, please? I'm curious about how this could have happenned;
repo.or.cz now uses Git from latest next, which is a rather strange
coincidence. ;-) Or did any of the pushers do anything special about
pushin to the repository recently?

  Huge amount of objects is missing, the repository has only few loose
objects and

-rw-rw-r-- 1 repo 65657 1408 2008-07-10 18:56 pack-503b8e3e6f3a650c8bc37df88e8a9d7b6193c900.idx
-rw-rw-r-- 1 repo 65657 3364 2008-07-10 18:56 pack-503b8e3e6f3a650c8bc37df88e8a9d7b6193c900.pack

  (By the way, how do I list objects in a pack again? I keep forgetting
the trick...)

-- 
				Petr "Pasky" Baudis
The last good thing written in C++ was the Pachelbel Canon. -- J. Olson

^ permalink raw reply

* Re: [JGIT PATCH 1/1] jgit: create a tag command
From: Mike Ralphson @ 2008-07-11  8:45 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Robin Rosenberg, Marek Zawirski, git
In-Reply-To: <20080711020507.GD31862@spearce.org>

2008/7/11 Shawn O. Pearce <spearce@spearce.org>:
> Mike Ralphson <mike.ralphson@gmail.com> wrote:
>>
>> Loving the make_jgit stuff.
>
> So making jgit a single stand-alone, portable shell script for
> command line usage was a good idea?  ;-)

It certainly seems so to me. It's a nice quick way of seeing what's
implemented (I was toying with adding a jgit help command which would
reflect over the TextBuiltins).

I'm not sure which if any platforms would eventually be better off
with a commandline jgit than trying to port c-git though.

> I think we are at the point where we need to either write a
> #@!*(!@(! command line option parser, import one, or stop writing
> command line programs.  I would certainly appreciate any opinion
> you might have on the matter.

a) is a distraction, c) is a backwards step, so maybe b) wins.

I don't know what the state of the art of Java option parsers is but
there is a port of GNU getopt [1] which might drop in quite easily.

Mike

PS apologies for the patch format, I'm stuck with Outlook or gmail,
and a recalcitrant firewall for the moment.

[1] http://www.urbanophile.com/arenn/hacking/download.html

^ permalink raw reply

* Re: [JGIT PATCH 2/5] Don't display passwords on the console in fetch/push output
From: Robin Rosenberg @ 2008-07-11  8:30 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Marek Zawirski, git
In-Reply-To: <20080711032004.GC32319@spearce.org>

fredagen den 11 juli 2008 05.20.04 skrev Shawn O. Pearce:
> +	public String toPrivateString() {
> +		return format(true);
> +	}
etc

Yes, that's much better. 

-- robin

^ permalink raw reply

* Re: [JGIT PATCH 1/1] jgit: create a tag command
From: Robin Rosenberg @ 2008-07-11  8:28 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Mike Ralphson, Marek Zawirski, git
In-Reply-To: <20080711020507.GD31862@spearce.org>

fredagen den 11 juli 2008 04.05.07 skrev Shawn O. Pearce:
> Mike Ralphson <mike.ralphson@gmail.com> wrote:
> > 
> > Loving the make_jgit stuff.
> 
> So making jgit a single stand-alone, portable shell script for
> command line usage was a good idea?  ;-)
> 
> I think we are at the point where we need to either write a
> #@!*(!@(! command line option parser, import one, or stop writing
> command line programs.  I would certainly appreciate any opinion
> you might have on the matter.

I've come to that conclusion too, but not yet to the code :)

-- robin

^ permalink raw reply

* Should we discuss Windows-related changes on git@vger.kernel.org?
From: Steffen Prohaska @ 2008-07-11  8:07 UTC (permalink / raw)
  To: Johannes Sixt, Junio C Hamano
  Cc: msysGit, Git Mailing List, Johannes Schindelin


I decided to stop queuing changes in 4msysgit.  Instead I'd like to
bring the diff between Junio's and 4msysgit's master to zero.  This
seems to be achievable after Junio merged Hannes' MinGW changes.

I think all Windows-related changes to the git code base could be
discussed directly on the main git list and the msysgit list would be
reserved for the MinGW/MSYS runtime environment and the installer.  I do
not expect that Windows-related changes would add too much traffic to
the list.  But, even though we have mechanisms to separate the
platform-specific code from the main code base (like git-compat-util.h),
the Windows-related changes eventually need to be integrated with the
mainline, so it might make sense to discuss them on the main list right
away.

What do you think?

         Steffen

^ permalink raw reply

* Re: THREADED_DELTA_SEARCH
From: Pierre Habouzit @ 2008-07-11  7:41 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Nicolas Pitre, Johannes Schindelin, Junio C Hamano, Git ML
In-Reply-To: <81b0412b0807102259q1046051bwc513eadb50847675@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

On Fri, Jul 11, 2008 at 05:59:56AM +0000, Alex Riesen wrote:
> 2008/7/11 Nicolas Pitre <nico@cam.org>:
> > Furthermore, the number of threads is, by default, equivalent to the
> > number of detected CPUs.  So if you have a 8-CPU machine, I sure hope
> > you have the RAM configuration that goes along with such a system.
> 
> ....and while the threads limit is implemented, the global memory limit is not
> (well, frankly, I just don't know. Maybe it is there, and I can't find it).

  You mean --window-memory= ?

  I agree this feature should be opt-in. Linux, FreeBSD and Solaris
should probably do fine I assume ? I'm quite sure the two first will do,
I really know the latter less though.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* [PATCH 3/3 FIXED] help (Windows): Display HTML in default browser using Windows' shell API
From: Steffen Prohaska @ 2008-07-11  7:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin, Johannes Sixt, Steffen Prohaska
In-Reply-To: <228FC26D-D318-487A-9BF3-B473096CB0C9@zib.de>

The system's default browser for displaying HTML help pages is now used
directly on Windows, instead of launching git-web--browser, which
requires a Unix shell.  Avoiding MSYS' bash when possible is good
because it avoids potential path translation issues.  In this case it is
not too hard to avoid launching a shell, so let's avoid it.

The Windows-specific code is implemented in compat/mingw.c to avoid
platform-specific code in the main code base.  On Windows, open_html is
provided as a define.  If open_html is not defined, git-web--browse is
used.  This approach avoids platform-specific ifdefs by using
per-function ifdefs.  The "ifndef open_html" together with the
introductory comment should sufficiently warn developers, so that they
hopefully will not break this mechanism.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 compat/mingw.c |   21 +++++++++++++++++++++
 compat/mingw.h |    3 +++
 help.c         |   14 +++++++++++++-
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 3a05fe7..0ca73f7 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1017,3 +1017,24 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 	timer_fn = handler;
 	return old;
 }
+
+static const char *make_backslash_path(const char *path) {
+	static char buf[PATH_MAX + 1];
+	char *c;
+
+	if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
+		die ("Too long path: %.*s", 60, path);
+
+	for (c = buf; *c; c++) {
+		if (*c == '/')
+			*c = '\\';
+	}
+	return buf;
+}
+
+void mingw_open_html(const char *unixpath)
+{
+	const char *htmlpath = make_backslash_path(unixpath);
+	printf("Launching default browser to display HTML ...\n");
+	ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
+}
diff --git a/compat/mingw.h b/compat/mingw.h
index 6bc049a..136361e 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -193,6 +193,9 @@ static inline unsigned int git_ntohl(unsigned int x)
 sig_handler_t mingw_signal(int sig, sig_handler_t handler);
 #define signal mingw_signal
 
+void mingw_open_html(const char *path);
+#define open_html mingw_open_html
+
 /*
  * git specific compatibility
  */
diff --git a/help.c b/help.c
index 0f055bf..52d39b8 100644
--- a/help.c
+++ b/help.c
@@ -644,6 +644,18 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
 	strbuf_addf(page_path, "%s/%s.html", html_path, page);
 }
 
+/*
+ * If open_html is not defined in a platform-specific way (see for
+ * example compat/mingw.h), we use the script web--browse to display
+ * HTML.
+ */
+#ifndef open_html
+void open_html(const char *path)
+{
+	execl_git_cmd("web--browse", "-c", "help.browser", path, NULL);
+}
+#endif
+
 static void show_html_page(const char *git_cmd)
 {
 	const char *page = cmd_to_page(git_cmd);
@@ -651,7 +663,7 @@ static void show_html_page(const char *git_cmd)
 
 	get_html_page_path(&page_path, page);
 
-	execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL);
+	open_html(page_path.buf);
 }
 
 void help_unknown_cmd(const char *cmd)
-- 
1.5.6.1.282.gd8a0d

^ permalink raw reply related

* Re: [PATCH 3/3] help (Windows): Display HTML in default browser using Windows' shell API
From: Steffen Prohaska @ 2008-07-11  7:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, Git Mailing List, Johannes Schindelin
In-Reply-To: <1215761286-2489-3-git-send-email-prohaska@zib.de>


On Jul 11, 2008, at 9:28 AM, Steffen Prohaska wrote:

> +
> +static const char *make_backslash_path(const char* path) {
> +	static char buf[PATH_MAX + 1];
> +	char* c;

Style :-(.  I'll send a fixed patch in a minute.


> +#ifndef open_html
> +void open_html(const char* path)
> +{

It'll fix this too.

	Steffen

^ permalink raw reply

* [PATCH 2/3] help.c: Add support for htmldir relative to git_exec_path()
From: Steffen Prohaska @ 2008-07-11  7:28 UTC (permalink / raw)
  To: Junio C Hamano, Johannes Sixt; +Cc: git, Johannes Schindelin, Steffen Prohaska
In-Reply-To: <1215761286-2489-1-git-send-email-prohaska@zib.de>

If htmldir (in the Makefile) is a relative path, this path will now be
interpreted relative to git_exec_path.  This can be used to create an
installation that can be moved to a different directory without
re-compiling.  The Windows installer (msysgit) is an example for such
a setup.

Note that the Makefile maps htmldir to the define GIT_HTML_PATH.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 help.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/help.c b/help.c
index ca9632b..0f055bf 100644
--- a/help.c
+++ b/help.c
@@ -633,13 +633,15 @@ static void show_info_page(const char *git_cmd)
 static void get_html_page_path(struct strbuf *page_path, const char *page)
 {
 	struct stat st;
+	const char *html_path = system_path(GIT_HTML_PATH);
 
 	/* Check that we have a git documentation directory. */
-	if (stat(GIT_HTML_PATH "/git.html", &st) || !S_ISREG(st.st_mode))
-		die("'%s': not a documentation directory.", GIT_HTML_PATH);
+	if (stat(mkpath("%s/git.html", html_path), &st)
+	    || !S_ISREG(st.st_mode))
+		die("'%s': not a documentation directory.", html_path);
 
 	strbuf_init(page_path, 0);
-	strbuf_addf(page_path, GIT_HTML_PATH "/%s.html", page);
+	strbuf_addf(page_path, "%s/%s.html", html_path, page);
 }
 
 static void show_html_page(const char *git_cmd)
-- 
1.5.6.1.282.gd8a0d

^ permalink raw reply related

* [PATCH 3/3] help (Windows): Display HTML in default browser using Windows' shell API
From: Steffen Prohaska @ 2008-07-11  7:28 UTC (permalink / raw)
  To: Junio C Hamano, Johannes Sixt; +Cc: git, Johannes Schindelin, Steffen Prohaska
In-Reply-To: <1215761286-2489-2-git-send-email-prohaska@zib.de>

The system's default browser for displaying HTML help pages is now used
directly on Windows, instead of launching git-web--browser, which
requires a Unix shell.  Avoiding MSYS' bash when possible is good
because it avoids potential path translation issues.  In this case it is
not too hard to avoid launching a shell, so let's avoid it.

The Windows-specific code is implemented in compat/mingw.c to avoid
platform-specific code in the main code base.  On Windows, open_html is
provided as a define.  If open_html is not defined, git-web--browse is
used.  This approach avoids platform-specific ifdefs by using
per-function ifdefs.  The "ifndef open_html" together with the
introductory comment should sufficiently warn developers, so that they
hopefully will not break this mechanism.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 compat/mingw.c |   21 +++++++++++++++++++++
 compat/mingw.h |    3 +++
 help.c         |   14 +++++++++++++-
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 3a05fe7..f7ef545 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1017,3 +1017,24 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 	timer_fn = handler;
 	return old;
 }
+
+static const char *make_backslash_path(const char* path) {
+	static char buf[PATH_MAX + 1];
+	char* c;
+
+	if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
+		die ("Too long path: %.*s", 60, path);
+
+	for (c = buf; *c; c++) {
+		if (*c == '/')
+			*c = '\\';
+	}
+	return buf;
+}
+
+void mingw_open_html(const char *unixpath)
+{
+	const char *htmlpath = make_backslash_path(unixpath);
+	printf("Launching default browser to display HTML ...\n");
+	ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
+}
diff --git a/compat/mingw.h b/compat/mingw.h
index 6bc049a..136361e 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -193,6 +193,9 @@ static inline unsigned int git_ntohl(unsigned int x)
 sig_handler_t mingw_signal(int sig, sig_handler_t handler);
 #define signal mingw_signal
 
+void mingw_open_html(const char *path);
+#define open_html mingw_open_html
+
 /*
  * git specific compatibility
  */
diff --git a/help.c b/help.c
index 0f055bf..18116f3 100644
--- a/help.c
+++ b/help.c
@@ -644,6 +644,18 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
 	strbuf_addf(page_path, "%s/%s.html", html_path, page);
 }
 
+/*
+ * If open_html is not defined in a platform-specific way (see for
+ * example compat/mingw.h), we use the script web--browse to display
+ * HTML.
+ */
+#ifndef open_html
+void open_html(const char* path)
+{
+	execl_git_cmd("web--browse", "-c", "help.browser", path, NULL);
+}
+#endif
+
 static void show_html_page(const char *git_cmd)
 {
 	const char *page = cmd_to_page(git_cmd);
@@ -651,7 +663,7 @@ static void show_html_page(const char *git_cmd)
 
 	get_html_page_path(&page_path, page);
 
-	execl_git_cmd("web--browse", "-c", "help.browser", page_path.buf, NULL);
+	open_html(page_path.buf);
 }
 
 void help_unknown_cmd(const char *cmd)
-- 
1.5.6.1.282.gd8a0d

^ permalink raw reply related

* [PATCH 1/3] Move code interpreting path relative to exec-dir to new function system_path()
From: Steffen Prohaska @ 2008-07-11  7:28 UTC (permalink / raw)
  To: Junio C Hamano, Johannes Sixt; +Cc: git, Johannes Schindelin, Steffen Prohaska
In-Reply-To: <4668B2FF-2B2B-4221-8151-F0AEA681983C@zib.de>

Expanding system paths relative to git_exec_path can be used for
creating an installation that can be moved to a different directory
without re-compiling.  We use this approach for template_dir and the
system wide gitconfig.  The Windows installer (msysgit) is an example
for such a setup.

This commit moves common code to a new function system_path().  System
paths that are to be interpreted relative to git_exec_path are passed to
system_path() and the return value is used instead of the original path.
system_path() prefixes a relative path with git_exec_path and leaves
absolute paths unmodified.  For example, we now write

    template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
 builtin-init-db.c |   14 ++------------
 cache.h           |    1 +
 config.c          |   11 ++---------
 path.c            |   11 +++++++++++
 4 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/builtin-init-db.c b/builtin-init-db.c
index e23b843..5ba213a 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -115,18 +115,8 @@ static void copy_templates(const char *template_dir)
 
 	if (!template_dir)
 		template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT);
-	if (!template_dir) {
-		/*
-		 * if the hard-coded template is relative, it is
-		 * interpreted relative to the exec_dir
-		 */
-		template_dir = DEFAULT_GIT_TEMPLATE_DIR;
-		if (!is_absolute_path(template_dir)) {
-			struct strbuf d = STRBUF_INIT;
-			strbuf_addf(&d, "%s/%s", git_exec_path(), template_dir);
-			template_dir = strbuf_detach(&d, NULL);
-		}
-	}
+	if (!template_dir)
+		template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
 	strcpy(template_path, template_dir);
 	template_len = strlen(template_path);
 	if (template_path[template_len-1] != '/') {
diff --git a/cache.h b/cache.h
index 0d8edda..dafa265 100644
--- a/cache.h
+++ b/cache.h
@@ -529,6 +529,7 @@ const char *make_nonrelative_path(const char *path);
 const char *make_relative_path(const char *abs, const char *base);
 int normalize_absolute_path(char *buf, const char *path);
 int longest_ancestor_length(const char *path, const char *prefix_list);
+extern const char *system_path(const char *path);
 
 /* Read and unpack a sha1 file into memory, write memory to a sha1 file */
 extern int sha1_object_info(const unsigned char *, unsigned long *);
diff --git a/config.c b/config.c
index 2862cc4..1e066c7 100644
--- a/config.c
+++ b/config.c
@@ -581,15 +581,8 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
 const char *git_etc_gitconfig(void)
 {
 	static const char *system_wide;
-	if (!system_wide) {
-		system_wide = ETC_GITCONFIG;
-		if (!is_absolute_path(system_wide)) {
-			/* interpret path relative to exec-dir */
-			struct strbuf d = STRBUF_INIT;
-			strbuf_addf(&d, "%s/%s", git_exec_path(), system_wide);
-			system_wide = strbuf_detach(&d, NULL);
-		}
-	}
+	if (!system_wide)
+		system_wide = system_path(ETC_GITCONFIG);
 	return system_wide;
 }
 
diff --git a/path.c b/path.c
index 5983255..141496e 100644
--- a/path.c
+++ b/path.c
@@ -11,6 +11,7 @@
  * which is what it's designed for.
  */
 #include "cache.h"
+#include "exec_cmd.h"
 
 static char bad_path[] = "/bad-path/";
 
@@ -439,3 +440,13 @@ int longest_ancestor_length(const char *path, const char *prefix_list)
 
 	return max_len;
 }
+
+const char *system_path(const char *path)
+{
+	if (!is_absolute_path(path)) {
+		struct strbuf d = STRBUF_INIT;
+		strbuf_addf(&d, "%s/%s", git_exec_path(), path);
+		path = strbuf_detach(&d, NULL);
+	}
+	return path;
+}
-- 
1.5.6.1.282.gd8a0d

^ permalink raw reply related

* Re: [PATCH 1/2] help.c: Add support for htmldir relative to git_exec_path()
From: Steffen Prohaska @ 2008-07-11  7:27 UTC (permalink / raw)
  To: Junio C Hamano, Johannes Sixt; +Cc: Git Mailing List, Johannes Schindelin
In-Reply-To: <alpine.DEB.1.00.0807041334010.9925@racer>


On Jul 4, 2008, at 2:35 PM, Johannes Schindelin wrote:

> On Fri, 4 Jul 2008, Junio C Hamano wrote:
>
>> Could you check if there are copy-and-pasted duplicated code you can
>> factor out before continuing this direction?
>
> Note also that Hannes tried very hard to get rid of those ugly "#ifdef
> __MINGW32__"s by declaring/overriding functions in git-compat-util.h.
>
> I think that is such a good practice that we should not stop here.

I'll send three patches that address Junio's and Dscho's comments:

  [PATCH 1/3] Move code interpreting path relative to exec-dir to new  
function system_path()
  [PATCH 2/3] help.c: Add support for htmldir relative to  
git_exec_path()
  [PATCH 3/3] help (Windows): Display HTML in default browser using  
Windows' shell API


Hannes,
the patches I'll send probably conflict with your planned work on
GIT_EXEC_PATH that has been discussed on the msysgit list.  I think
you could built on my series and modify system_path().

	Steffen

^ permalink raw reply

* Re: [PATCH] Added --export option to git-send-email.
From: Junio C Hamano @ 2008-07-11  7:03 UTC (permalink / raw)
  To: Eduard - Gabriel Munteanu; +Cc: ryan, git
In-Reply-To: <20080710170735.4c5b237a@linux360.ro>

Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> writes:

> This option allows the user to process patches with git-send-email and then
> import them into an email client, without having to send them directly. The
> output format is mbox.

Input format is also mbox, so an obvious question is "why?"

^ permalink raw reply

* Re: [PATCH] cherry: cache patch-ids to avoid repeating work
From: Junio C Hamano @ 2008-07-11  6:54 UTC (permalink / raw)
  To: Geoffrey Irving; +Cc: Johannes Schindelin, Junio C Hamano, git@vger.kernel.org
In-Reply-To: <7f9d599f0807100733s4435a9bga89749f2f6e10cf@mail.gmail.com>

"Geoffrey Irving" <irving@naml.us> writes:

>>> Oops: avoiding the infinite loop only requires reading expected O(1)
>>> entries on load, so I can fix that if you like.  It would only be all of
>>> them if it actually did detect the infinite loop.
>>
>> I have to admit that you lost me there.  AFAIR the patch-id cache is a
>> simple commit->patch_id store, right?  Then there should be no way to get
>> an infinite loop.
>
> If every entry is nonnull, find_helper loops forever.

Isn't it sufficient to make this part check the condition as well?

+	if (cache->count >= cache->size)
+	{
+		warning("%s is corrupt: count %"PRIu32" >= size %"PRIu32,
+			filename, cache->count, cache->size);
+		goto empty;
+	}

At runtime you keep the invariants that hashtable always has at most 3/4
full and whoever wrote the file you are reading must have honored that as
well, or there is something fishy going on.

>> Besides, this is a purely local cache, no?  Never to be transmitted...  So
>> not much chance of a malicious attack, except if you allow write access to
>> your local repository, in which case you are endangered no matter what.
>
> Yep, that's why it's only a hole in quotes, and why I didn't fix it.

You might want to protect yourself against file corruption, though.
Checksumming the whole file and checking it at opening defeats the point
of mmap'ed access, but at least the header may want to be checksummed?

^ permalink raw reply

* Re: [PATCH] bisect: test merge base if good rev is not an ancestor of bad rev
From: Junio C Hamano @ 2008-07-11  6:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Christian Couder, Michael Haggerty, Jeff King, git
In-Reply-To: <alpine.DEB.1.00.0807110155040.3279@eeepc-johanness>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Thu, 10 Jul 2008, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> 
> Of course it can be that the user commits a pilot error and says "but that 
> unrelated version was good", while the fork point(s) between good and bad 
> was bad (and this might be even the intention of the user, to find _one_ 
> commit that introduced the bug).
>
> Speaking of plural, what if some of the merge bases are good, some are 
> bad?
>
> Without carefully thinking it through, you might even _break_ the tool.

And you think it is better to make all of your _users_ think it through
every time?  Isn't it more error prone?

> All I was proposing is keeping the current semantics, keeping the 
> mechanism simple, and therefore reliable.

What I suggested to Christian (sorry, I've been busy and I still haven't
checked if that is what was implemented in the patch -- that is why I
suggested you to read the original thread) was:

	- check good and bad to see if they are forked

        - iff they are,

          - have the user check merge bases and make sure they are all
            good.  otherwise, the initial good/bad pair is unsuitable for
            bisection, so explain the situation and quit [*1*];

	  - otherwise, keep these good markers.

	- do the usual bisection --- from this point on it is "simple and
          reliable as it has always been".

And I do not think adding the "pre-check" stage before going into the main
part of the processing that we have always done is against "keeping the
mechanism simple and reliable".

[Footnote]

*1* We _could_ make things more complex by offering to swap good and bad
at this point and then continue bisecting to find a commit to cherry-pick
to forward port the fix.  Arguably, that step would be a new code and
could start out to be buggy --- it _could_ be called destabilizing what
has been reliable, but even then, it would be a separate codepath and a
new bug will be something that triggers only when the user accepts that
offer.  I do not see what the big deal is that you seem to be worried
about.

^ permalink raw reply


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