Git development
 help / color / mirror / Atom feed
* [EGIT PATCH 0/3] jgit glog alignment fixes
From: Robin Rosenberg @ 2008-10-01 19:31 UTC (permalink / raw)
  To: spearce; +Cc: git
In-Reply-To: <20081001143815.GV21310@spearce.org>

The series resent based upon review comments. Drop the unnecessary dispose
calls for system allocated colors (and thus all SWT related changed).

-- robin

^ permalink raw reply

* [EGIT PATCH 3/3] Align commit text properly in jgit glog
From: Robin Rosenberg @ 2008-10-01 19:31 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1222889493-12736-3-git-send-email-robin.rosenberg@dewire.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../org/spearce/jgit/awtui/AWTPlotRenderer.java    |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java b/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java
index dc785ec..b6b715c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java
@@ -109,10 +109,10 @@ protected void drawBoundaryDot(final int x, final int y, final int w,
 
 	@Override
 	protected void drawText(final String msg, final int x, final int y) {
-		final int texty = g.getFontMetrics().getHeight()
-				- g.getFontMetrics().getDescent();
+		final int texth = g.getFontMetrics().getHeight();
+		final int y0 = y - texth/2 + (cell.getHeight() - texth)/2;
 		g.setColor(cell.getForeground());
-		g.drawString(msg, x, texty - (cell.getHeight() - y * 2));
+		g.drawString(msg, x, y0 + texth - g.getFontMetrics().getDescent());
 	}
 
 	@Override
-- 
1.6.0.1.310.gf789d0.dirty

^ permalink raw reply related

* [EGIT PATCH 1/3] Set table row height for the glog JTable
From: Robin Rosenberg @ 2008-10-01 19:31 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1222889493-12736-1-git-send-email-robin.rosenberg@dewire.com>

For some obscure reason JTable has a fixed default row size
of 16 pixels. This doesn't work well outside the default
look-and-feels shipped with the JRE, e.g. the GTK look and
feel for Linux.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../org/spearce/jgit/awtui/CommitGraphPane.java    |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
index 2be0e95..d778821 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
@@ -52,6 +52,7 @@
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
 import javax.swing.table.TableColumnModel;
 import javax.swing.table.TableModel;
@@ -83,8 +84,18 @@ public CommitGraphPane() {
 		allCommits = new SwingCommitList();
 		configureHeader();
 		setShowHorizontalLines(false);
-		setRowMargin(0);
 		setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+		configureRowHeight();
+	}
+
+	private void configureRowHeight() {
+		int h = 0;
+		for (int i = 0; i<getColumnCount(); ++i) {
+			TableCellRenderer renderer = getDefaultRenderer(getColumnClass(i));
+			Component c = renderer.getTableCellRendererComponent(this, "\u00c5Oj", false, false, 0, i);
+			h = Math.max(h, c.getPreferredSize().height);
+		}
+		setRowHeight(h + getRowMargin());
 	}
 
 	/**
-- 
1.6.0.1.310.gf789d0.dirty

^ permalink raw reply related

* [EGIT PATCH 2/3] Move AWTPlotRenderer to its own file.
From: Robin Rosenberg @ 2008-10-01 19:31 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1222889493-12736-2-git-send-email-robin.rosenberg@dewire.com>

This is mostly a convenience issue as it allows the
use of the JVM hotswap feature while debugging.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../org/spearce/jgit/awtui/AWTPlotRenderer.java    |  137 ++++++++++++++++++++
 .../org/spearce/jgit/awtui/CommitGraphPane.java    |   92 -------------
 2 files changed, 137 insertions(+), 92 deletions(-)
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java

diff --git a/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java b/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java
new file mode 100644
index 0000000..dc785ec
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/awtui/AWTPlotRenderer.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
+ *
+ * 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.awtui;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Polygon;
+
+import org.spearce.jgit.awtui.CommitGraphPane.GraphCellRender;
+import org.spearce.jgit.awtui.SwingCommitList.SwingLane;
+import org.spearce.jgit.revplot.AbstractPlotRenderer;
+import org.spearce.jgit.revplot.PlotCommit;
+
+final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color> {
+
+	final GraphCellRender cell;
+
+	Graphics2D g;
+
+	AWTPlotRenderer(final GraphCellRender c) {
+		cell = c;
+	}
+
+	void paint(final Graphics in, final PlotCommit<SwingLane> commit) {
+		g = (Graphics2D) in.create();
+		try {
+			final int h = cell.getHeight();
+			g.setColor(cell.getBackground());
+			g.fillRect(0, 0, cell.getWidth(), h);
+			if (commit != null)
+				paintCommit(commit, h);
+		} finally {
+			g.dispose();
+			g = null;
+		}
+	}
+
+	@Override
+	protected void drawLine(final Color color, int x1, int y1, int x2,
+			int y2, int width) {
+		if (y1 == y2) {
+			x1 -= width / 2;
+			x2 -= width / 2;
+		} else if (x1 == x2) {
+			y1 -= width / 2;
+			y2 -= width / 2;
+		}
+
+		g.setColor(color);
+		g.setStroke(CommitGraphPane.stroke(width));
+		g.drawLine(x1, y1, x2, y2);
+	}
+
+	@Override
+	protected void drawCommitDot(final int x, final int y, final int w,
+			final int h) {
+		g.setColor(Color.blue);
+		g.setStroke(CommitGraphPane.strokeCache[1]);
+		g.fillOval(x, y, w, h);
+		g.setColor(Color.black);
+		g.drawOval(x, y, w, h);
+	}
+
+	@Override
+	protected void drawBoundaryDot(final int x, final int y, final int w,
+			final int h) {
+		g.setColor(cell.getBackground());
+		g.setStroke(CommitGraphPane.strokeCache[1]);
+		g.fillOval(x, y, w, h);
+		g.setColor(Color.black);
+		g.drawOval(x, y, w, h);
+	}
+
+	@Override
+	protected void drawText(final String msg, final int x, final int y) {
+		final int texty = g.getFontMetrics().getHeight()
+				- g.getFontMetrics().getDescent();
+		g.setColor(cell.getForeground());
+		g.drawString(msg, x, texty - (cell.getHeight() - y * 2));
+	}
+
+	@Override
+	protected Color laneColor(final SwingLane myLane) {
+		return myLane != null ? myLane.color : Color.black;
+	}
+
+	void paintTriangleDown(final int cx, final int y, final int h) {
+		final int tipX = cx;
+		final int tipY = y + h;
+		final int baseX1 = cx - 10 / 2;
+		final int baseX2 = tipX + 10 / 2;
+		final int baseY = y;
+		final Polygon triangle = new Polygon();
+		triangle.addPoint(tipX, tipY);
+		triangle.addPoint(baseX1, baseY);
+		triangle.addPoint(baseX2, baseY);
+		g.fillPolygon(triangle);
+		g.drawPolygon(triangle);
+	}
+
+}
\ No newline at end of file
diff --git a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
index d778821..c8c5a06 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/awtui/CommitGraphPane.java
@@ -38,11 +38,8 @@
 package org.spearce.jgit.awtui;
 
 import java.awt.BasicStroke;
-import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Polygon;
 import java.awt.Stroke;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -59,7 +56,6 @@
 
 import org.spearce.jgit.awtui.SwingCommitList.SwingLane;
 import org.spearce.jgit.lib.PersonIdent;
-import org.spearce.jgit.revplot.AbstractPlotRenderer;
 import org.spearce.jgit.revplot.PlotCommit;
 import org.spearce.jgit.revplot.PlotCommitList;
 
@@ -251,92 +247,4 @@ static Stroke stroke(final int width) {
 		return new BasicStroke(width);
 	}
 
-	final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color> {
-
-		final GraphCellRender cell;
-
-		Graphics2D g;
-
-		AWTPlotRenderer(final GraphCellRender c) {
-			cell = c;
-		}
-
-		void paint(final Graphics in, final PlotCommit<SwingLane> commit) {
-			g = (Graphics2D) in.create();
-			try {
-				final int h = cell.getHeight();
-				g.setColor(cell.getBackground());
-				g.fillRect(0, 0, cell.getWidth(), h);
-				if (commit != null)
-					paintCommit(commit, h);
-			} finally {
-				g.dispose();
-				g = null;
-			}
-		}
-
-		@Override
-		protected void drawLine(final Color color, int x1, int y1, int x2,
-				int y2, int width) {
-			if (y1 == y2) {
-				x1 -= width / 2;
-				x2 -= width / 2;
-			} else if (x1 == x2) {
-				y1 -= width / 2;
-				y2 -= width / 2;
-			}
-
-			g.setColor(color);
-			g.setStroke(stroke(width));
-			g.drawLine(x1, y1, x2, y2);
-		}
-
-		@Override
-		protected void drawCommitDot(final int x, final int y, final int w,
-				final int h) {
-			g.setColor(Color.blue);
-			g.setStroke(strokeCache[1]);
-			g.fillOval(x, y, w, h);
-			g.setColor(Color.black);
-			g.drawOval(x, y, w, h);
-		}
-
-		@Override
-		protected void drawBoundaryDot(final int x, final int y, final int w,
-				final int h) {
-			g.setColor(cell.getBackground());
-			g.setStroke(strokeCache[1]);
-			g.fillOval(x, y, w, h);
-			g.setColor(Color.black);
-			g.drawOval(x, y, w, h);
-		}
-
-		@Override
-		protected void drawText(final String msg, final int x, final int y) {
-			final int texty = g.getFontMetrics().getHeight()
-					- g.getFontMetrics().getDescent();
-			g.setColor(cell.getForeground());
-			g.drawString(msg, x, texty - (cell.getHeight() - y * 2));
-		}
-
-		@Override
-		protected Color laneColor(final SwingLane myLane) {
-			return myLane != null ? myLane.color : Color.black;
-		}
-
-		void paintTriangleDown(final int cx, final int y, final int h) {
-			final int tipX = cx;
-			final int tipY = y + h;
-			final int baseX1 = cx - 10 / 2;
-			final int baseX2 = tipX + 10 / 2;
-			final int baseY = y;
-			final Polygon triangle = new Polygon();
-			triangle.addPoint(tipX, tipY);
-			triangle.addPoint(baseX1, baseY);
-			triangle.addPoint(baseX2, baseY);
-			g.fillPolygon(triangle);
-			g.drawPolygon(triangle);
-		}
-	}
-
 }
-- 
1.6.0.1.310.gf789d0.dirty

^ permalink raw reply related

* regression: stash show -p (was [PATCH maint] git-stash.sh: don't default to refs/stash if invalid ref supplied)
From: Brandon Casey @ 2008-10-01 19:53 UTC (permalink / raw)
  To: mattjackets; +Cc: Git Mailing List
In-Reply-To: <twy9P1UnbmZHs2ZDeFBjSzrleLQ225-I7ESNrFkwoXZL-mJCTf4hYw@cipher.nrlssc.navy.mil>


Thanks to the patch referenced in the subject, 'git stash show -p'
no longer works if a revision is _not_ supplied.

This is because the argument list passed to show_stash() is not empty,
so the default $ref_stash@{0} is not appended.

This brings me back to an unanswered question, "Should rev-parse fall
back to its --default argument when an invalid ref is supplied?". The
documentation does not imply that it should.

>From Documentation/git-rev-parse.txt:

   --default <arg>::
        If there is no parameter given by the user, use `<arg>`
        instead.

Currently a rev-parse invocation like:

    $ git rev-parse --default HEAD a_non_existent_ref

will fall back to operating on HEAD. Is this correct? Could there be
some part of git that depends on this behavior? filter-branch is now
the only script which uses the --default option of rev-parse, not sure
about the c code.

-brandon



Brandon Casey wrote:
> apply_stash() and show_stash() each call rev-parse with
> '--default refs/stash' as an argument. This option causes rev-parse to
> operate on refs/stash if it is not able to successfully operate on any
> element of the command line. This includes failure to supply a "valid"
> revision. This has the effect of causing 'stash apply' and 'stash show'
> to operate as if stash@{0} had been supplied when an invalid revision is
> supplied.
> 
> e.g. 'git stash apply stahs@{1}' would fall back to
>      'git stash apply stash@{0}'
> 
> This patch modifies these two functions so that they avoid using the
> --default option of rev-parse.
> 
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
> 
> 
> This should fix the case I mention above, but it does not fix the
> case where a non-existent reflog entry is specified. In this case
> the last entry will be selected.
> 
> 	$ git stash list
> 	stash@{0}: WIP on master: c050772... small java change
> 	stash@{1}: WIP on master: c050772... small java change
> 	stash@{2}: WIP on master: c050772... small java change
> 	stash@{3}: WIP on master: c050772... small java change
> 	$ git stash apply stash@{10}
> 	warning: Log for 'stash' only has 4 entries.
> 	# On branch master
> 	# Changed but not updated:
> 	... etc.
> 
> stash@{3} was applied.
> 
> Luckily, the dangerous case has no effect.
> 
> 	$ git stash drop stash@{10}
> 	Dropped stash@{10} (b7a2467e58109c92d799d059f508f35853d0bff7)
> 	$ git stash list
> 	stash@{0}: WIP on master: c050772... small java change
> 	stash@{1}: WIP on master: c050772... small java change
> 	stash@{2}: WIP on master: c050772... small java change
> 	stash@{3}: WIP on master: c050772... small java change
> 
> -brandon
> 
> 
>  git-stash.sh |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/git-stash.sh b/git-stash.sh
> index d799c76..6bd2572 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -144,7 +144,14 @@ show_stash () {
>  	then
>  		flags=--stat
>  	fi
> -	s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@")
> +
> +	if test $# = 0
> +	then
> +		set x "$ref_stash@{0}"
> +		shift
> +	fi
> +
> +	s=$(git rev-parse --revs-only --no-flags "$@")
>  
>  	w_commit=$(git rev-parse --verify "$s") &&
>  	b_commit=$(git rev-parse --verify "$s^") &&
> @@ -163,13 +170,19 @@ apply_stash () {
>  		shift
>  	esac
>  
> +	if test $# = 0
> +	then
> +		set x "$ref_stash@{0}"
> +		shift
> +	fi
> +
>  	# current index state
>  	c_tree=$(git write-tree) ||
>  		die 'Cannot apply a stash in the middle of a merge'
>  
>  	# stash records the work tree, and is a merge between the
>  	# base commit (first parent) and the index tree (second parent).
> -	s=$(git rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
> +	s=$(git rev-parse --revs-only --no-flags "$@") &&
>  	w_tree=$(git rev-parse --verify "$s:") &&
>  	b_tree=$(git rev-parse --verify "$s^1:") &&
>  	i_tree=$(git rev-parse --verify "$s^2:") ||

^ permalink raw reply

* Help with a tcl/tk gui thing..
From: Linus Torvalds @ 2008-10-01 19:54 UTC (permalink / raw)
  To: Git Mailing List


Ok, this is ridiculous, and has nothing to do with git apart from being 
hosted in it, but I thought I'd send out an email about it since the git 
community is the only one I know that does any GUI work at all...

I've got three girls, all wasting their time on their computer, and we set 
up this rule that they get to have a maximum of an hour of internet time 
each day. Of course, being the geek I am, I wrote a stupid time tracker 
for that purpose, and then totally forgot about it.

Until the harddisk in their computer broke down, and I had to re-install, 
and realized that I didn't have a copy of my stupid tracker sources 
anywhere. So I had to re-write it, and to make sure that I didn't lose it 
_again_, I put it in a git repo this time, and now have it on my desktop 
machine.

I _also_ have it on kernel.org, because I tend to change machines often 
enough that files get lost because I decide that switching machines is 
also a great way of doing "generational GC" on my home directory.

[ iow, I copy my old home directory as "old-home" when I switch machines, 
  and anything I didn't end up copying by the time I switch machines 
  again, just gets deleted. Very neat, and a great way to lose things that 
  you only care about every other year or so. ]

Whatever.

To make a long story short, I have a very small program that does all the 
tracking, and I have no problems with that. It doesn't have much of a 
admin interface, but I can do "echo 3600 > /var/log/tracker/celeste" to 
reset the time etc. _I_ have no need for pretty GUI's.

But I also have a UI that the kids can run to _see_ how much time they 
have left, so that getting thrown off the machine doesn't come as a total 
surprise. And yesterday Patricia asked why it has to be that ugly. And I 
had to admit that her dad is just not very good at UI's - and my 
re-implementation may in fact have been EVEN UGLIER than my original 
version. If that is even possible.

But hey, I'm not above impressing my kids with pretty bling if I can get 
somebody else who actually knows what they are doing to enhance my wish 
scripts to something reasonable.

Anybody?

The repository is at

	git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/tracker.git

if somebody knows how to make the text turn red when the end is near 
and/or make it have some nice graphical bar that fills up as time is about 
to expire.

And if nobody does, no worries. At least I tried. My kids can continue to 
watch ugly/small/monochrome fonts with just a count-down clock.

			Linus

^ permalink raw reply

* Re: [PATCH] xdiff-interface.c: strip newline (and cr) from line before pattern matching
From: Johannes Schindelin @ 2008-10-01 20:05 UTC (permalink / raw)
  To: Brandon Casey
  Cc: Jonathan del Strother, Git Mailing List, Miklos Vajna,
	Junio C Hamano, Andreas Ericsson
In-Reply-To: <o5dqpNECJusQHKCTvRWiIqN2ZJ7w-fyC-0vM99FajJIgLsOwP3RNug@cipher.nrlssc.navy.mil>

Hi,

On Wed, 1 Oct 2008, Brandon Casey wrote:

> POSIX doth sayeth:
> 
>    "In the regular expression processing described in IEEE Std 1003.1-2001,
>     the <newline> is regarded as an ordinary character and both a period and
>     a non-matching list can match one. ... Those utilities (like grep) that
>     do not allow <newline>s to match are responsible for eliminating any
>     <newline> from strings before matching against the RE."
> 
> Thus far git has not been removing the trailing newline from strings matched
> against regular expression patterns. This has the effect that (quoting
> Jonathan del Strother) "... a line containing just 'FUNCNAME' (terminated by
> a newline) will be matched by the pattern '^(FUNCNAME.$)' but not
> '^(FUNCNAME$)'", and more simply not '^FUNCNAME$'.

Personally, I find the second paragraph pretty convincing.  Which is good, 
because the first fails to do that.

Ciao,
Dscho

^ permalink raw reply

* [PATCH] gitweb: Quote non-displayable characters in hex, not octal
From: Petr Baudis @ 2008-10-01 20:11 UTC (permalink / raw)
  To: git, git; +Cc: Petr Baudis

For the last 30 years, the mankind uses the octal representation of
characters only in rare cases and most character codes are hardly
recognizable in octal. In contrast, many programmers still know
hexadecimal well and that is also the representation of choice e.g.
for Unicode codepoints.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>

---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index da474d0..1b5aa14 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -775,7 +775,7 @@ sub quot_cec {
 	);
 	my $chr = ( (exists $es{$cntrl})
 		    ? $es{$cntrl}
-		    : sprintf('\%03o', ord($cntrl)) );
+		    : sprintf('\%2x', ord($cntrl)) );
 	if ($opts{-nohtml}) {
 		return $chr;
 	} else {
-- 
tg: (c427559..) t/misc/quot-hex (depends on: vanilla/master)

^ permalink raw reply related

* [PATCH] config.c: Tolerate UTF8 BOM at the beginning of config file
From: Petr Baudis @ 2008-10-01 20:13 UTC (permalink / raw)
  To: git, git; +Cc: Petr Baudis

Unfortunately, the abomination of Windows Notepad likes to scatted
non-sensical UTF8 BOM marks across text files it edits. This is
especially troublesome when editing the Git configuration file,
and it does not appear to be particularly harmful to teach Git
to deal with this poo in the configfile.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>

---
 config.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/config.c b/config.c
index 53f04a0..1d30120 100644
--- a/config.c
+++ b/config.c
@@ -205,8 +205,27 @@ static int git_parse_file(config_fn_t fn, void *data)
 	int baselen = 0;
 	static char var[MAXNAME];
 
+	/* U+FEFF Byte Order Mark in UTF8 */
+	static const unsigned char *utf8_bom = (unsigned char *) "\xef\xbb\xbf";
+	const unsigned char *bomptr = utf8_bom;
+
 	for (;;) {
 		int c = get_next_char();
+		if (bomptr && *bomptr) {
+			/* We are at the file beginning; skip UTF8-encoded BOM
+			 * if present. Sane editors won't put this in on their
+			 * own, but e.g. Windows Notepad will do it happily. */
+			if ((unsigned char) c == *bomptr) {
+				bomptr++;
+				continue;
+			} else {
+				/* Do not tolerate partial BOM. */
+				if (bomptr != utf8_bom)
+					break;
+				/* No BOM at file beginning. Cool. */
+				bomptr = NULL;
+			}
+		}
 		if (c == '\n') {
 			if (config_file_eof)
 				return 0;
-- 
tg: (9800c0d..) t/config/utf8-bom (depends on: vanilla/master)

^ permalink raw reply related

* [TRACKER PATCH] Change color at specified threshold
From: Johannes Schindelin @ 2008-10-01 20:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org>


Now the color changes when a certain threshold of remaining seconds is
reached.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	On Wed, 1 Oct 2008, Linus Torvalds wrote:

	> But I also have a UI that the kids can run to _see_ how much 
	> time they have left, so that getting thrown off the machine doesn't 
	> come as a total surprise.

 tracker-ui.tcl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tracker-ui.tcl b/tracker-ui.tcl
index 16d00d7..1533db5 100755
--- a/tracker-ui.tcl
+++ b/tracker-ui.tcl
@@ -1,5 +1,7 @@
 #!/usr/bin/wish
 
+set red_threshold [expr 60 * 10]
+
 proc every {ms body} {
      eval $body
      after $ms [list every $ms $body]
@@ -7,14 +9,19 @@ proc every {ms body} {
 
 set user $env(USER)
 
-pack [label .tracker -textvariable time]
+pack [label .tracker -textvariable time -font "Times 36" -relief sunken]
 
 every 1000 {
-	global user
+	global user red_threshold
 	set f [open "/var/log/tracker/$user" "r"]
 	gets $f l1
 	gets $f l2
 	gets $f l3
 	close $f
 	set ::time "$l3"
+	if {[expr [lindex $l1 0] - [lindex $l1 1]] < $red_threshold} {
+		.tracker configure -foreground white -background red
+	} {
+		.tracker configure -foreground black -background white
+	}
 }
-- 
1.6.0.2.GIT

^ permalink raw reply related

* [PATCH] Add branch.autosetuppreservemerges and branch.<name>.preservemerges.
From: Stephen Haberman @ 2008-10-01 20:27 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Git Mailing List
In-Reply-To: <48D95836.6040200@op5.se>

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
---

This builds on top of Andreas's work on `git rebase -p`. I
basically copy/pasted how autosetuprebase works so that, if
appropriately configured, `git pull` will do the "right thing"
for our environment, i.e. rebasing and preserving merges.

I'm not sure how to handle patches on patches, so apologies
if I did this wrong. Let me know if there are things I should
be doing differently.

Thanks.

 Documentation/config.txt          |   20 ++++++++
 branch.c                          |   20 ++++++++
 cache.h                           |    9 ++++
 config.c                          |   15 ++++++
 environment.c                     |    1 +
 git-pull.sh                       |   10 +++-
 t/t3200-branch.sh                 |   89 ++++++++++++++++++++++++++++--------
 t/t3409-rebase-preserve-merges.sh |   65 ++++++++++++++++----------
 8 files changed, 182 insertions(+), 47 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index bea867d..0abf1b8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -438,6 +438,21 @@ branch.autosetuprebase::
 	branch to track another branch.
 	This option defaults to never.
 
+branch.autosetuppreservemerges::
+	When a new branch is created with 'git-branch' or 'git-checkout'
+	that tracks another branch, this variable tells git to set
+	up pull to rebase with preserve merges (see "branch.<name>.rebase").
+	When `never`, rebase is never automatically set to true.
+	When `local`, rebase is set to true for tracked branches of
+	other local branches.
+	When `remote`, rebase is set to true for tracked branches of
+	remote branches.
+	When `always`, rebase will be set to true for all tracking
+	branches.
+	See "branch.autosetupmerge" for details on how to set up a
+	branch to track another branch.
+	This option defaults to never.
+
 branch.<name>.remote::
 	When in branch <name>, it tells 'git-fetch' which remote to fetch.
 	If this option is not given, 'git-fetch' defaults to remote "origin".
@@ -471,6 +486,11 @@ branch.<name>.rebase::
 	it unless you understand the implications (see linkgit:git-rebase[1]
 	for details).
 
+branch.<name>.preservemerges::
+	When true, and branch.<name>.rebase is true, preserve merges when
+	rebasing the branch <name> on top of the fetched branch when
+	"git pull" is run.
+
 browser.<tool>.cmd::
 	Specify the command to invoke the specified browser. The
 	specified command is evaluated in shell with the URLs passed
diff --git a/branch.c b/branch.c
index b1e59f2..a5e62c8 100644
--- a/branch.c
+++ b/branch.c
@@ -47,6 +47,21 @@ static int should_setup_rebase(const struct tracking *tracking)
 	return 0;
 }
 
+static int should_setup_preservemerges(const struct tracking *tracking)
+{
+	switch (autopreservemerges) {
+	case AUTOPRESERVEMERGES_NEVER:
+		return 0;
+	case AUTOPRESERVEMERGES_LOCAL:
+		return tracking->remote == NULL;
+	case AUTOPRESERVEMERGES_REMOTE:
+		return tracking->remote != NULL;
+	case AUTOPRESERVEMERGES_ALWAYS:
+		return 1;
+	}
+	return 0;
+}
+
 /*
  * This is called when new_ref is branched off of orig_ref, and tries
  * to infer the settings for branch.<new_ref>.{remote,merge} from the
@@ -91,6 +106,11 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,
 		git_config_set(key, "true");
 		printf("This branch will rebase on pull.\n");
 	}
+	if (should_setup_preservemerges(&tracking)) {
+		sprintf(key, "branch.%s.preservemerges", new_ref);
+		git_config_set(key, "true");
+		printf("This branch will preserve merges on pull.\n");
+	}
 	free(tracking.src);
 
 	return 0;
diff --git a/cache.h b/cache.h
index de8c2b6..97be98c 100644
--- a/cache.h
+++ b/cache.h
@@ -467,8 +467,17 @@ enum rebase_setup_type {
 	AUTOREBASE_ALWAYS,
 };
 
+enum preservemerges_setup_type {
+	AUTOPRESERVEMERGES_NEVER = 0,
+	AUTOPRESERVEMERGES_LOCAL,
+	AUTOPRESERVEMERGES_REMOTE,
+	AUTOPRESERVEMERGES_ALWAYS,
+};
+
+
 extern enum branch_track git_branch_track;
 extern enum rebase_setup_type autorebase;
+extern enum preservemerges_setup_type autopreservemerges;
 
 #define GIT_REPO_VERSION 0
 extern int repository_format_version;
diff --git a/config.c b/config.c
index 53f04a0..6302f5a 100644
--- a/config.c
+++ b/config.c
@@ -536,6 +536,21 @@ static int git_default_branch_config(const char *var, const char *value)
 			return error("Malformed value for %s", var);
 		return 0;
 	}
+	if (!strcmp(var, "branch.autosetuppreservemerges")) {
+		if (!value)
+			return config_error_nonbool(var);
+		else if (!strcmp(value, "never"))
+			autopreservemerges = AUTOPRESERVEMERGES_NEVER;
+		else if (!strcmp(value, "local"))
+			autopreservemerges = AUTOPRESERVEMERGES_LOCAL;
+		else if (!strcmp(value, "remote"))
+			autopreservemerges = AUTOPRESERVEMERGES_REMOTE;
+		else if (!strcmp(value, "always"))
+			autopreservemerges = AUTOPRESERVEMERGES_ALWAYS;
+		else
+			return error("Malformed value for %s", var);
+		return 0;
+	}
 
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
diff --git a/environment.c b/environment.c
index 0c6d11f..72e735c 100644
--- a/environment.c
+++ b/environment.c
@@ -42,6 +42,7 @@ enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
+enum preservemerges_setup_type autopreservemerges = AUTOPRESERVEMERGES_NEVER;
 
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
 char *git_work_tree_cfg;
diff --git a/git-pull.sh b/git-pull.sh
index 270a50d..03b7da0 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -20,6 +20,7 @@ strategy_args= no_stat= no_commit= squash= no_ff= log_arg=
 curr_branch=$(git symbolic-ref -q HEAD)
 curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
 rebase=$(git config --bool branch.$curr_branch_short.rebase)
+preservemerges=$(git config --bool branch.$curr_branch_short.preservemerges)
 while :
 do
 	case "$1" in
@@ -59,7 +60,7 @@ do
 		rebase=true
 		;;
 	--preserve-merges) # no short option for this
-		preserve_merges="--preserve-merges"
+		preservemerges=true
 		rebase=true
 		;;
 	--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)
@@ -181,9 +182,14 @@ then
 	exit
 fi
 
+if test true = "$preservemerges"
+then
+	preservemerges_flag="--preserve-merges"
+fi
+
 merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
 test true = "$rebase" &&
-	exec git-rebase $preserve_merges $strategy_args --onto $merge_head \
+	exec git-rebase $preservemerges_flag $strategy_args --onto $merge_head \
 	${oldremoteref:-$merge_head}
 exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
 	"$merge_name" HEAD $merge_head
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 2147eac..f10b8ac 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -228,103 +228,121 @@ test_expect_success 'autosetuprebase local on a tracked local branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase local &&
+	git config branch.autosetuppreservemerges local &&
 	(git show-ref -q refs/remotes/local/o || git fetch local) &&
 	git branch mybase &&
 	git branch --track myr1 mybase &&
 	test "$(git config branch.myr1.remote)" = . &&
 	test "$(git config branch.myr1.merge)" = refs/heads/mybase &&
-	test "$(git config branch.myr1.rebase)" = true
+	test "$(git config branch.myr1.rebase)" = true &&
+	test "$(git config branch.myr1.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase always on a tracked local branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase always &&
+	git config branch.autosetuppreservemerges always &&
 	(git show-ref -q refs/remotes/local/o || git fetch local) &&
 	git branch mybase2 &&
 	git branch --track myr2 mybase &&
 	test "$(git config branch.myr2.remote)" = . &&
 	test "$(git config branch.myr2.merge)" = refs/heads/mybase &&
-	test "$(git config branch.myr2.rebase)" = true
+	test "$(git config branch.myr2.rebase)" = true &&
+	test "$(git config branch.myr2.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase remote on a tracked local branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase remote &&
+	git config branch.autosetuppreservemerges remote &&
 	(git show-ref -q refs/remotes/local/o || git fetch local) &&
 	git branch mybase3 &&
 	git branch --track myr3 mybase2 &&
 	test "$(git config branch.myr3.remote)" = . &&
 	test "$(git config branch.myr3.merge)" = refs/heads/mybase2 &&
-	! test "$(git config branch.myr3.rebase)" = true
+	! test "$(git config branch.myr3.rebase)" = true &&
+	! test "$(git config branch.myr3.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase never on a tracked local branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase never &&
+	git config branch.autosetuppreservemerges never &&
 	(git show-ref -q refs/remotes/local/o || git fetch local) &&
 	git branch mybase4 &&
 	git branch --track myr4 mybase2 &&
 	test "$(git config branch.myr4.remote)" = . &&
 	test "$(git config branch.myr4.merge)" = refs/heads/mybase2 &&
-	! test "$(git config branch.myr4.rebase)" = true
+	! test "$(git config branch.myr4.rebase)" = true &&
+	! test "$(git config branch.myr4.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase local on a tracked remote branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase local &&
+	git config branch.autosetuppreservemerges local &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --track myr5 local/master &&
 	test "$(git config branch.myr5.remote)" = local &&
 	test "$(git config branch.myr5.merge)" = refs/heads/master &&
-	! test "$(git config branch.myr5.rebase)" = true
+	! test "$(git config branch.myr5.rebase)" = true &&
+	! test "$(git config branch.myr5.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase never on a tracked remote branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase never &&
+	git config branch.autosetuppreservemerges never &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --track myr6 local/master &&
 	test "$(git config branch.myr6.remote)" = local &&
 	test "$(git config branch.myr6.merge)" = refs/heads/master &&
-	! test "$(git config branch.myr6.rebase)" = true
+	! test "$(git config branch.myr6.rebase)" = true &&
+	! test "$(git config branch.myr6.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase remote on a tracked remote branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase remote &&
+	git config branch.autosetuppreservemerges remote &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --track myr7 local/master &&
 	test "$(git config branch.myr7.remote)" = local &&
 	test "$(git config branch.myr7.merge)" = refs/heads/master &&
-	test "$(git config branch.myr7.rebase)" = true
+	test "$(git config branch.myr7.rebase)" = true &&
+	test "$(git config branch.myr7.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase always on a tracked remote branch' '
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	git config branch.autosetuprebase remote &&
+	git config branch.autosetuppreservemerges remote &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --track myr8 local/master &&
 	test "$(git config branch.myr8.remote)" = local &&
 	test "$(git config branch.myr8.merge)" = refs/heads/master &&
-	test "$(git config branch.myr8.rebase)" = true
+	test "$(git config branch.myr8.rebase)" = true &&
+	test "$(git config branch.myr8.preservemerges)" = true
 '
 
 test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' '
 	git config --unset branch.autosetuprebase &&
+	git config --unset branch.autosetuppreservemerges &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --track myr9 local/master &&
 	test "$(git config branch.myr9.remote)" = local &&
 	test "$(git config branch.myr9.merge)" = refs/heads/master &&
-	test "z$(git config branch.myr9.rebase)" = z
+	test "z$(git config branch.myr9.rebase)" = z &&
+	test "z$(git config branch.myr9.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
@@ -335,7 +353,8 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' '
 	git branch --track myr10 mybase2 &&
 	test "$(git config branch.myr10.remote)" = . &&
 	test "$(git config branch.myr10.merge)" = refs/heads/mybase2 &&
-	test "z$(git config branch.myr10.rebase)" = z
+	test "z$(git config branch.myr10.rebase)" = z &&
+	test "z$(git config branch.myr10.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
@@ -345,7 +364,8 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' '
 	git branch --no-track myr11 mybase2 &&
 	test "z$(git config branch.myr11.remote)" = z &&
 	test "z$(git config branch.myr11.merge)" = z &&
-	test "z$(git config branch.myr11.rebase)" = z
+	test "z$(git config branch.myr11.rebase)" = z &&
+	test "z$(git config branch.myr11.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
@@ -355,95 +375,112 @@ test_expect_success 'autosetuprebase unconfigured on untracked remote branch' '
 	git branch --no-track myr12 local/master &&
 	test "z$(git config branch.myr12.remote)" = z &&
 	test "z$(git config branch.myr12.merge)" = z &&
-	test "z$(git config branch.myr12.rebase)" = z
+	test "z$(git config branch.myr12.rebase)" = z &&
+	test "z$(git config branch.myr12.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase never on an untracked local branch' '
 	git config branch.autosetuprebase never &&
+	git config branch.autosetuppreservemerges never &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr13 mybase2 &&
 	test "z$(git config branch.myr13.remote)" = z &&
 	test "z$(git config branch.myr13.merge)" = z &&
-	test "z$(git config branch.myr13.rebase)" = z
+	test "z$(git config branch.myr13.rebase)" = z &&
+	test "z$(git config branch.myr13.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase local on an untracked local branch' '
 	git config branch.autosetuprebase local &&
+	git config branch.autosetuppreservemerges local &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr14 mybase2 &&
 	test "z$(git config branch.myr14.remote)" = z &&
 	test "z$(git config branch.myr14.merge)" = z &&
-	test "z$(git config branch.myr14.rebase)" = z
+	test "z$(git config branch.myr14.rebase)" = z &&
+	test "z$(git config branch.myr14.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase remote on an untracked local branch' '
 	git config branch.autosetuprebase remote &&
+	git config branch.autosetuppreservemerges remote &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr15 mybase2 &&
 	test "z$(git config branch.myr15.remote)" = z &&
 	test "z$(git config branch.myr15.merge)" = z &&
-	test "z$(git config branch.myr15.rebase)" = z
+	test "z$(git config branch.myr15.rebase)" = z &&
+	test "z$(git config branch.myr15.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase always on an untracked local branch' '
 	git config branch.autosetuprebase always &&
+	git config branch.autosetuppreservemerges always &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr16 mybase2 &&
 	test "z$(git config branch.myr16.remote)" = z &&
 	test "z$(git config branch.myr16.merge)" = z &&
-	test "z$(git config branch.myr16.rebase)" = z
+	test "z$(git config branch.myr16.rebase)" = z &&
+	test "z$(git config branch.myr16.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase never on an untracked remote branch' '
 	git config branch.autosetuprebase never &&
+	git config branch.autosetuppreservemerges never &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr17 local/master &&
 	test "z$(git config branch.myr17.remote)" = z &&
 	test "z$(git config branch.myr17.merge)" = z &&
-	test "z$(git config branch.myr17.rebase)" = z
+	test "z$(git config branch.myr17.rebase)" = z &&
+	test "z$(git config branch.myr17.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase local on an untracked remote branch' '
 	git config branch.autosetuprebase local &&
+	git config branch.autosetuppreservemerges local &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr18 local/master &&
 	test "z$(git config branch.myr18.remote)" = z &&
 	test "z$(git config branch.myr18.merge)" = z &&
-	test "z$(git config branch.myr18.rebase)" = z
+	test "z$(git config branch.myr18.rebase)" = z &&
+	test "z$(git config branch.myr18.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase remote on an untracked remote branch' '
 	git config branch.autosetuprebase remote &&
+	git config branch.autosetuppreservemerges remote &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr19 local/master &&
 	test "z$(git config branch.myr19.remote)" = z &&
 	test "z$(git config branch.myr19.merge)" = z &&
-	test "z$(git config branch.myr19.rebase)" = z
+	test "z$(git config branch.myr19.rebase)" = z &&
+	test "z$(git config branch.myr19.preservemerges)" = z
 '
 
 test_expect_success 'autosetuprebase always on an untracked remote branch' '
 	git config branch.autosetuprebase always &&
+	git config branch.autosetuppreservemerges always &&
 	git config remote.local.url . &&
 	git config remote.local.fetch refs/heads/*:refs/remotes/local/* &&
 	(git show-ref -q refs/remotes/local/master || git fetch local) &&
 	git branch --no-track myr20 local/master &&
 	test "z$(git config branch.myr20.remote)" = z &&
 	test "z$(git config branch.myr20.merge)" = z &&
-	test "z$(git config branch.myr20.rebase)" = z
+	test "z$(git config branch.myr20.rebase)" = z &&
+	test "z$(git config branch.myr20.preservemerges)" = z
 '
 
 test_expect_success 'detect misconfigured autosetuprebase (bad value)' '
@@ -451,6 +488,11 @@ test_expect_success 'detect misconfigured autosetuprebase (bad value)' '
 	test_must_fail git branch
 '
 
+test_expect_success 'detect misconfigured autosetuppreservemerges (bad value)' '
+	git config branch.autosetuppreservemerges garbage &&
+	test_must_fail git branch
+'
+
 test_expect_success 'detect misconfigured autosetuprebase (no value)' '
 	git config --unset branch.autosetuprebase &&
 	echo "[branch] autosetuprebase" >> .git/config &&
@@ -458,4 +500,11 @@ test_expect_success 'detect misconfigured autosetuprebase (no value)' '
 	git config --unset branch.autosetuprebase
 '
 
+test_expect_success 'detect misconfigured autosetuppreservemerges (no value)' '
+	git config --unset branch.autosetuppreservemerges &&
+	echo "[branch] autosetuppreservemerges" >> .git/config &&
+	test_must_fail git branch &&
+	git config --unset branch.autosetuppreservemerges
+'
+
 test_done
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index 9a376ef..5f4ce56 100644
--- a/t/t3409-rebase-preserve-merges.sh
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -25,44 +25,59 @@ export GIT_AUTHOR_EMAIL
 test_expect_success 'setup for merge-preserving rebase' \
 	'echo First > A &&
 	git add A &&
-	git-commit -m "Add A1" &&
+	git-commit -m A1 &&
 	git checkout -b topic &&
 	echo Second > B &&
 	git add B &&
-	git-commit -m "Add B1" &&
+	git-commit -m B1 &&
+	git tag B1 &&
+	echo Third >> B &&
+	git commit -a -m B2
 	git checkout -f master &&
-	echo Third >> A &&
-	git-commit -a -m "Modify A2" &&
+	echo Fourth >> A &&
+	git-commit -a -m A2 &&
+	git clone . clone
+'
 
-	git clone ./. clone1 &&
-	cd clone1 &&
+test_expect_success 'git pull --rebase -p on moved topic' '
+	cd clone &&
 	git checkout -b topic origin/topic &&
+	git reset --hard B1 &&
 	git merge origin/master &&
+	git pull --rebase --preserve-merges &&
+	test $(git rev-list --all --pretty=oneline | grep A2 | wc -l) = 1 &&
+	git checkout origin/topic &&
+	git branch -D topic &&
 	cd ..
+'
 
-	git clone ./. clone2
-	cd clone2 &&
+test_expect_success 'rebase -p merge on moved topic' '
+	cd clone &&
 	git checkout -b topic origin/topic &&
+	git reset --hard B1 &&
 	git merge origin/master &&
-	cd .. &&
-
-	git checkout topic &&
-	echo Fourth >> B &&
-	git commit -a -m "Modify B2"
-'
-
-test_expect_success 'git pull --rebase -p on moved topic' '
-	cd clone1 &&
-	git pull --rebase --preserve-merges &&
-	test $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) = 1
+	git rebase -p origin/topic &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep A2 | wc -l) &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l) &&
+	git checkout origin/topic &&
+	git branch -D topic &&
+	cd ..
 '
 
-test_expect_success 'rebase -p merge on moved topic' '
-	cd ../clone2 &&
-	git fetch &&
-	git rebase -p origin/topic &&
-	test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
-	test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
+test_expect_success 'git pull on moved topic' '
+	cd clone &&
+	git config branch.autosetuppreservemerges always &&
+	git checkout -b topic origin/topic &&
+	test true = $(git config branch.topic.preservemerges) &&
+	git reset --hard B1 &&
+	git merge origin/master &&
+	git pull &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep A2 | wc -l) &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l) &&
+	git checkout origin/topic &&
+	git branch -D topic &&
+	cd ..
 '
 
 test_done
+
-- 
1.6.0.2

^ permalink raw reply related

* Re: [PATCH 3/9] Docs: send-email: Man page option ordering
From: Michael Witten @ 2008-10-01 20:34 UTC (permalink / raw)
  To: Jeff King; +Cc: spearce, git
In-Reply-To: <20081001032701.GC24513@coredump.intra.peff.net>


On 30 Sep 2008, at 10:27 PM, Jeff King wrote:

> On Tue, Sep 30, 2008 at 07:58:26AM -0500, Michael Witten wrote:
>
>> Now the man page lists the options in alphabetical
>> order (in terms of the 'main' part of an option's
>> name).
>>
>> Signed-off-by: Michael Witten <mfwitten@mit.edu>
>
> After following this series through a number of revisions,
> it looks good to me now. So
>
> Acked-by: Jeff King <peff@peff.net>
>
> for the whole series.
>
> I believe this particular patch is probably redundant, since
> 8/9 just re-orders the manpage again later. So it could be
> dropped if somebody feels like doing the work to rebase the
> later patches.

I would suggest just leaving it there; it fixes a genuine
problem regardless of what the future patches do.

^ permalink raw reply

* [PATCH] Make maximum surf time really per day
From: Johannes Schindelin @ 2008-10-01 20:41 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0810012229390.22125@pacific.mpi-cbg.de.mpi-cbg.de>


Earlier, when the maximum time was reached, we would block for 8 hours.
The program description suggested that the maximum time should be per
day instead, however.  So rather check that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	I am sure your kids will hate me.  Now the trick to surf before 
	school, after school, and then late at night does not work 
	anymore.  :-(

	Well, the "late at night" would have interfered with next day's 
	"before school" anyway.

 tracker.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tracker.c b/tracker.c
index 1b26e7e..faa4a91 100644
--- a/tracker.c
+++ b/tracker.c
@@ -12,6 +12,9 @@
 
 #define TRACKER_FILE "/var/log/tracker/%s"
 
+/* Define this, just in case it changes some day */
+#define SECS_PER_DAY 86400
+
 enum state {
 	no_user, old_user, new_user
 };
@@ -43,7 +46,7 @@ static void update_fd(struct user *user, int fd, unsigned int s)
 	cur += s;
 
 	/* Has the user been logged out more than 8 hours? */
-	if (user->last - last >= 8*60*60)
+	if (user->last / SECS_PER_DAY != last / SECS_PER_DAY)
 		cur = 0;
 
 	left = max - cur;
-- 
1.6.0.2.GIT

^ permalink raw reply related

* Re: [PATCH 3/9] Docs: send-email: Man page option ordering
From: Shawn O. Pearce @ 2008-10-01 20:36 UTC (permalink / raw)
  To: Michael Witten; +Cc: Jeff King, git
In-Reply-To: <26288097-F87A-4F93-B030-40598D65BEEE@mit.edu>

Michael Witten <mfwitten@MIT.EDU> wrote:
> On 30 Sep 2008, at 10:27 PM, Jeff King wrote:
>>
>> I believe this particular patch is probably redundant, since
>> 8/9 just re-orders the manpage again later. So it could be
>> dropped if somebody feels like doing the work to rebase the
>> later patches.
>
> I would suggest just leaving it there; it fixes a genuine
> problem regardless of what the future patches do.

Not only that but the series is already merged into next.  I won't
be happy about having to revert it, rewrite history, and merge it
back into next.  :-)

-- 
Shawn.

^ permalink raw reply

* Re: [JGIT PATCH 4/5] Expose the critical receive configuration options to JGit
From: Robin Rosenberg @ 2008-10-01 20:54 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git
In-Reply-To: <1222824690-7632-5-git-send-email-spearce@spearce.org>


The repo configuration setup fails. I'll squash this in

--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
@@ -534,6 +534,7 @@ public void create() {
                add(e);

                core = new CoreConfig(this);
+               transfer = new TransferConfig(this);
        }

        /**

i.e. initialize the transfer object when creating a new repo in junit tests.

I also noted we try to read ~/.gitconfig which may give us som headaches
later on.

-- robin

^ permalink raw reply

* Re: Help with a tcl/tk gui thing..
From: Mikael Magnusson @ 2008-10-01 21:03 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org>

How's this?

git clone git://mika.l3ib.org/tracker.git

I wrote it in pygtk since I know zero to no tcl/tk, hope that's okay.
It has a label with the time remaining (simply read from the daemon file),
and shows the text in red if less than 10% is remaining. You'll need to
change the ./ in cb_function to /var/log/tracker since I forgot to change
that and I'm lazy :).

2008/10/1 Linus Torvalds <torvalds@linux-foundation.org>:
>
> Ok, this is ridiculous, and has nothing to do with git apart from being
> hosted in it, but I thought I'd send out an email about it since the git
> community is the only one I know that does any GUI work at all...
>
> I've got three girls, all wasting their time on their computer, and we set
> up this rule that they get to have a maximum of an hour of internet time
> each day. Of course, being the geek I am, I wrote a stupid time tracker
> for that purpose, and then totally forgot about it.
>
> Until the harddisk in their computer broke down, and I had to re-install,
> and realized that I didn't have a copy of my stupid tracker sources
> anywhere. So I had to re-write it, and to make sure that I didn't lose it
> _again_, I put it in a git repo this time, and now have it on my desktop
> machine.
>
> I _also_ have it on kernel.org, because I tend to change machines often
> enough that files get lost because I decide that switching machines is
> also a great way of doing "generational GC" on my home directory.
>
> [ iow, I copy my old home directory as "old-home" when I switch machines,
>  and anything I didn't end up copying by the time I switch machines
>  again, just gets deleted. Very neat, and a great way to lose things that
>  you only care about every other year or so. ]
>
> Whatever.
>
> To make a long story short, I have a very small program that does all the
> tracking, and I have no problems with that. It doesn't have much of a
> admin interface, but I can do "echo 3600 > /var/log/tracker/celeste" to
> reset the time etc. _I_ have no need for pretty GUI's.
>
> But I also have a UI that the kids can run to _see_ how much time they
> have left, so that getting thrown off the machine doesn't come as a total
> surprise. And yesterday Patricia asked why it has to be that ugly. And I
> had to admit that her dad is just not very good at UI's - and my
> re-implementation may in fact have been EVEN UGLIER than my original
> version. If that is even possible.
>
> But hey, I'm not above impressing my kids with pretty bling if I can get
> somebody else who actually knows what they are doing to enhance my wish
> scripts to something reasonable.
>
> Anybody?
>
> The repository is at
>
>        git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/tracker.git
>
> if somebody knows how to make the text turn red when the end is near
> and/or make it have some nice graphical bar that fills up as time is about
> to expire.
>
> And if nobody does, no worries. At least I tried. My kids can continue to
> watch ugly/small/monochrome fonts with just a count-down clock.
>
>                        Linus
> --
> 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
>



-- 
Mikael Magnusson

^ permalink raw reply

* [PATCH] git commit: Repaint the output format bikeshed (again)
From: Andreas Ericsson @ 2008-10-01 21:06 UTC (permalink / raw)
  To: Shawn Pearce, Git Mailing List, Jeff King
In-Reply-To: <20081001154425.GE21310@spearce.org>

Since we want the most important information furthest
left while at the same time preserving valuable screen
estate, we move the branch-name to the leftmost side
of the commit result output. To make it read properly
we get rid of "Created", which I just can't fit into
a sentence without putting the branch-name last.

Having taken inspiration from the "git reset" command,
output for the three conceivable cases now look thus:

  normal commit
  <branch> is now at b930c4a (i386: Snib the sprock)

  detached commit
  DETACHED HEAD is now at b930c4a (i386: Snib the sprock)

  initial commit
  History has begun anew. Root-commit created.
  <branch> is now at bc930c4a (i386: Snib the sprock)

As a nice side-effect, we can get rid of the get_commit_format
helper function and thereby remove more code than we add.

This is a substantial rewrite of a patch originally sent by
Jeff King <peff@peff.net>.

Signed-off-by: Andreas Ericsson <ae@op5.se>
---

"Created" is a problem when one wants to put branch-name before the
subject line, because the subject has to follow the hash (it doesn't
describe the pre-state of the branch/detached head), but the newly
added commit. "Created, on branch, hash (subject)" just looks
stilted and stupid, so I had to change it. Hopefully this can be
accepted. If not, count me out.

I'm not sure if the last "else" case setting branch = head; can
ever happen, but I figured it can't hurt to make sure. Feel free
to modify commentary around it or the entire section when applying.

This is based on current next (798a2a426a).

 builtin-commit.c |   47 ++++++++++++++++++-----------------------------
 1 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index e4e1448..3b43344 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -878,35 +878,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 	return commitable ? 0 : 1;
 }
 
-static char *get_commit_format_string(void)
-{
-	unsigned char sha[20];
-	const char *head = resolve_ref("HEAD", sha, 0, NULL);
-	struct strbuf buf = STRBUF_INIT;
-
-	/* use shouty-caps if we're on detached HEAD */
-	strbuf_addf(&buf, "format:%s", strcmp("HEAD", head) ? "" : "DETACHED commit");
-	strbuf_addstr(&buf, "%h (%s)");
-
-	if (!prefixcmp(head, "refs/heads/")) {
-		const char *cp;
-		strbuf_addstr(&buf, " on ");
-		for (cp = head + 11; *cp; cp++) {
-			if (*cp == '%')
-				strbuf_addstr(&buf, "%x25");
-			else
-				strbuf_addch(&buf, *cp);
-		}
-	}
-
-	return strbuf_detach(&buf, NULL);
-}
-
 static void print_summary(const char *prefix, const unsigned char *sha1)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	char *format = get_commit_format_string();
+	unsigned char head_sha1[20];
+	const char *branch, *head, *format = "format:%h (%s)";
 
 	commit = lookup_commit(sha1);
 	if (!commit)
@@ -931,15 +908,27 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 	rev.diffopt.break_opt = 0;
 	diff_setup_done(&rev.diffopt);
 
-	printf("Created %s", initial_commit ? "root-commit " : "");
+	/* a pretty rare occurrance, so let's celebrate it specially */
+	if (initial_commit)
+		printf("History has begun anew. Root-commit created.\n");
+
+	head = resolve_ref("HEAD", head_sha1, 0, NULL);
+	if (!strcmp(head, "HEAD"))
+		branch = "DETACHED HEAD";
+	else if (!prefixcmp(head, "refs/heads/"))
+		branch = &head[strlen("refs/heads/")];
+	else {
+		/* refs/git-svn, fe */
+		branch = head;
+	}
+
+	printf("%s is now at ", branch);
 
 	if (!log_tree_commit(&rev, commit)) {
 		struct strbuf buf = STRBUF_INIT;
 		format_commit_message(commit, format + 7, &buf, DATE_NORMAL);
-		printf("%s\n", buf.buf);
-		strbuf_release(&buf);
+		printf("%s\n", strbuf_detach(&buf, NULL));
 	}
-	free(format);
 }
 
 static int git_commit_config(const char *k, const char *v, void *cb)
-- 
1.6.0.2.529.g37dbc.dirty

^ permalink raw reply related

* [PATCH] GUI: Add a progressbar to visualize the time that is left
From: Björn Steinbrink @ 2008-10-01 21:09 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org>

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
---
OK, this bar doesn't fill up as you requested, but instead gets empty,
that's just how I feel it should be ;-)

Might require Tcl/Tk 8.5...

 tracker-ui.tcl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tracker-ui.tcl b/tracker-ui.tcl
index 16d00d7..5314c57 100755
--- a/tracker-ui.tcl
+++ b/tracker-ui.tcl
@@ -8,6 +8,7 @@ proc every {ms body} {
 set user $env(USER)
 
 pack [label .tracker -textvariable time]
+pack [ttk::progressbar .bar]
 
 every 1000 {
 	global user
@@ -17,4 +18,9 @@ every 1000 {
 	gets $f l3
 	close $f
 	set ::time "$l3"
+	set times [split "$l1" " "]
+	set max [lindex $times 0]
+	set cur [lindex $times 1]
+	set left [expr $max - $cur]
+	.bar configure -max $max -value $left
 }
-- 
1.6.0.2.307.gc427

^ permalink raw reply related

* Re: interactive rebase not rebasing
From: Andreas Ericsson @ 2008-10-01 21:26 UTC (permalink / raw)
  To: Stephen Haberman; +Cc: git
In-Reply-To: <20081001121321.5761fc7e.stephen@exigencecorp.com>

Stephen Haberman wrote:
>>> I've attempted to do that. Now that I sent in the patch, if you could
>>> review it, I would appreciate your feedback.
>> I'm heading home from work now. I'll look it over tonight or tomorrow
>> morning.
> 
> Cool, thanks.
> 
> Question: how taboo is it to just add another test file?
> 

Not so taboo. Especially not if there are compelling technical reasons
not to add stuff to an existing one.

> I'm attempting to integrate my test into t3404, which is the existing
> interactive rebase test. The two test_expect_success's I added worked
> when I ran them at the start of the test and then reset --hard the
> branches back for the other tests, but if I paste my tests where they
> should probably be, in the middle after the other -p tests, they break
> because the 10 or tests before this have screwed with the DAG already.
> 

Where you add the tests doesn't matter much. Many tests are grouped by
feature simply because they were added along with the feature they're
testing. There's no other value of grouping tests together.

> I can suffer through getting it to work, but a t3409 would be much
> easier, and probably easier to read as well as a I could setup my own
> DAG instead of hacking onto 3404s.
> 

t3409 is already in spearce.git's next branch. You should be able to
add stuff to that, or add t3410 if that doesn't work so good.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply

* corrupted repository?
From: Francois Pepin @ 2008-10-01 21:29 UTC (permalink / raw)
  To: git

Hi,

The repository on my OS X machine (10.5.5) seems to have been suddenly 
become corrupted in a strange way.

Everything seems to be working properly there (git fsck --full returns 
normally with no output), but I cannot clone or pull from my other machines:

(iduna is the name of the OS X machine)
[francois@monch ~]$ git clone iduna:git iduna2
Initialized empty Git repository in /bioinfo/home/francois/iduna2/.git/
Password:
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption 
on the remote side.
remote: fatal: exec pack-objects failed.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed

I have the same issue from the same machine:
[francois@Iduna ~]$ git clone localhost:git git2
Initialized empty Git repository in /Users/francois/git2/.git/
remote: fatal: exec pack-objects failed.
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption 
on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed

But not if I just do it locally:
[francois@Iduna ~]$ git clone git git2
Initialized empty Git repository in /Users/francois/git2/.git/
Checking out files:   2% (140/5273)
[I cancelled it at this point]

I am running git 1.6.0.2 on the mac, and have only recently updated it 
so that might have a role to play.

Any suggestion would be welcome to fix this issue, and I'll be more than 
happy to provide whatever more information could useful.

Francois

^ permalink raw reply

* Re: [PATCH] git commit: Repaint the output format bikeshed (again)
From: Jeff King @ 2008-10-01 22:06 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Shawn Pearce, Git Mailing List
In-Reply-To: <48E3E66E.7020501@op5.se>

On Wed, Oct 01, 2008 at 11:06:54PM +0200, Andreas Ericsson wrote:

> of the commit result output. To make it read properly
> we get rid of "Created", which I just can't fit into
> a sentence without putting the branch-name last.

All of the other proposals indicate the hash and subject as the object
of creation. IOW, "created: <hash>: subject" or similar.

> Having taken inspiration from the "git reset" command,
> output for the three conceivable cases now look thus:
>
>  normal commit
>  <branch> is now at b930c4a (i386: Snib the sprock)

I think I still like your other proposal:

  [branch] created b930c4a: "i386: Snib the sprock"

better. But in the interests of just agreeing on something, I am willing
to accept this. FWIW, the git-reset command doesn't use any delimiter
for the message:

   <branch> is now at <hash> <subject>

So perhaps they should be the same. I don't think it overly matters.

>  detached commit
>  DETACHED HEAD is now at b930c4a (i386: Snib the sprock)

You mentioned the shouty caps before. I think "detached HEAD" is
probably caps enough, but not enough to argue for it (I just want to
mention as an informal vote if Shawn wants to mark it up while
applying).

>  initial commit
>  History has begun anew. Root-commit created.
>  <branch> is now at bc930c4a (i386: Snib the sprock)

Heh.

> "Created" is a problem when one wants to put branch-name before the
> subject line, because the subject has to follow the hash (it doesn't
> describe the pre-state of the branch/detached head), but the newly
> added commit. "Created, on branch, hash (subject)" just looks
> stilted and stupid, so I had to change it. Hopefully this can be
> accepted. If not, count me out.

That was the reason for the helper function that was deleted. It
actually created a format string like "Created %h on <branch>: %s" and
properly escaped the percents in <branch>. So you would have to keep it
if you wanted to interleave the data (but I think what you have is
better -- the branch name or the detached status is the thing that
should be first).

> I'm not sure if the last "else" case setting branch = head; can
> ever happen, but I figured it can't hurt to make sure. Feel free
> to modify commentary around it or the entire section when applying.

It should definitely be there, if only for the sanity of future
expansion (and because I can technically put whatever ref I want into
HEAD :) ).

> -		printf("%s\n", buf.buf);
> -		strbuf_release(&buf);
> +		printf("%s\n", strbuf_detach(&buf, NULL));

This change is bogus. "release" frees a strbuf. "detach" says "Give me
the buffer, and I will take care of freeing it later myself". So you
introduced a leak.

-Peff

^ permalink raw reply

* Re: [PATCH] git commit: Repaint the output format bikeshed (again)
From: Jeff King @ 2008-10-01 22:31 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Shawn Pearce, Git Mailing List
In-Reply-To: <20081001220604.GB18058@coredump.intra.peff.net>

On Wed, Oct 01, 2008 at 06:06:04PM -0400, Jeff King wrote:

> I think I still like your other proposal:
> 
>   [branch] created b930c4a: "i386: Snib the sprock"

And here is the patch, since it was sitting uncommitted in my working
tree. Feel free to ignore.

BTW, we should apply _something_ since what is currently in next has a
bug: it lacks a space between "DETACHED commit" and the hash:

  Created DETACHED commit4fde0d0 (subject line)

-- >8 --
reformat informational commit message

When committing, we print a message like:

  Created [DETACHED commit] <hash> (<subject>) on <branch>

The most useful bit of information there (besides the
detached status, if it is present) is which branch you made
the commit on. However,  it is sometimes hard to see because
the subject dominates the line.

Instead, let's put the most useful information (detached
status and commit branch) on the far left, with the subject
(which is least likely to be interesting) on the far right.

We'll use brackets to offset the branch name so the line is
not mistaken for an error line of the form "program: some
sort of error". E.g.,:

  [jk/bikeshed] created bd8098f: "reformat informational commit message"
---
 builtin-commit.c |   37 ++++++++++---------------------------
 1 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index e4e1448..7a66e5a 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -878,35 +878,13 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 	return commitable ? 0 : 1;
 }
 
