Git development
 help / color / mirror / Atom feed
* Re: [ANNOUNCE] tig-0.13
From: Ted Pavlic @ 2009-01-14 16:33 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git
In-Reply-To: <20090113233643.GA28898@diku.dk>

Thanks for this. It's a nice tool.

> What is tig?
> ------------
> Tig is an ncurses-based text-mode interface for git. It functions mainly
> as a git repository browser, but can also assist in staging changes for
> commit at chunk level and act as a pager for output from various git
> commands.
>
>   - Homepage:	http://jonas.nitro.dk/tig/
>   - Manual:	http://jonas.nitro.dk/tig/manual.html
>   - Tarballs:	http://jonas.nitro.dk/tig/releases/
>   - Git URL:	git://repo.or.cz/tig.git
>   - Gitweb:	http://repo.or.cz/w/tig.git

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

^ permalink raw reply

* Re: [BUG] assertion failure in builtin-mv.c with "git mv -k"
From: Jeff King @ 2009-01-14 16:47 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Johannes Schindelin, Matthieu Moy, git
In-Reply-To: <496E0D1C.20807@drmicha.warpmail.net>

On Wed, Jan 14, 2009 at 05:04:44PM +0100, Michael J Gruber wrote:

> It was a lame attempt at getting around it, it's just one line... I
> didn't know I've been being noticed long enough ;)
> So, should I prepare a series like:
> 
> 1: test case and mark known fail
> 2: the 1 line fix
> 3: mark test pass
> 
> Or should 2+3 be squashed into one?

Definitely the fix and marking the test as passing should be one patch,
since then you see that it is the fix which causes the test to pass. But
really, for a simple fix I usually just squash it all into a single
patch. Then somebody looking at the patch later says "Oh, this is what
was broken, and here is how it was fixed."

-Peff

^ permalink raw reply

* Re: [PATCH 3/3] implement pattern matching in ce_path_match
From: Jeff King @ 2009-01-14 16:53 UTC (permalink / raw)
  To: Samuel Tardieu
  Cc: Johannes Schindelin, Clemens Buchacher, git, Junio C Hamano,
	johannes
In-Reply-To: <2009-01-14-17-18-40+trackit+sam@rfc1149.net>

On Wed, Jan 14, 2009 at 05:18:39PM +0100, Samuel Tardieu wrote:

> My taste would favor:
> 
>   static int has_special(const char *p)
>   {
>     for (; *p; p++)
>       if (isspecial(*p))
>         return 1;
>     return 0;
>   }

That was my first thought upon reading the other two, as well. And I
agree with all of the reasoning you gave.

-Peff

^ permalink raw reply

* Re: Commit messages
From: Ted Pavlic @ 2009-01-14 16:55 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: git
In-Reply-To: <8763kjt0mw.fsf_-_@iki.fi>

That rule could be modified to support .stgit-edit.txt as well.

> (add-to-list 'auto-mode-alist
>               '("/\\.git/\\(COMMIT\\|TAG\\)_EDITMSG\\'" .
>                 vcs-message-mode))

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

^ permalink raw reply

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Jeff King @ 2009-01-14 16:56 UTC (permalink / raw)
  To: Tor Arne Vestbø; +Cc: Johannes Schindelin, Junio C Hamano, git
In-Reply-To: <496E129B.3020502@trolltech.com>

On Wed, Jan 14, 2009 at 05:28:11PM +0100, Tor Arne Vestbø wrote:

> +MSG=${MSG//%/}
> +printf "$MSG" > "$1"
> +printf "$MSG" >& 2

Substitution parameter expansion is a bash-ism, IIRC. How about just

  printf %s "$MSG" ?

-Peff

^ permalink raw reply

* [PATCH v2 0/3] Add test cases for "git mv -k" and fix a known breakage.
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin
In-Reply-To: <alpine.DEB.1.00.0901141653540.3586@pacific.mpi-cbg.de>

This adds test cases for the "-k" option of "git mv", including one
known breakage reported by Matthieu Moy <Matthieu.Moy@imag.fr> which
appears when multiple untracked files are specified as consecutive
arguments. This breakage is fixed in the second patch and marked
"expect_pass" in the last one.

The cumulative code/other ratio is 1 line/27 lines which I blame solely
on Dscho ;) Seriously, feel free to squash. But on the other hand: How
else can I see the beautiful "1 known breakage fixed" other than by
having 2 and 3 separate in this series...

The patch is off master but builtin-mv.c hasn't changed since 
81dc2307d0ad87a4da2e753a9d1b5586d6456eed tags/v1.6.0-rc1~1, so I suggest
this patch for maint.

Michael J Gruber (3):
  add test cases for "git mv -k"
  fix handling of multiple untracked files for git mv -k
  mark fixed breakage as expect pass for "git mv -k" multiple files

 builtin-mv.c  |    1 +
 t/t7001-mv.sh |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

^ permalink raw reply

* [PATCH v2 2/3] fix handling of multiple untracked files for git mv -k
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin
In-Reply-To: <1231952603-32527-2-git-send-email-git@drmicha.warpmail.net>

The "-k" option to "git mv" should allow specifying multiple untracked
files. Currently, multiple untracked files raise an assertion if they
appear consecutively as arguments. Fix this by decrementing the loop
index after removing one entry from the array of arguments.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 builtin-mv.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin-mv.c b/builtin-mv.c
index 4f65b5a..bce9959 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -192,6 +192,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 					memmove(destination + i,
 						destination + i + 1,
 						(argc - i) * sizeof(char *));
+					i--;
 				}
 			} else
 				die ("%s, source=%s, destination=%s",
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH v2 1/3] add test cases for "git mv -k"
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin
In-Reply-To: <1231952603-32527-1-git-send-email-git@drmicha.warpmail.net>

Add test cases for ignoring nonexisting and untracked files using the -k
option to "git mv". There is one known breakage related to multiple
untracked files specfied as consecutive arguments.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7001-mv.sh |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 575ef5b..5c1485d 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -39,6 +39,31 @@ test_expect_success \
     grep "^R100..*path1/COPYING..*path0/COPYING"'
 
 test_expect_success \
+    'checking -k on non-existing file' \
+    'git mv -k idontexist path0'
+
+test_expect_success \
+    'checking -k on untracked file' \
+    'touch untracked1 &&
+     git mv -k untracked1 path0 &&
+     test -f untracked1 &&
+     test ! -f path0/untracked1'
+
+test_expect_failure \
+    'checking -k on multiple untracked files' \
+    'touch untracked2 &&
+     git mv -k untracked1 untracked2 path0 &&
+     test -f untracked1 &&
+     test -f untracked2 &&
+     test ! -f path0/untracked1
+     test ! -f path0/untracked2'
+
+# clean up the mess in case bad things happen
+rm -f idontexist untracked1 untracked2 \
+     path0/idontexist path0/untracked1 path0/untracked2 \
+     .git/index.lock
+
+test_expect_success \
     'adding another file' \
     'cp "$TEST_DIRECTORY"/../README path0/README &&
      git add path0/README &&
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH v2 3/3] mark fixed breakage as expect pass for "git mv -k" multiple files
From: Michael J Gruber @ 2009-01-14 17:03 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin
In-Reply-To: <1231952603-32527-3-git-send-email-git@drmicha.warpmail.net>

The new tests pass now so mark them as such.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7001-mv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 5c1485d..ef2e78f 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -49,7 +49,7 @@ test_expect_success \
      test -f untracked1 &&
      test ! -f path0/untracked1'
 
-test_expect_failure \
+test_expect_success \
     'checking -k on multiple untracked files' \
     'touch untracked2 &&
      git mv -k untracked1 untracked2 path0 &&
-- 
1.6.0.6

^ permalink raw reply related

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Boyd Stephen Smith Jr. @ 2009-01-14 17:09 UTC (permalink / raw)
  To: Jeff King; +Cc: Tor Arne Vestbø, git
In-Reply-To: <20090114165633.GC15758@coredump.intra.peff.net>

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

On Wednesday 2009 January 14 10:56:33 Jeff King wrote:
>On Wed, Jan 14, 2009 at 05:28:11PM +0100, Tor Arne Vestbø wrote:
>> +MSG=${MSG//%/}
>> +printf "$MSG" > "$1"
>> +printf "$MSG" >& 2
>
>Substitution parameter expansion is a bash-ism, IIRC. How about just

MSG=$(printf '%s\n' "$MSG" | sed -e 's/%/%%/g')
printf "$MSG" > "$1"
printf "$MSG" >& 2

Is my best attempt at portable and "safe".  It's a few extra processes though.

>  printf %s "$MSG" ?

On my box
$ printf '%s\n' '\n'
\n
$

He wants '\n' in $MSG to be expanded, and what you gave doesn't do that.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Jeff King @ 2009-01-14 17:13 UTC (permalink / raw)
  To: Boyd Stephen Smith Jr.; +Cc: Tor Arne Vestbø, git
In-Reply-To: <200901141109.56580.bss@iguanasuicide.net>

On Wed, Jan 14, 2009 at 11:09:52AM -0600, Boyd Stephen Smith Jr. wrote:

> >  printf %s "$MSG" ?
> 
> On my box
> $ printf '%s\n' '\n'
> \n
> $
> 
> He wants '\n' in $MSG to be expanded, and what you gave doesn't do that.

Oh, sorry. That's what I get for not reading his patch carefully.

It looks like all of the input is statically included in the test
script. While I think it is nice to be defensive, it is probably
simplest to just assume there is no '%' in this case (which we can
verify by reading the script).

-Peff

^ permalink raw reply

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Johannes Sixt @ 2009-01-14 17:14 UTC (permalink / raw)
  To: Jeff King; +Cc: Tor Arne Vestbø, Johannes Schindelin, Junio C Hamano, git
In-Reply-To: <20090114165633.GC15758@coredump.intra.peff.net>

Jeff King schrieb:
> On Wed, Jan 14, 2009 at 05:28:11PM +0100, Tor Arne Vestbø wrote:
> 
>> +MSG=${MSG//%/}
>> +printf "$MSG" > "$1"
>> +printf "$MSG" >& 2
> 
> Substitution parameter expansion is a bash-ism, IIRC. How about just
> 
>   printf %s "$MSG" ?

A the point was that $MSG contains \n, which should be turned int LF. IMO,
the easiest way to achieve this is:

MSG='b3
c3c3c3c3
d3d3d3'

test_expect_success ' ... ' '
   ...
   MSG="$MSG" git notes edit
'

and go back to using echo in the part cited above.

-- Hannes

^ permalink raw reply

* Re: Help! My ISP blocks repo.or.cz. How to push changes? (a solution)
From: Asheesh Laroia @ 2009-01-14 17:18 UTC (permalink / raw)
  To: Jakub Narebski
  Cc: Mike Hommey, Alex Riesen, git, Markus Heidelberg, Luciano Rocha,
	J.H.
In-Reply-To: <200901141455.23935.jnareb@gmail.com>

On Wed, 14 Jan 2009, Jakub Narebski wrote:

> Jakub Narebski wrote:
>
>> The ISP I use (Telekomunikacja Polska S.A., aka TP) made some
>> unannounced changes for ADSL service (Neostrada) which made it block
>> repo.or.cz (and of course its aliases, including git.or.cz where git
>> wiki resides).
>
> Thank you all for your help with arriving at solution. I'll describe it
> below; perhaps it would help somebody else (now that it is in mailing
> list archive).

I'll just add some comments that explain what I suggested with a little 
more clarity. I'm not saying you have to use it or anything, I just want 
to make sure I was clear!

And I'm glad you have a solution!

> First, let me explain what I am working with:
>
> I have access to shell account with set up SSH key access; let's name
> this machine host.example.com. I don't have admin rights there, and
> quota is quite tight; I have installed netcat (nc) in ~/bin - it is
> only 22 kB.

Yes, that is great!

> I don't know where to find SOCKS5 proxy, and I don't have 'tsocks' 
> installed either on my computer, or on shell account... I think.

tsocks is packaged in Debian, and surely in other distributions as well. 
You don't run it on the shell account, but on your own workstation (which 
I call "laptop" below for clarity).

A SOCKS5 proxy can be generated by ssh by running:

 	[user@laptop] $ ssh -D 1080 shelluser@shellbox

Now:
 	[user@laptop] $ telnet localhost 1080

will demonstrate that local port 1080 is listening. Because you created it 
with -D to ssh, that local port 1080 *is* a SOCKS5 proxy, created by the 
local SSH client.

> Now, solutions:
>
> 1. For reading gitweb at repo.or.cz, and for reading and editing git
>   wiki at http://git.or.cz/gitwiki/ I use one of free HTTP proxies:
>   http://www.4proxy.de (first such proxy I have found that has an
>   option to _not_ obfuscate URLs; it still unnecessary escapes some
>   things like '/' in the query argument).