-static char *get_commit_format_string(void)
-{
-	unsigned char sha[20];
-	const char *head = resolve_ref("HEAD", sha, 0, NULL);
-	struct strbuf buf = STRBUF_INIT;
-
-	/* use shouty-caps if we're on detached HEAD */
-	strbuf_addf(&buf, "format:%s", strcmp("HEAD", head) ? "" : "DETACHED commit");
-	strbuf_addstr(&buf, "%h (%s)");
-
-	if (!prefixcmp(head, "refs/heads/")) {
-		const char *cp;
-		strbuf_addstr(&buf, " on ");
-		for (cp = head + 11; *cp; cp++) {
-			if (*cp == '%')
-				strbuf_addstr(&buf, "%x25");
-			else
-				strbuf_addch(&buf, *cp);
-		}
-	}
-
-	return strbuf_detach(&buf, NULL);
-}
-
 static void print_summary(const char *prefix, const unsigned char *sha1)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	char *format = get_commit_format_string();
+	static const char *format = "format:%h: \"%s\"";
+	unsigned char junk_sha1[20];
+	const char *head = resolve_ref("HEAD", junk_sha1, 0, NULL);
 
 	commit = lookup_commit(sha1);
 	if (!commit)
@@ -931,7 +909,13 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 	rev.diffopt.break_opt = 0;
 	diff_setup_done(&rev.diffopt);
 
-	printf("Created %s", initial_commit ? "root-commit " : "");
+	printf("[%s%s]: created ",
+		!prefixcmp(head, "refs/heads/") ?
+			head + 11 :
+			!strcmp(head, "HEAD") ?
+				"detached HEAD" :
+				head,
+		initial_commit ? " (root-commit)" : "");
 
 	if (!log_tree_commit(&rev, commit)) {
 		struct strbuf buf = STRBUF_INIT;
@@ -939,7 +923,6 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 		printf("%s\n", buf.buf);
 		strbuf_release(&buf);
 	}
-	free(format);
 }
 
 static int git_commit_config(const char *k, const char *v, void *cb)
-- 
1.6.0.2.570.g2c958

^ permalink raw reply related

* Re: Help with a tcl/tk gui thing..
From: Linus Torvalds @ 2008-10-01 23:06 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Git Mailing List
In-Reply-To: <237967ef0810011403i2b18255and988df29a71798bf@mail.gmail.com>



On Wed, 1 Oct 2008, Mikael Magnusson wrote:
> 
> git clone git://mika.l3ib.org/tracker.git
> 
> I wrote it in pygtk since I know zero to no tcl/tk, hope that's okay.
> It has a label with the time remaining (simply read from the daemon file),
> and shows the text in red if less than 10% is remaining. You'll need to
> change the ./ in cb_function to /var/log/tracker since I forgot to change
> that and I'm lazy :).