Great! (Though note that configuring the web browser to use your 
SSH-created SOCKS5 proxy would let you avoid this escaping since the whole 
system would be under your control.)

> 2. For pushing changes to repo.or.cz I use SSH tunnel (I could have
>   used ProxyCommand solution with netcat instead[1]). I run:
>
>   $ autossh -M 2000 -f -N -L 2222:repo.or.cz:22 jnareb@host.example.com
>
>   at startup, and I have set the following in ~/.ssh/config:
>
>   # TP S.A. blocks repo.or.cz
>   Host repo.or.cz
>   	#ssh -f -N -L 2222:repo.or.cz:22 host.example.com
>   	NoHostAuthenticationForLocalhost yes
>   	HostName localhost
>   	Port 2222
>
>   [1] Alternate solution:
>
>   # TP S.A. blocks repo.or.cz
>   Host repo.or.cz
> 	ProxyCommand ssh host.example.com exec /home/jnareb/bin/nc %h %p

Right-o.

> 3. For fetching changes via git:// protocol from repo.or.cz I use the
>   following setup in git config:
>
>   [core]
>   	gitProxy = ssh-proxy for "repo.or.cz"
>
>   Unfortunately example from Documentation/config.txt with "ssh" as
>   git proxy command doesn't work, and neither putting command with
>   options (e.g. "ssh host.example.com /home/jnareb/bin/nc") doesn't
>   work: the command is _not_ split on whitespace. So I had to use
>   helper script ~/bin/ssh-proxy:
>
>   #!/bin/sh
>
>   ssh host.example.com /home/jnareb/bin/nc "$1" "$2"

Great!

> I hope that would help somebody... and if somebody notices better 
> solution, hs/she would provide me with it :-)

(-:

-- Asheesh.

-- 
A visit to a fresh place will bring strange work.

^ permalink raw reply

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Jeff King @ 2009-01-14 17:19 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Tor Arne Vestbø, Johannes Schindelin, Junio C Hamano, git
In-Reply-To: <496E1D77.6000307@viscovery.net>

On Wed, Jan 14, 2009 at 06:14:31PM +0100, Johannes Sixt wrote:

> A the point was that $MSG contains \n, which should be turned int LF. IMO,
> the easiest way to achieve this is:
> 
> MSG='b3
> c3c3c3c3
> d3d3d3'
> 
> test_expect_success ' ... ' '
>    ...
>    MSG="$MSG" git notes edit
> '
> 
> and go back to using echo in the part cited above.

Yes, sorry, I hadn't read his original patch carefully. I think that is
a sane solution.

-Peff

^ permalink raw reply

* [PATCH take 3 0/4] color-words improvements
From: Johannes Schindelin @ 2009-01-14 17:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <7vprisj26i.fsf@gitster.siamese.dyndns.org>


This series is getting bigger and bigger, unfortunately, just what I tried
to avoid.

But at least I am pretty comfortable with the readability of the result,
and it adds tests -- finally.

Changes relative to the last round: color_fwrite_lines() had problems with
empty lines, and find_word_boundary() was replaced by find_word_boundaries(),
which finds not only the end of the next word, but the start, too.

The only "funny" thing I realized is that the lines which are output
by emit_line() add a RESET at the end of the line, and I do not do that
in color_fwrite_lines().

Can anybody think of undesired behavior as a consequence?

Johannes Schindelin (4):
  Add color_fwrite_lines(), a function coloring each line individually
  color-words: refactor word splitting and use ALLOC_GROW()
  color-words: change algorithm to allow for 0-character word
    boundaries
  color-words: take an optional regular expression describing words

 Documentation/diff-options.txt |    6 +-
 color.c                        |   28 ++++++
 color.h                        |    1 +
 diff.c                         |  203 ++++++++++++++++++++++++++--------------
 diff.h                         |    1 +
 t/t4034-diff-words.sh          |   86 +++++++++++++++++
 6 files changed, 253 insertions(+), 72 deletions(-)
 create mode 100755 t/t4034-diff-words.sh

^ permalink raw reply

* [PATCH 1/4] Add color_fwrite_lines(), a function coloring each line individually
From: Johannes Schindelin @ 2009-01-14 17:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901141840100.3586@pacific.mpi-cbg.de>


We have to set the color before every line and reset it before every
newline.  Add a function color_fwrite_lines() which does that for us.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 color.c |   28 ++++++++++++++++++++++++++++
 color.h |    1 +
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/color.c b/color.c
index fc0b72a..d4ae83f 100644
--- a/color.c
+++ b/color.c
@@ -191,3 +191,31 @@ int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...)
 	va_end(args);
 	return r;
 }
+
+/*
+ * This function splits the buffer by newlines and colors the lines individually.
+ *
+ * Returns 0 on success.
+ */
+int color_fwrite_lines(FILE *fp, const char *color,
+		size_t count, const char *buf)
+{
+	if (!*color)
+		return fwrite(buf, count, 1, fp) != 1;
+	while (count) {
+		char *p = memchr(buf, '\n', count);
+		if (p != buf && (fputs(color, fp) < 0 ||
+				fwrite(buf, p ? p - buf : count, 1, fp) != 1 ||
+				fputs(COLOR_RESET, fp) < 0))
+			return -1;
+		if (!p)
+			return 0;
+		if (fputc('\n', fp) < 0)
+			return -1;
+		count -= p + 1 - buf;
+		buf = p + 1;
+	}
+	return 0;
+}
+
+
diff --git a/color.h b/color.h
index 6cf5c88..cd5c985 100644
--- a/color.h
+++ b/color.h
@@ -19,5 +19,6 @@ int git_config_colorbool(const char *var, const char *value, int stdout_is_tty);
 void color_parse(const char *var, const char *value, char *dst);
 int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
 int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