Well, it doesn't do anything at all for me except change the cursor to a 
cross, and if I'm a n00b with tcl/tk, I'm even more of one with pygtk.

I merged the two other suggestions, though. And am open to seeing that 
pygtk thing too as an alternative, but only if it actually works for me ;)

		Linus

^ permalink raw reply

* Re: [PATCH] Make maximum surf time really per day
From: Linus Torvalds @ 2008-10-01 23:09 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Git Mailing List
In-Reply-To: <alpine.DEB.1.00.0810012239030.22125@pacific.mpi-cbg.de.mpi-cbg.de>



On Wed, 1 Oct 2008, Johannes Schindelin wrote:
> 
> Earlier, when the maximum time was reached, we would block for 8 hours.
> The program description suggested that the maximum time should be per
> day instead, however.  So rather check that.

I actually prefer the old behavior. Your new one has a "flag time" when 
you get all your time back, and it's not even something logical like 
midnight, it is (if I read the patch right), "midnight UTC" that will do 
it.

So the "you have to be offline for at least 8 hours" thing is actually 
something that even my old tracker worked with, and at least with my kids, 
there is no worry that they'd wake up early just to do it both before 
_and_ after school ;)

		Linus

^ permalink raw reply

* [PATCH] Solaris: Use OLD_ICONV to avoid compile warnings
From: David Soria Parra @ 2008-10-02  0:08 UTC (permalink / raw)
  To: git; +Cc: David Soria Parra

From: David Soria Parra <dsp@php.net>

Solaris systems use the old styled iconv(3) call and therefore
the OLD_ICONV variable should be set. Otherwise we get annoying compile
warnings.

Signed-off-by: David Soria Parra <dsp@php.net>
---
 Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 7db2ccc..3abbb4e 100644
--- a/Makefile
+++ b/Makefile
@@ -649,6 +649,7 @@ ifeq ($(uname_S),SunOS)
 	NO_MEMMEM = YesPlease
 	NO_HSTRERROR = YesPlease
 	NO_MKDTEMP = YesPlease
+	OLD_ICONV = UnfortunatelyYes
 	ifeq ($(uname_R),5.8)
 		NEEDS_LIBICONV = YesPlease
 		NO_UNSETENV = YesPlease
-- 
1.6.0.2.569.g798a2a

^ permalink raw reply related


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