+int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
 
 #endif /* COLOR_H */
-- 
1.6.1.243.g4c9c5a

^ permalink raw reply related

* [PATCH 2/4] color-words: refactor word splitting and use ALLOC_GROW()
From: Johannes Schindelin @ 2009-01-14 17:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901141840100.3586@pacific.mpi-cbg.de>


Word splitting is now performed by the function diff_words_fill(),
avoiding having the same code twice.

In the same spirit, avoid duplicating the code of ALLOC_GROW().

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

	This has not changed, actually.  Just for your convenience.

 diff.c |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/diff.c b/diff.c
index f67e0b2..6d87ea5 100644
--- a/diff.c
+++ b/diff.c
@@ -326,10 +326,7 @@ struct diff_words_buffer {
 static void diff_words_append(char *line, unsigned long len,
 		struct diff_words_buffer *buffer)
 {
-	if (buffer->text.size + len > buffer->alloc) {
-		buffer->alloc = (buffer->text.size + len) * 3 / 2;
-		buffer->text.ptr = xrealloc(buffer->text.ptr, buffer->alloc);
-	}
+	ALLOC_GROW(buffer->text.ptr, buffer->text.size + len, buffer->alloc);
 	line++;
 	len--;
 	memcpy(buffer->text.ptr + buffer->text.size, line, len);
@@ -398,6 +395,22 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
 	}
 }
 
+/*
+ * This function splits the words in buffer->text, and stores the list with
+ * newline separator into out.
+ */
+static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out)
+{
+	int i;
+	out->size = buffer->text.size;
+	out->ptr = xmalloc(out->size);
+	memcpy(out->ptr, buffer->text.ptr, out->size);
+	for (i = 0; i < out->size; i++)
+		if (isspace(out->ptr[i]))
+			out->ptr[i] = '\n';
+	buffer->current = 0;
+}
+
 /* this executes the word diff on the accumulated buffers */
 static void diff_words_show(struct diff_words_data *diff_words)
 {
@@ -405,26 +418,11 @@ static void diff_words_show(struct diff_words_data *diff_words)
 	xdemitconf_t xecfg;
 	xdemitcb_t ecb;
 	mmfile_t minus, plus;
-	int i;
 
 	memset(&xpp, 0, sizeof(xpp));
 	memset(&xecfg, 0, sizeof(xecfg));
-	minus.size = diff_words->minus.text.size;
-	minus.ptr = xmalloc(minus.size);
-	memcpy(minus.ptr, diff_words->minus.text.ptr, minus.size);
-	for (i = 0; i < minus.size; i++)
-		if (isspace(minus.ptr[i]))
-			minus.ptr[i] = '\n';
-	diff_words->minus.current = 0;
-
-	plus.size = diff_words->plus.text.size;
-	plus.ptr = xmalloc(plus.size);
-	memcpy(plus.ptr, diff_words->plus.text.ptr, plus.size);
-	for (i = 0; i < plus.size; i++)
-		if (isspace(plus.ptr[i]))
-			plus.ptr[i] = '\n';
-	diff_words->plus.current = 0;
-
+	diff_words_fill(&diff_words->minus, &minus);
+	diff_words_fill(&diff_words->plus, &plus);
 	xpp.flags = XDF_NEED_MINIMAL;
 	xecfg.ctxlen = diff_words->minus.alloc + diff_words->plus.alloc;
 	xdi_diff_outf(&minus, &plus, fn_out_diff_words_aux, diff_words,
-- 
1.6.1.243.g4c9c5a

^ permalink raw reply related

* [PATCH 3/4] color-words: change algorithm to allow for 0-character word boundaries
From: Johannes Schindelin @ 2009-01-14 17:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901141840100.3586@pacific.mpi-cbg.de>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 8793 bytes --]


Up until now, the color-words code assumed that word boundaries are
identical to white space characters.

Therefore, it could get away with a very simple scheme: it copied the
hunks, substituted newlines for each white space character, called
libxdiff with the processed text, and then identified the text to
output by the offsets (which agreed since the original text had the
same length).

This code was ugly, for a number of reasons:

- it was impossible to introduce 0-character word boundaries,

- we had to print everything word by word, and

- the code needed extra special handling of newlines in the removed part.

Fix all of these issues by processing the text such that

- we build word lists, separated by newlines,

- we remember the original offsets for every word, and

- after calling libxdiff on the wordlists, we parse the hunk headers, and
  find the corresponding offsets, and then

- we print the removed/added parts in one go.

The pre and post samples in the test were provided by Santi Béjar.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 diff.c                |  153 +++++++++++++++++++++++++++----------------------
 t/t4034-diff-words.sh |   62 ++++++++++++++++++++
 2 files changed, 147 insertions(+), 68 deletions(-)
 create mode 100755 t/t4034-diff-words.sh

diff --git a/diff.c b/diff.c
index 6d87ea5..fe8b1f0 100644
--- a/diff.c
+++ b/diff.c
@@ -319,8 +319,10 @@ static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one)
 struct diff_words_buffer {
 	mmfile_t text;
 	long alloc;
-	long current; /* output pointer */
-	int suppressed_newline;
+	struct diff_words_orig {
+		const char *begin, *end;
+	} *orig;
+	int orig_nr, orig_alloc;
 };
 
 static void diff_words_append(char *line, unsigned long len,
@@ -335,80 +337,81 @@ static void diff_words_append(char *line, unsigned long len,
 
 struct diff_words_data {
 	struct diff_words_buffer minus, plus;
+	const char *current_plus;
 	FILE *file;
 };
 
-static void print_word(FILE *file, struct diff_words_buffer *buffer, int len, int color,
-		int suppress_newline)
-{
-	const char *ptr;
-	int eol = 0;
-
-	if (len == 0)
-		return;
-
-	ptr  = buffer->text.ptr + buffer->current;
-	buffer->current += len;
-
-	if (ptr[len - 1] == '\n') {
-		eol = 1;
-		len--;
-	}
-
-	fputs(diff_get_color(1, color), file);
-	fwrite(ptr, len, 1, file);
-	fputs(diff_get_color(1, DIFF_RESET), file);
-
-	if (eol) {
-		if (suppress_newline)
-			buffer->suppressed_newline = 1;
-		else
-			putc('\n', file);
-	}
-}
-
 static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
 {
 	struct diff_words_data *diff_words = priv;
+	int minus_first, minus_len, plus_first, plus_len;
+	const char *minus_begin, *minus_end, *plus_begin, *plus_end;
 
-	if (diff_words->minus.suppressed_newline) {
-		if (line[0] != '+')
-			putc('\n', diff_words->file);
-		diff_words->minus.suppressed_newline = 0;
-	}
+	if (line[0] != '@' || parse_hunk_header(line, len,
+			&minus_first, &minus_len, &plus_first, &plus_len))
+		return;
 
-	len--;
-	switch (line[0]) {
-		case '-':
-			print_word(diff_words->file,
-				   &diff_words->minus, len, DIFF_FILE_OLD, 1);
-			break;
-		case '+':
-			print_word(diff_words->file,
-				   &diff_words->plus, len, DIFF_FILE_NEW, 0);
-			break;
-		case ' ':
-			print_word(diff_words->file,
-				   &diff_words->plus, len, DIFF_PLAIN, 0);
-			diff_words->minus.current += len;
-			break;
-	}
+	minus_begin = diff_words->minus.orig[minus_first].begin;
+	minus_end = minus_len == 0 ? minus_begin :
+		diff_words->minus.orig[minus_first + minus_len - 1].end;
+	plus_begin = diff_words->plus.orig[plus_first].begin;
+	plus_end = plus_len == 0 ? plus_begin :
+		diff_words->plus.orig[plus_first + plus_len - 1].end;
+
+	if (diff_words->current_plus != plus_begin)
+		fwrite(diff_words->current_plus,
+				plus_begin - diff_words->current_plus, 1,
+				diff_words->file);
+	if (minus_begin != minus_end)
+		color_fwrite_lines(diff_words->file,
+				diff_get_color(1, DIFF_FILE_OLD),
+				minus_end - minus_begin, minus_begin);
+	if (plus_begin != plus_end)
+		color_fwrite_lines(diff_words->file,
+				diff_get_color(1, DIFF_FILE_NEW),
+				plus_end - plus_begin, plus_begin);
+
+	diff_words->current_plus = plus_end;
 }
 
 /*
- * This function splits the words in buffer->text, and stores the list with
- * newline separator into out.
+ * This function splits the words in buffer->text, stores the list with
+ * newline separator into out, and saves the offsets of the original words
+ * in buffer->orig.
  */
 static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out)
 {
-	int i;
-	out->size = buffer->text.size;
-	out->ptr = xmalloc(out->size);
-	memcpy(out->ptr, buffer->text.ptr, out->size);
-	for (i = 0; i < out->size; i++)
-		if (isspace(out->ptr[i]))
-			out->ptr[i] = '\n';
-	buffer->current = 0;
+	int i, j;
+
+	out->size = 0;
+	out->ptr = xmalloc(buffer->text.size);
+
+	/* fake an empty "0th" word */
+	ALLOC_GROW(buffer->orig, 1, buffer->orig_alloc);
+	buffer->orig[0].begin = buffer->orig[0].end = buffer->text.ptr;
+	buffer->orig_nr = 1;
+
+	for (i = 0; i < buffer->text.size; i++) {
+		if (isspace(buffer->text.ptr[i]))
+			continue;
+		for (j = i + 1; j < buffer->text.size &&
+				!isspace(buffer->text.ptr[j]); j++)
+			; /* find the end of the word */
+
+		/* store original boundaries */
+		ALLOC_GROW(buffer->orig, buffer->orig_nr + 1,
+				buffer->orig_alloc);
+		buffer->orig[buffer->orig_nr].begin = buffer->text.ptr + i;
+		buffer->orig[buffer->orig_nr].end = buffer->text.ptr + j;
+		buffer->orig_nr++;
+
+		/* store one word */
+		memcpy(out->ptr + out->size, buffer->text.ptr + i, j - i);
+		out->ptr[out->size + j - i] = '\n';
+		out->size += j - i + 1;
+
+		i = j - 1;
+	}
 }
 
 /* this executes the word diff on the accumulated buffers */
@@ -419,22 +422,34 @@ static void diff_words_show(struct diff_words_data *diff_words)
 	xdemitcb_t ecb;
 	mmfile_t minus, plus;
 
+	/* special case: only removal */
+	if (!diff_words->plus.text.size) {
+		color_fwrite_lines(diff_words->file,
+			diff_get_color(1, DIFF_FILE_OLD),
+			diff_words->minus.text.size, diff_words->minus.text.ptr);
+		diff_words->minus.text.size = 0;
+		return;
+	}
+
+	diff_words->current_plus = diff_words->plus.text.ptr;
+
 	memset(&xpp, 0, sizeof(xpp));
 	memset(&xecfg, 0, sizeof(xecfg));
 	diff_words_fill(&diff_words->minus, &minus);
 	diff_words_fill(&diff_words->plus, &plus);
 	xpp.flags = XDF_NEED_MINIMAL;
-	xecfg.ctxlen = diff_words->minus.alloc + diff_words->plus.alloc;
+	xecfg.ctxlen = 0;
 	xdi_diff_outf(&minus, &plus, fn_out_diff_words_aux, diff_words,
 		      &xpp, &xecfg, &ecb);
 	free(minus.ptr);
 	free(plus.ptr);
+	if (diff_words->current_plus != diff_words->plus.text.ptr +
+			diff_words->plus.text.size)
+		fwrite(diff_words->current_plus,
+			diff_words->plus.text.ptr + diff_words->plus.text.size
+			- diff_words->current_plus, 1,
+			diff_words->file);
 	diff_words->minus.text.size = diff_words->plus.text.size = 0;
-
-	if (diff_words->minus.suppressed_newline) {
-		putc('\n', diff_words->file);
-		diff_words->minus.suppressed_newline = 0;
-	}
 }
 
 typedef unsigned long (*sane_truncate_fn)(char *line, unsigned long len);
@@ -458,7 +473,9 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
 			diff_words_show(ecbdata->diff_words);
 
 		free (ecbdata->diff_words->minus.text.ptr);
+		free (ecbdata->diff_words->minus.orig);
 		free (ecbdata->diff_words->plus.text.ptr);
+		free (ecbdata->diff_words->plus.orig);
 		free(ecbdata->diff_words);
 		ecbdata->diff_words = NULL;
 	}
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
new file mode 100755
index 0000000..b032bd3
--- /dev/null
+++ b/t/t4034-diff-words.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+test_description='word diff colors'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+	git config diff.color.old red
+	git config diff.color.new green
+
+'
+
+decrypt_color () {
+	sed \
+		-e 's/.\[1m/<WHITE>/g' \
+		-e 's/.\[31m/<RED>/g' \
+		-e 's/.\[32m/<GREEN>/g' \
+		-e 's/.\[36m/<BROWN>/g' \
+		-e 's/.\[m/<RESET>/g'
+}
+
+cat > pre <<\EOF
+h(4)
+
+a = b + c
+EOF
+
+cat > post <<\EOF
+h(4),hh[44]
+
+a = b + c
+
+aa = a
+
+aeff = aeff * ( aaa )
+EOF
+
+cat > expect <<\EOF
+<WHITE>diff --git a/pre b/post<RESET>
+<WHITE>index 330b04f..5ed8eff 100644<RESET>
+<WHITE>--- a/pre<RESET>
+<WHITE>+++ b/post<RESET>
+<BROWN>@@ -1,3 +1,7 @@<RESET>
+<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
+<RESET>
+a = b + c<RESET>
+
+<GREEN>aa = a<RESET>
+
+<GREEN>aeff = aeff * ( aaa )<RESET>
+EOF
+
+test_expect_success 'word diff with runs of whitespace' '
+
+	test_must_fail git diff --no-index --color-words pre post > output &&
+	decrypt_color < output > output.decrypted &&
+	test_cmp expect output.decrypted
+
+'
+
+test_done
-- 
1.6.1.243.g4c9c5a


^ permalink raw reply related

* [PATCH 4/4] color-words: take an optional regular expression describing words
From: Johannes Schindelin @ 2009-01-14 17:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901141840100.3586@pacific.mpi-cbg.de>


In some applications, words are not delimited by white space.  To
allow for that, you can specify a regular expression describing
what makes a word with

	git diff --color-words='[A-Za-z0-9]+'

Note that words cannot contain newline characters.

As suggested by Thomas Rast, the words are the exact matches of the
regular expression.

Note that a regular expression beginning with a '^' will match only
a word at the beginning of the hunk, not a word at the beginning of
a line, and is probably not what you want.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Documentation/diff-options.txt |    6 +++-
 diff.c                         |   64 ++++++++++++++++++++++++++++++++++-----
 diff.h                         |    1 +
 t/t4034-diff-words.sh          |   24 +++++++++++++++
 4 files changed, 85 insertions(+), 10 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 1f8ce97..e546bfa 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -94,8 +94,12 @@ endif::git-format-patch[]
 	Turn off colored diff, even when the configuration file
 	gives the default to color output.
 
---color-words::
+--color-words[=regex]::
 	Show colored word diff, i.e. color words which have changed.
++
+Optionally, you can pass a regular expression that tells Git what the
+words are that you are looking for; The default is to interpret any
+stretch of non-whitespace as a word.
 
 --no-renames::
 	Turn off rename detection, even when the configuration
diff --git a/diff.c b/diff.c
index fe8b1f0..d5d7171 100644
--- a/diff.c
+++ b/diff.c
@@ -333,12 +333,14 @@ static void diff_words_append(char *line, unsigned long len,
 	len--;
 	memcpy(buffer->text.ptr + buffer->text.size, line, len);
 	buffer->text.size += len;
+	buffer->text.ptr[buffer->text.size] = '\0';
 }
 
 struct diff_words_data {
 	struct diff_words_buffer minus, plus;
 	const char *current_plus;
 	FILE *file;
+	regex_t *word_regex;
 };
 
 static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
@@ -374,17 +376,49 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
 	diff_words->current_plus = plus_end;
 }
 
+/* This function starts looking at *begin, and returns 0 iff a word was found. */
+static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,
+		int *begin, int *end)
+{
+	if (word_regex && *begin < buffer->size) {
+		regmatch_t match[1];
+		if (!regexec(word_regex, buffer->ptr + *begin, 1, match, 0)) {
+			char *p = memchr(buffer->ptr + *begin + match[0].rm_so,
+					'\n', match[0].rm_eo);
+			*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;
+			*begin += match[0].rm_so;
+			return *begin >= *end;
+		}
+		return -1;
+	}
+
+	/* find the next word */
+	while (*begin < buffer->size && isspace(buffer->ptr[*begin]))
+		(*begin)++;
+	if (*begin >= buffer->size)
+		return -1;
+
+	/* find the end of the word */
+	*end = *begin + 1;
+	while (*end < buffer->size && !isspace(buffer->ptr[*end]))
+		(*end)++;
+
+	return 0;
+}
+
 /*
  * This function splits the words in buffer->text, stores the list with
  * newline separator into out, and saves the offsets of the original words
  * in buffer->orig.
  */
-static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out)
+static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,
+		regex_t *word_regex)
 {
 	int i, j;
+	long alloc = 0;
 
 	out->size = 0;
-	out->ptr = xmalloc(buffer->text.size);
+	out->ptr = NULL;
 
 	/* fake an empty "0th" word */
 	ALLOC_GROW(buffer->orig, 1, buffer->orig_alloc);
@@ -392,11 +426,8 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out)
 	buffer->orig_nr = 1;
 
 	for (i = 0; i < buffer->text.size; i++) {
-		if (isspace(buffer->text.ptr[i]))
-			continue;
-		for (j = i + 1; j < buffer->text.size &&
-				!isspace(buffer->text.ptr[j]); j++)
-			; /* find the end of the word */
+		if (find_word_boundaries(&buffer->text, word_regex, &i, &j))
+			return;
 
 		/* store original boundaries */
 		ALLOC_GROW(buffer->orig, buffer->orig_nr + 1,
@@ -406,6 +437,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out)
 		buffer->orig_nr++;
 
 		/* store one word */
+		ALLOC_GROW(out->ptr, out->size + j - i + 1, alloc);
 		memcpy(out->ptr + out->size, buffer->text.ptr + i, j - i);
 		out->ptr[out->size + j - i] = '\n';
 		out->size += j - i + 1;
@@ -435,9 +467,10 @@ static void diff_words_show(struct diff_words_data *diff_words)
 
 	memset(&xpp, 0, sizeof(xpp));
 	memset(&xecfg, 0, sizeof(xecfg));
-	diff_words_fill(&diff_words->minus, &minus);
-	diff_words_fill(&diff_words->plus, &plus);
+	diff_words_fill(&diff_words->minus, &minus, diff_words->word_regex);
+	diff_words_fill(&diff_words->plus, &plus, diff_words->word_regex);
 	xpp.flags = XDF_NEED_MINIMAL;
+	/* as only the hunk header will be parsed, we need a 0-context */
 	xecfg.ctxlen = 0;
 	xdi_diff_outf(&minus, &plus, fn_out_diff_words_aux, diff_words,
 		      &xpp, &xecfg, &ecb);
@@ -476,6 +509,7 @@ static void free_diff_words_data(struct emit_callback *ecbdata)
 		free (ecbdata->diff_words->minus.orig);
 		free (ecbdata->diff_words->plus.text.ptr);
 		free (ecbdata->diff_words->plus.orig);
+		free(ecbdata->diff_words->word_regex);
 		free(ecbdata->diff_words);
 		ecbdata->diff_words = NULL;
 	}
@@ -1498,6 +1532,14 @@ static void builtin_diff(const char *name_a,
 			ecbdata.diff_words =
 				xcalloc(1, sizeof(struct diff_words_data));
 			ecbdata.diff_words->file = o->file;
+			if (o->word_regex) {
+				ecbdata.diff_words->word_regex = (regex_t *)
+					xmalloc(sizeof(regex_t));
+				if (regcomp(ecbdata.diff_words->word_regex,
+						o->word_regex, REG_EXTENDED))
+					die ("Invalid regular expression: %s",
+							o->word_regex);
+			}
 		}
 		xdi_diff_outf(&mf1, &mf2, fn_out_consume, &ecbdata,
 			      &xpp, &xecfg, &ecb);
@@ -2513,6 +2555,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		DIFF_OPT_CLR(options, COLOR_DIFF);
 	else if (!strcmp(arg, "--color-words"))
 		options->flags |= DIFF_OPT_COLOR_DIFF | DIFF_OPT_COLOR_DIFF_WORDS;
+	else if (!prefixcmp(arg, "--color-words=")) {
+		options->flags |= DIFF_OPT_COLOR_DIFF | DIFF_OPT_COLOR_DIFF_WORDS;
+		options->word_regex = arg + 14;
+	}
 	else if (!strcmp(arg, "--exit-code"))
 		DIFF_OPT_SET(options, EXIT_WITH_STATUS);
 	else if (!strcmp(arg, "--quiet"))
diff --git a/diff.h b/diff.h
index 4d5a327..23cd90c 100644
--- a/diff.h
+++ b/diff.h
@@ -98,6 +98,7 @@ struct diff_options {
 
 	int stat_width;
 	int stat_name_width;
+	const char *word_regex;
 
 	/* this is set by diffcore for DIFF_FORMAT_PATCH */
 	int found_changes;
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index b032bd3..0ed7e53 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -59,4 +59,28 @@ test_expect_success 'word diff with runs of whitespace' '
 
 '
 
+cat > expect <<\EOF
+<WHITE>diff --git a/pre b/post<RESET>
+<WHITE>index 330b04f..5ed8eff 100644<RESET>
+<WHITE>--- a/pre<RESET>
+<WHITE>+++ b/post<RESET>
+<BROWN>@@ -1,3 +1,7 @@<RESET>
+h(4),<GREEN>hh<RESET>[44]
+<RESET>
+a = b + c<RESET>
+
+<GREEN>aa = a<RESET>
+
+<GREEN>aeff = aeff * ( aaa )<RESET>
+EOF
+
+test_expect_success 'word diff with a regular expression' '
+
+	test_must_fail git diff --no-index --color-words='[a-z]+' \
+		pre post > output &&
+	decrypt_color < output > output.decrypted &&
+	test_cmp expect output.decrypted
+
+'
+
 test_done
-- 
1.6.1.243.g4c9c5a

^ permalink raw reply related

* Re: [PATCH next v2] git-notes: add test case for multi-line notes
From: Johannes Schindelin @ 2009-01-14 18:01 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Jeff King, Tor Arne Vestbø, Junio C Hamano, git
In-Reply-To: <496E1D77.6000307@viscovery.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 705 bytes --]

Hi,

On Wed, 14 Jan 2009, Johannes Sixt wrote:

> Jeff King schrieb:
> > On Wed, Jan 14, 2009 at 05:28:11PM +0100, Tor Arne Vestbø wrote:
> > 
> >> +MSG=${MSG//%/}
> >> +printf "$MSG" > "$1"
> >> +printf "$MSG" >& 2
> > 
> > Substitution parameter expansion is a bash-ism, IIRC. How about just
> > 
> >   printf %s "$MSG" ?
> 
> A the point was that $MSG contains \n, which should be turned int LF. IMO,
> the easiest way to achieve this is:
> 
> MSG='b3
> c3c3c3c3
> d3d3d3'
> 
> test_expect_success ' ... ' '
>    ...
>    MSG="$MSG" git notes edit
> '
> 
> and go back to using echo in the part cited above.

Heh, I almost suggested it, but I know that I get quoting wrong all the 
time.

Ciao,
Dscho

^ permalink raw reply

* Re: git-svn fails to fetch repository
From: Jay Soffian @ 2009-01-14 18:06 UTC (permalink / raw)
  To: Vladimir Pouzanov; +Cc: git, Eric Wong
In-Reply-To: <loom.20090114T083207-942@post.gmane.org>

On Wed, Jan 14, 2009 at 3:32 AM, Vladimir Pouzanov <farcaller@gmail.com> wrote:
> Jay Soffian <jaysoffian <at> gmail.com> writes:
>> So you're adding the "use Carp..." and "warn..." lines.
>>
>> Then try the import again. That should at least show why the svn_delta
>> temp file is being acquired twice.
>
> Output is pretty long so I've put in on pastebin:
> http://pastebin.com/m210be905

Okay, this is beyond me. git-svn (among other things) implements a
so-called delta editor (part of the subversion API). The driver for
that editor is apparently calling the editor's apply_textdelta()
method twice in a row w/o an intervening call to the editor's
close_file() method.

I don't understand when and/or why it would do this. This part of the
Subversion API seems not that well documented, and I got lost trying
to follow all the indirections in the Subversion source code (esp
w/the swig'ified Perl bindings). AFAICT, this should not be happening.

I could ask you to insert some more debugging statements to try to
track it to a specific file (or files), but I think at this point I'll
going to wait to see if the git-svn author has any ideas.

BTW, it doesn't help any that the order that files are checked out
seems not to be consistent. Not only is my git-svn clone working, the
order my files are checked out in is different from yours.

Oh, one other thing I don't understand is why the debugging output is
now showing that some files are being added for you (the lines
beginning with \tA). Before you weren't getting that. I had thought
these lines might be getting lost in stdout buffering, but git-svn
disables buffering on stdout, so color me confused.

Sorry I can't be more help,

j.

^ permalink raw reply

* Re: [PATCH 3/4] color-words: change algorithm to allow for 0-character word boundaries
From: Johannes Schindelin @ 2009-01-14 18:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Rast, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901141851030.3586@pacific.mpi-cbg.de>

Hi,

On Wed, 14 Jan 2009, Johannes Schindelin wrote:

> +test_expect_success setup '
> +
> +	git config diff.color.old red
> +	git config diff.color.new green
> +
> +'

Oops.  This should probably go...

Ciao,
Dscho

^ permalink raw reply

* Compiler requirements for git?
From: Corey Stup @ 2009-01-14 18:32 UTC (permalink / raw)
  To: git

Newbie to the group.
I couldn't find a reference to say what the requirements are to
compile git.  Certainly it works with GCC, but GCC allows for all
sorts of non standard syntax.

When trying to compile with a C89 compliant compiler, I'm coming
across a couple issues:
- "inline" use
- trailing comma on the last member of enums

Are these oversights or does git require GCC or a C99 compiler?
Thanks!

^ permalink raw reply

* Re: git merge and cherry-pick and duplicated commits?
From: skillzero @ 2009-01-14 18:33 UTC (permalink / raw)
  To: git
In-Reply-To: <496DA3B2.1070807@viscovery.net>

On Wed, Jan 14, 2009 at 12:34 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:

> After you created the fixup, you have this situation:
>
>    o--o--o   <- A (feature branch)
>   /
> --o--x        <- X (the fix-up branch)
>   \
>    o--o--o   <- Z (probably your master)
>
> You merge the fix-up into the feature branch and continue developing the
> feature:
>
>    o--o--o--M--o--o   <- A
>   /        /
> --o--x-----'           <- X
>   \
>    o--o--o            <- Z
>
> Other people need the fix in Z right now, so you merge it into Z as well:
>
>    o--o--o--M--o--o   <- A
>   /        /
> --o--x-----<           <- X
>   \        \
>    o--o--o--N         <- Z
>
> You complete your feature and merge it into Z:
>
>    o--o--o--M--o--o     <- A
>   /        /       \
> --o--x-----<         \   <- X
>   \        \         \
>    o--o--o--N---------O <- Z
>
> The fix-up commit is only once in your history.

Thanks for the info. That's what I was hoping, but I was thinking that
I'd get duplicate commits if I did that. I'll have to try it out when
I run into this situation again.

Related to this, is there a way to easily find the common merge base
given a bunch of a branches? When I want to fix a bug, I want to say
"Given branches A, B, C, D, and E, where should I fork my bug fix
branch from so that I can merge this branch into all those branches
without getting duplicate commits?".

^ permalink raw reply

* Re: [PATCH 3/3] implement pattern matching in ce_path_match
From: Junio C Hamano @ 2009-01-14 18:39 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: git, johannes
In-Reply-To: <1231944876-29930-4-git-send-email-drizzd@aon.at>

Clemens Buchacher <drizzd@aon.at> writes:

> With this patch ce_path_match uses match_pathspec in order to perform
> pattern matching.

We have two conflicting definitions of pattern matching in our system.
I'd make it more explicit which kind of pattern matching you are talking
about here.

The family of operations based on the diff-tree machinery (e.g. path
limited revision walking "git log A..B -- dir1/dir2") define the pattern
matching as "leading path match (exact match is just a special case of
this)".  Other operations that work on paths in the work tree and the
index (e.g. grep, ls-files) uses "leading path match, but fall back to
globbing".

In the longer term we really should unify them by teaching the former to
fall back to globbing without getting undue performance hit, and this
patch may be a step in the right direction.  There are optimizations that
assume the "leading path" semantics to trim the input early and avoid
opening and descending into a tree object if pathspec patterns cannot
possibly match (see tree-diff.c::tree_entry_interesting() for an example),
and we need to teach them to notice a glob wildcard in an earlier part of
a pathspec and to descend into some trees that they would have skipped
with the old definition of pathspec.

> @@ -49,7 +60,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
>  		rev->always_show_header = 0;
>  	if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {
>  		rev->always_show_header = 0;
> -		if (rev->diffopt.nr_paths != 1)
> +		if (rev->diffopt.nr_paths != 1 || has_special(rev->diffopt.paths[0]))
>  			usage("git logs can only follow renames on one pathname at a time");
>  	}

The reason match_pathspec() first tries exact match and then falls back to
globbing is so that the user can say "I have a file whose name ends with a
question mark, please match it literally."  This patch defeats it, but it
probably is a minor point.

1/3 and 2/3 in the series looked good.

Thanks.

^ 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