Git development
 help / color / mirror / Atom feed
* Re: [PATCH take 3 0/4] color-words improvements
From: Johannes Schindelin @ 2009-01-14 21:07 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, git, Santi Béjar
In-Reply-To: <200901142104.16134.trast@student.ethz.ch>

Hi,

On Wed, 14 Jan 2009, Thomas Rast wrote:

> Johannes Schindelin wrote:
> > 
> > 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().
> 
> Umm.... but you seem to do?

Oh, right!  I think the culprit is in fn_out_diff_words_aux(), which calls 
fwrite() directly for the common words.

> Ack on the new regex semantics, though I'd have implemented it via dying 
> on '\n' instead of silently splitting there (and restarting a new 
> match!).

Hmm.  I'd rather not die() in the middle of it.

Maybe we can even handle newlines correctly by replacing them with NULs 
which libxdiff handles just fine?

> Thus, Ack on 4/4 once the boundary bug is fixed.  Thanks for your work!

Phew.  I was almost convinced you would hate me for my criticiscm.

Thanks,
Dscho

^ permalink raw reply

* Re: [PATCH next v3] git-notes: add test case for multi-line notes
From: Johannes Schindelin @ 2009-01-14 21:10 UTC (permalink / raw)
  To: Tor Arne Vestbø; +Cc: Johannes Sixt, Jeff King, Junio C Hamano, git
In-Reply-To: <496E51A3.8050908@gmail.com>

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

Hi,

On Wed, 14 Jan 2009, Tor Arne Vestbø wrote:

> The tests adds a third commit with a multi-line note. The output of
> git log -2 is then checked to see if the note lines are wrapped
> correctly, and that there's a line separator between the two commits.
> 
> Signed-off-by: Tor Arne Vestbø <tavestbo@trolltech.com>
> ---

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Maybe squash the test into the fix?

Ciao,
Dscho

^ permalink raw reply

* [PATCH] [TOPGIT] make tg remote idempotent
From: Uwe Kleine-König @ 2009-01-14 21:27 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

Before this patch each call to tg remote added three config entries
no matter if they already existed.  After some time my .git/config was
crowded.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 tg-remote.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tg-remote.sh b/tg-remote.sh
index c3e8bd3..7f7a1b0 100644
--- a/tg-remote.sh
+++ b/tg-remote.sh
@@ -27,9 +27,9 @@ git config "remote.$name.url" >/dev/null || die "unknown remote '$name'"
 
 ## Configure the remote
 
-git config --add "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
-git config --add "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*"
-git config --add "remote.$name.push" "+refs/heads/*:refs/heads/*"
+git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
+git config --replace-all "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" "+refs/top-bases/*:refs/top-bases/*"
+git config --replace-all "remote.$name.push" "+refs/heads/*:refs/heads/*" "+refs/heads/*:refs/heads/*"
 
 info "Remote $name can now follow TopGit topic branches."
 if [ -z "$populate" ]; then
-- 
1.5.6.5

^ permalink raw reply related

* [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
From: Uwe Kleine-König @ 2009-01-14 21:27 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis
In-Reply-To: <1231968443-13960-1-git-send-email-u.kleine-koenig@pengutronix.de>

This helps avoiding code duplication for the next commit.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 tg-export.sh |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/tg-export.sh b/tg-export.sh
index 9e6940f..dea24d9 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -71,14 +71,11 @@ pretty_tree()
 	 git write-tree)
 }
 
-# collapsed_commit NAME
-# Produce a collapsed commit of branch NAME.
-collapsed_commit()
+create_tg_commit()
 {
 	name="$1"
-
-	rm -f "$playground/^pre" "$playground/^post"
-	>"$playground/^body"
+	tree="$2"
+	parent="$3"
 
 	# Get commit message and authorship information
 	git cat-file blob "$name:.topmsg" | git mailinfo "$playground/^msg" /dev/null > "$playground/^info"
@@ -92,6 +89,20 @@ collapsed_commit()
 	test -n "$GIT_AUTHOR_EMAIL" && export GIT_AUTHOR_EMAIL
 	test -n "$GIT_AUTHOR_DATE" && export GIT_AUTHOR_DATE
 
+	(printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
+	git stripspace |
+	git commit-tree "$tree" -p "$parent"
+}
+
+# collapsed_commit NAME
+# Produce a collapsed commit of branch NAME.
+collapsed_commit()
+{
+	name="$1"
+
+	rm -f "$playground/^pre" "$playground/^post"
+	>"$playground/^body"
+
 	# Determine parent
 	parent="$(cut -f 1 "$playground/$name^parents")"
 	if [ "$(cat "$playground/$name^parents" | wc -l)" -gt 1 ]; then
@@ -107,9 +118,7 @@ collapsed_commit()
 	if branch_empty "$name"; then
 		echo "$parent";
 	else
-		(printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
-		git stripspace |
-		git commit-tree "$(pretty_tree "$name")" -p "$parent"
+		create_tg_commit "$name" "$(pretty_tree $name)" "$parent"
 	fi;
 
 	echo "$name" >>"$playground/^ticker"
-- 
1.5.6.5

^ permalink raw reply related

* git-svn clone -s fails to setup branches in git if the most recent svn commit was not to trunk
From: Adam Soltys @ 2009-01-14 21:27 UTC (permalink / raw)
  To: git

I ran the following command to clone from an svn repository that followed the
standard svn folder layout and had two branches:

svn clone -s svn://path/to/my_repo

I then typed:

git branch -r

Which returned:

origin/HEAD
origin/master

I was expecting to see the branches and tags from the svn /branches and /tags
folders but they did not appear.  

I checked out origin/HEAD and origin/master to see what was there and I found
they contained code from a subversion branch that was originally in the
/branches folder.  I noticed that this particular branch was the last place
committed to in the svn repo.  So I checked something into the /trunk of the svn
repo, nuked the git repo, and ran the git svn clone command again.  This time it
worked as expected and "git branch -r" showed me all my tags and branches.

^ permalink raw reply

* [PATCH] git-rev-parse(1): restore vital table header
From: jidanni @ 2009-01-14 21:34 UTC (permalink / raw)
  To: gitster; +Cc: git

A vital table header is restored. Else the new user may be confused as
to the implied relationship betwixt the two columns.

Signed-off-by: jidanni <jidanni@jidanni.org>
---
 Documentation/git-rev-parse.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 2921da3..45ea114 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -318,6 +318,7 @@ all of its parents.
 
 Here are a handful of examples:
 
+   Range            Reaches
    D                G H D
    D F              G H I J D F
    ^G D             H D
-- 
1.6.0.6

^ permalink raw reply related

* Re: Google Summer of Code 2009
From: Stephan Beyer @ 2009-01-14 22:01 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Shawn O. Pearce, git, Daniel Barkalow, Christian Couder
In-Reply-To: <m3privyn20.fsf@localhost.localdomain>

Hi,

Jakub Narebski wrote:
> By the way, do you know what happened with git-sequencer project? 
> 
> If I remember correctly there was agreement on sequences mini-language
> (I think), and there was git-sequencer prototype in shell, using
> git-cherry-pick if I remember correctly, and even git-rebase and
> git-am etc reworked to make use of git-sequencer.  Stephan Beyer wrote
> that he has some preliminary version of builtin git-sequencer (in C),
> and that it makes git-rebase--interactive and like faster than current
> implementation... but builtin sequencer never materialized on git
> mailing list as a patch, if I remember correctly, and of course it was
> not merged into git either.

You remember and conclude correctly.

As Christian pointed out, we are working on it. Development didn't make
any real progress for a long time because of different personal reasons.
(If you're interested: an important exam at the end of September,
some other work besides, wrong priorities in time management,
some kind of "burnout" after the exam which made me avoid any kind of
productive work for a long time... it went away in between but came back
later...)

Now, again, I'm highly motivated to get it merged into pu or next before
the end of January. I hope, Christian or Daniel will kick me in the back
if this is not going to happen :-)
The next days some tiny and some bigger patches will follow. Commits
that have been lying around in my repo for a _long_ time.

In this time I try to address the rest of my TODO list which emerged
from a very chaotic sticky note[1] and is, well, just chaotic.
It contains items about...
 - some internal changes (simplifications, code reuse),
 - some changes in the output of sequencer,
 - some better code documentation (one item for a part of sequencer
   itself, one item for its test suite t3350),
 - check some stuff and fix if needed
   (e.g. whether sequencer changes this or that behavior (for
   rebase or am) that I haven't taken care of yet),
 - and the last item is to check/incorporate the git-rebase --root
   patches and/or fix sequencer to work with them (if needed).
   (I haven't taken one look at these patches, so I don't know
   if it's really necessary.)

It's not too much, but every single change can generate a bug
and, thus, hassle. :-)

Well, this is the current state of the git-sequencer project.
Thanks for the question and the prodding in the other thread (although
the problem there was solved much simpler without sequencer.)

Regards,
  Stephan

Footnotes.
 1. I mean those fancy yellow desktop notes provided by tools like
    "knotes" -- now uninstalled from my desktop machine, because
    there are *useful* tools like outliners that _help_ to
    manage ideas, todo lists, etc in a non-chaotic way.

-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply

* Re: [PATCH take 3 0/4] color-words improvements
From: Johannes Schindelin @ 2009-01-14 22:06 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Teemu Likonen, Junio C Hamano, git, Santi Béjar
In-Reply-To: <200901142059.09005.trast@student.ethz.ch>

Hi,

On Wed, 14 Jan 2009, Thomas Rast wrote:

> Teemu Likonen wrote:
> >     -aaa (aaa)
> >     +aaa (aaa) aaa
> 
> Bug aside, examples like this one make me wonder if we should force a
> "last resort" match for `[^[:space:]]`.  For example,
> 
>       -aaa [aaa]
>       +aaa (aaa) aaa
> 
> would still give you
> 
>       aaa (aaa)<GREEN> aaa<RESET>
> 
> which may be unexpected.

But why should it be unexpected?  If people say that every length of "a" 
makes a word, and consequently everything else is clutter, then that's 
that, no?

So people might be surprised, but then they should have said something 
like

	[-.+#@"'$%^&*([{<>~|]*[A-Za-z][A-Za-z0-9]*[-.+#@"'$%&*)\]}>|]*

instead.

Although I have to say that for some applications, it is a pity that 
even POSIX extended regular expressions knows neither lookahead nor 
lookbehind.

Which reminds me... should we activate REG_EXTENDED by default?

Ciao,
Dscho

^ permalink raw reply

* cygwin git diff crash
From: Jeremy Ramer @ 2009-01-14 22:09 UTC (permalink / raw)
  To: Git Mailing List

Ok this is a weird issue and it's probably cygwin's fault, but I
haven't found any way to fix it so I' thought I would throw it out
here for comment.

I am using git 1.6.0.4 on cygwin. I have a repo where if any file has
changes and git detects as mode 100644 I get this error:
$git diff
      3 [main] git 2744 C:\cygwin\bin\git.exe: *** fatal error - could
not load user32, Win32 error

If I change the mode to 100755 git diff will work fine.
$chmod a+x test.cpp
$git diff
diff --git a/test.cpp b/test.cpp
old mode 100644
new mode 100755
index 7c0dfcd..20987a7
--- a/test.cpp
+++ b/test.cpp
@@ -6,9 +6,11 @@ int main()

 void func()
 {
+       int a;^M
 }

 void func2()
 {
+       int b;^M
 }

Anybody have a clue as to why this might occur?  I have seen this in
many of the repo's I use, but it is not repeatable.  I tried making a
test repo but could not reproduce.

Thanks!
Jeremy

^ permalink raw reply related

* Re: [PATCH take 3 0/4] color-words improvements
From: Thomas Rast @ 2009-01-14 22:11 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Teemu Likonen, Junio C Hamano, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901142258250.3586@pacific.mpi-cbg.de>

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

Johannes Schindelin wrote:
> Which reminds me... should we activate REG_EXTENDED by default?

We (you :-) do, and I think so.  Consider that funcname is not even
documented any more, in favour of xfuncname.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch


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

^ permalink raw reply

* Re: git-svn clone -s fails to setup branches in git if the most recent svn commit was not to trunk
From: Boyd Stephen Smith Jr. @ 2009-01-14 22:04 UTC (permalink / raw)
  To: Adam Soltys; +Cc: git
In-Reply-To: <loom.20090114T211218-628@post.gmane.org>

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

On Wednesday 2009 January 14 15:27:01 Adam Soltys wrote:
<snip: git-svn weirdness when the last commit is to a branch/tag>

I already knew about this bug, but here is my "+1 please fix" mail.
-- 
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 take 3 0/4] color-words improvements
From: Boyd Stephen Smith Jr. @ 2009-01-14 22:24 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Thomas Rast, Teemu Likonen, Junio C Hamano, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901142258250.3586@pacific.mpi-cbg.de>

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

On Wednesday 2009 January 14 16:06:48 Johannes Schindelin wrote:
>On Wed, 14 Jan 2009, Thomas Rast wrote:
>> Bug aside, examples like this one make me wonder if we should force a
>> "last resort" match for `[^[:space:]]`.  For example,
>>
>>       -aaa [aaa]
>>       +aaa (aaa) aaa
>>
>> would still give you
>>
>>       aaa (aaa)<GREEN> aaa<RESET>
>>
>> which may be unexpected.
>
>But why should it be unexpected?  If people say that every length of "a"
>makes a word, and consequently everything else is clutter, then that's
>that, no?

I think some people are going to have problems with the strict dichotomy 
between "part of a word" and "ignorable whitespace" that is being set up.  
It makes sense technically, but it could confuse.

Imagine with --diff-words=[A-Z][A-Za-z]* and the following change:
-To be Or Not To be.
+To ignore Or Not To treat whitespace differently.

I think there is value in being able to ignore anything that's not a word, 
so the documentation that mentions adding '|[^[:space:]]' to your regex 
seems sufficient to me.
-- 
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

* [PATCH 1/4] color-words: fix quoting in t4034
From: Thomas Rast @ 2009-01-14 22:26 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Santi Béjar, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901142104400.3586@pacific.mpi-cbg.de>

Since the single quotes match the ones used to quote the test text
itself, they'd be dropped.  Use double quotes instead.
---

I'd squash this into Dscho's 4/4, so no SoB.


 t/t4034-diff-words.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index f4810e9..6ad1c1f 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -80,7 +80,7 @@ EOF
 
 test_expect_success 'word diff with a regular expression' '
 
-	word_diff --color-words='[a-z]+'
+	word_diff --color-words="[a-z]+"
 
 '
 
@@ -98,7 +98,7 @@ EOF
 
 test_expect_success "test parsing words for newline" '
 
-	word_diff --color-words='a+'
+	word_diff --color-words="a+"
 
 '
 
-- 
1.6.1.142.ge070e

^ permalink raw reply related

* [PATCH 2/4] color-words: enable REG_NEWLINE to help user
From: Thomas Rast @ 2009-01-14 22:26 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Santi Béjar, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901142104400.3586@pacific.mpi-cbg.de>

We silently truncate a match at the newline, which may lead to
unexpected behaviour, e.g., when matching "<[^>]*>" against

  <foo
  bar>

since then "<foo" becomes a word (and "bar>" doesn't!) even though the
regex said only angle-bracket-delimited things can be words.

To alleviate the problem slightly, use REG_NEWLINE so that negated
classes can't match a newline.  Of course newlines can still be
matched explicitly.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 diff.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index cc42adf..3f07ac1 100644
--- a/diff.c
+++ b/diff.c
@@ -1536,7 +1536,8 @@ static void builtin_diff(const char *name_a,
 				ecbdata.diff_words->word_regex = (regex_t *)
 					xmalloc(sizeof(regex_t));
 				if (regcomp(ecbdata.diff_words->word_regex,
-						o->word_regex, REG_EXTENDED))
+						o->word_regex,
+						REG_EXTENDED | REG_NEWLINE))
 					die ("Invalid regular expression: %s",
 							o->word_regex);
 			}
-- 
1.6.1.142.ge070e

^ permalink raw reply related

* [PATCH 3/4] color-words: expand docs with precise semantics
From: Thomas Rast @ 2009-01-14 22:26 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Santi Béjar, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901142104400.3586@pacific.mpi-cbg.de>

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 Documentation/diff-options.txt |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 2c1fa4b..8689a92 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -91,12 +91,17 @@ endif::git-format-patch[]
 	Turn off colored diff, even when the configuration file
 	gives the default to color output.
 
---color-words[=regex]::
-	Show colored word diff, i.e. color words which have changed.
+--color-words[=<regex>]::
+	Show colored word diff, i.e., color words which have changed.
+	By default, words are separated by whitespace.
 +
-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.
+When a <regex> is specified, every non-overlapping match of the
+<regex> is considered a word.  Anything between these matches is
+considered whitespace and ignored(!) for the purposes of finding
+differences.  You may want to append `|[^[:space:]]` to your regular
+expression to make sure that it matches all non-whitespace characters.
+A match that contains a newline is silently truncated(!) at the
+newline.
 
 --no-renames::
 	Turn off rename detection, even when the configuration
-- 
1.6.1.142.ge070e

^ permalink raw reply related

* [PATCH 4/4] color-words: make regex configurable via attributes
From: Thomas Rast @ 2009-01-14 22:26 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Santi Béjar, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901142104400.3586@pacific.mpi-cbg.de>

Make the --color-words splitting regular expression configurable via
the diff driver's 'wordregex' attribute.  The user can then set the
driver on a file in .gitattributes.  If a regex is given on the
command line, it overrides the driver's setting.

We also provide built-in regexes for the languages that already had
funcname patterns, and add an appropriate diff driver entry for C/++.
(The patterns are designed to run UTF-8 sequences into a single chunk
to make sure they remain readable.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

Incorporates the last round of Dscho's suggestions.

 Documentation/diff-options.txt  |    4 ++
 Documentation/gitattributes.txt |   21 ++++++++++
 diff.c                          |   10 +++++
 t/t4034-diff-words.sh           |   49 ++++++++++++++++++++++--
 userdiff.c                      |   78 +++++++++++++++++++++++++++++++-------
 userdiff.h                      |    1 +
 6 files changed, 144 insertions(+), 19 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 8689a92..1edb82e 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -102,6 +102,10 @@ differences.  You may want to append `|[^[:space:]]` to your regular
 expression to make sure that it matches all non-whitespace characters.
 A match that contains a newline is silently truncated(!) at the
 newline.
++
+The regex can also be set via a diff driver, see
+linkgit:gitattributes[1]; giving it explicitly overrides any diff
+driver setting.
 
 --no-renames::
 	Turn off rename detection, even when the configuration
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 8af22ec..17707ba 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -317,6 +317,8 @@ patterns are available:
 
 - `bibtex` suitable for files with BibTeX coded references.
 
+- `cpp` suitable for source code in the C and C++ languages.
+
 - `html` suitable for HTML/XHTML documents.
 
 - `java` suitable for source code in the Java language.
@@ -334,6 +336,25 @@ patterns are available:
 - `tex` suitable for source code for LaTeX documents.
 
 
+Customizing word diff
+^^^^^^^^^^^^^^^^^^^^^
+
+You can customize the rules that `git diff --color-words` uses to
+split words in a line, by specifying an appropriate regular expression
+in the "diff.*.wordregex" configuration variable.  For example, in TeX
+a backslash followed by a sequence of letters forms a command, but
+several such commands can be run together without intervening
+whitespace.  To separate them, use a regular expression such as
+
+------------------------
+[diff "tex"]
+	wordregex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"
+------------------------
+
+A built-in pattern is provided for all languages listed in the last
+section.
+
+
 Performing text diffs of binary files
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/diff.c b/diff.c
index 3f07ac1..0e82e18 100644
--- a/diff.c
+++ b/diff.c
@@ -1372,6 +1372,12 @@ int diff_filespec_is_binary(struct diff_filespec *one)
 	return one->driver->funcname.pattern ? &one->driver->funcname : NULL;
 }
 
+static const char *userdiff_word_regex(struct diff_filespec *one)
+{
+	diff_filespec_load_driver(one);
+	return one->driver->word_regex;
+}
+
 void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b)
 {
 	if (!options->a_prefix)
@@ -1532,6 +1538,10 @@ 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)
+				o->word_regex = userdiff_word_regex(one);
+			if (!o->word_regex)
+				o->word_regex = userdiff_word_regex(two);
 			if (o->word_regex) {
 				ecbdata.diff_words->word_regex = (regex_t *)
 					xmalloc(sizeof(regex_t));
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 6ad1c1f..631ca44 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -22,8 +22,10 @@ decrypt_color () {
 
 word_diff () {
 	test_must_fail git diff --no-index "$@" pre post > output &&
-	decrypt_color < output > output.decrypted &&
-	test_cmp expect output.decrypted
+	decrypt_color < output > output.decrypted
+}
+word_diff_check () {
+	test_cmp "$1" output.decrypted
 }
 
 cat > pre <<\EOF
@@ -80,7 +82,45 @@ EOF
 
 test_expect_success 'word diff with a regular expression' '
 
-	word_diff --color-words="[a-z]+"
+	word_diff --color-words="[a-z]+" &&
+	word_diff_check expect
+
+'
+
+cat > expect-by-chars <<\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[44]<RESET>
+<RESET>
+a = b + c<RESET>
+
+<GREEN>aa = a<RESET>
+
+<GREEN>aeff = aeff * ( aaa )<RESET>
+EOF
+
+test_expect_success 'set a diff driver' '
+	git config diff.testdriver.wordregex "[^[:space:]]" &&
+	cat <<EOF > .gitattributes
+pre diff=testdriver
+post diff=testdriver
+EOF
+'
+
+test_expect_success 'use default supplied by driver' '
+
+	word_diff --color-words &&
+	word_diff_check expect-by-chars
+
+'
+
+test_expect_success 'option overrides default' '
+
+	word_diff --color-words="[a-z]+" &&
+	word_diff_check expect
 
 '
 
@@ -98,7 +138,8 @@ EOF
 
 test_expect_success "test parsing words for newline" '
 
-	word_diff --color-words="a+"
+	word_diff --color-words="a+" &&
+	word_diff_check expect
 
 '
 
diff --git a/userdiff.c b/userdiff.c
index 3681062..dbfda6d 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -6,14 +6,20 @@
 static int ndrivers;
 static int drivers_alloc;
 
-#define FUNCNAME(name, pattern) \
-	{ name, NULL, -1, { pattern, REG_EXTENDED } }
+#define PATTERNS(name, pattern, wordregex)			\
+	{ name, NULL, -1, { pattern, REG_EXTENDED }, wordregex }
 static struct userdiff_driver builtin_drivers[] = {
-FUNCNAME("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$"),
-FUNCNAME("java",
+PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
+	 "[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"),
+PATTERNS("java",
 	 "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
-	 "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$"),
-FUNCNAME("objc",
+	 "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
+	 "|[-+*/<>%&^|=!]="
+	 "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"
+	 "|[^[:space:]]|[\x80-\xff]+"),
+PATTERNS("objc",
 	 /* Negate C statements that can look like functions */
 	 "!^[ \t]*(do|for|if|else|return|switch|while)\n"
 	 /* Objective-C methods */
@@ -21,20 +27,60 @@
 	 /* C functions */
 	 "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n"
 	 /* Objective-C class/protocol definitions */
-	 "^(@(implementation|interface|protocol)[ \t].*)$"),
-FUNCNAME("pascal",
+	 "^(@(implementation|interface|protocol)[ \t].*)$",
+	 /* -- */
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
+	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
+	 "|[^[:space:]]|[\x80-\xff]+"),
+PATTERNS("pascal",
 	 "^((procedure|function|constructor|destructor|interface|"
 		"implementation|initialization|finalization)[ \t]*.*)$"
 	 "\n"
-	 "^(.*=[ \t]*(class|record).*)$"),
-FUNCNAME("php", "^[\t ]*((function|class).*)"),
-FUNCNAME("python", "^[ \t]*((class|def)[ \t].*)$"),
-FUNCNAME("ruby", "^[ \t]*((class|module|def)[ \t].*)$"),
-FUNCNAME("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$"),
-FUNCNAME("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$"),
+	 "^(.*=[ \t]*(class|record).*)$",
+	 /* -- */
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
+	 "|<>|<=|>=|:=|\\.\\."
+	 "|[^[:space:]]|[\x80-\xff]+"),
+PATTERNS("php", "^[\t ]*((function|class).*)",
+	 /* -- */
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
+	 "|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"
+	 "|[^[:space:]]|[\x80-\xff]+"),
+PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
+	 /* -- */
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
+	 "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"
+	 "|[^[:space:]|[\x80-\xff]+"),
+	 /* -- */
+PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
+	 /* -- */
+	 "(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
+	 "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"
+	 "|[^[:space:]|[\x80-\xff]+"),
+PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
+	 "[={}\"]|[^={}\" \t]+"),
+PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
+	 "\\\\[a-zA-Z@]+|[{}]|\\\\.|[^\\{} \t]+"),
+PATTERNS("cpp",
+	 /* Jump targets or access declarations */
+	 "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n"
+	 /* C functions at top level */
+	 "^([A-Za-z_][A-Za-z_0-9]*([ \t]+[A-Za-z_][A-Za-z_0-9]*){1,}[ \t]*\\([^;]*)$\n"
+	 /* compound type at top level */
+	 "^((struct|class|enum)[^;]*)$",
+	 /* -- */
+	 "[a-zA-Z_][a-zA-Z0-9_]*"
+	 "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
+	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
+	 "|[^[:space:]]|[\x80-\xff]+"),
 { "default", NULL, -1, { NULL, 0 } },
 };
-#undef FUNCNAME
+#undef PATTERNS
 
 static struct userdiff_driver driver_true = {
 	"diff=true",
@@ -134,6 +180,8 @@ int userdiff_config(const char *k, const char *v)
 		return parse_string(&drv->external, k, v);
 	if ((drv = parse_driver(k, v, "textconv")))
 		return parse_string(&drv->textconv, k, v);
+	if ((drv = parse_driver(k, v, "wordregex")))
+		return parse_string(&drv->word_regex, k, v);
 
 	return 0;
 }
diff --git a/userdiff.h b/userdiff.h
index ba29457..c315159 100644
--- a/userdiff.h
+++ b/userdiff.h
@@ -11,6 +11,7 @@ struct userdiff_driver {
 	const char *external;
 	int binary;
 	struct userdiff_funcname funcname;
+	const char *word_regex;
 	const char *textconv;
 };
 
-- 
1.6.1.142.ge070e

^ permalink raw reply related

* Re: [PATCH 3/3] implement pattern matching in ce_path_match
From: Junio C Hamano @ 2009-01-14 22:27 UTC (permalink / raw)
  To: Clemens Buchacher; +Cc: git, johannes
In-Reply-To: <20090114192341.GA26703@localhost>

Clemens Buchacher <drizzd@aon.at> writes:

> I think we could at least add an option to disable globbing. Then we can
> also disable the above check conditioned on that. If we allowed globbing
> pattern for following renames wouldn't that result in following the first
> file (or last in history) to match the pattern, which is potentially
> confusing?

Yeah, I agree that would be a reasonable thing to do.  

In places we read paths from the index or from the work tree and add them
as pathspec elements---you would want to mark them as non-globbing, too.
Which probably means that "is it Ok to glob this" setting has to be per
pathspec array elements.

^ permalink raw reply

* Re: cygwin git diff crash
From: Johannes Schindelin @ 2009-01-14 22:33 UTC (permalink / raw)
  To: Jeremy Ramer; +Cc: Git Mailing List
In-Reply-To: <b9fd99020901141409w1e0c926fkc762f8709bd1c13f@mail.gmail.com>

Hi,

On Wed, 14 Jan 2009, Jeremy Ramer wrote:

> Ok this is a weird issue and it's probably cygwin's fault, but I
> haven't found any way to fix it so I' thought I would throw it out
> here for comment.
> 
> I am using git 1.6.0.4 on cygwin. I have a repo where if any file has
> changes and git detects as mode 100644 I get this error:
> $git diff
>       3 [main] git 2744 C:\cygwin\bin\git.exe: *** fatal error - could
> not load user32, Win32 error
> 
> If I change the mode to 100755 git diff will work fine.
> $chmod a+x test.cpp
> $git diff
> diff --git a/test.cpp b/test.cpp
> old mode 100644
> new mode 100755
> index 7c0dfcd..20987a7
> --- a/test.cpp
> +++ b/test.cpp
> @@ -6,9 +6,11 @@ int main()
> 
>  void func()
>  {
> +       int a;^M
>  }
> 
>  void func2()
>  {
> +       int b;^M
>  }
> 
> Anybody have a clue as to why this might occur?  I have seen this in
> many of the repo's I use, but it is not repeatable.  I tried making a
> test repo but could not reproduce.

Wow, that _is_ weird.  Does your test suite pass?

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH take 3 0/4] color-words improvements
From: Thomas Rast @ 2009-01-14 22:37 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git, Santi Béjar
In-Reply-To: <alpine.DEB.1.00.0901142203190.3586@pacific.mpi-cbg.de>

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

Johannes Schindelin wrote:
> > Ack on the new regex semantics, though I'd have implemented it via dying 
> > on '\n' instead of silently splitting there (and restarting a new 
> > match!).
> 
> Hmm.  I'd rather not die() in the middle of it.
> 
> Maybe we can even handle newlines correctly by replacing them with NULs 
> which libxdiff handles just fine?

I'm not sure it's worth the effort---anyone who wants words to stick
together across newlines probably doesn't put a newline there in the
first place, don't they?  (And it just shifts the problem to another
special character.)

> Phew.  I was almost convinced you would hate me for my criticiscm.

Let's say I wasn't too happy when you asked for two rounds of
improvements and _then_ rejected.  But the end result certainly turned
out better, so the criticism was justified.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch



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

^ permalink raw reply

* Re: Compiler requirements for git?
From: Miklos Vajna @ 2009-01-14 22:38 UTC (permalink / raw)
  To: Corey Stup; +Cc: git
In-Reply-To: <128172e70901141032p6e830a85i344d72e1b3bb3a89@mail.gmail.com>

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

On Wed, Jan 14, 2009 at 01:32:56PM -0500, Corey Stup <coreystup@gmail.com> wrote:
> When trying to compile with a C89 compliant compiler, I'm coming
> across a couple issues:
> - "inline" use

AFAIK that can be avoided with -Dinline=.

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

^ permalink raw reply

* Re: [PATCH 1/4] color-words: fix quoting in t4034
From: Johannes Schindelin @ 2009-01-14 22:41 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Santi Béjar, Junio C Hamano
In-Reply-To: <3ff3ccf6e3c1cd6a002d200aee5df88a197a7bf6.1231971446.git.trast@student.ethz.ch>

Hi,

On Wed, 14 Jan 2009, Thomas Rast wrote:

> Since the single quotes match the ones used to quote the test text
> itself, they'd be dropped.  Use double quotes instead.

See, I suck with quoting.

> ---
> 
> I'd squash this into Dscho's 4/4, so no SoB.

Sure, done.

Thanks,
Dscho

^ permalink raw reply

* Re: git submodule merge madness
From: Johannes Schindelin @ 2009-01-14 22:55 UTC (permalink / raw)
  To: Ask Bjørn Hansen; +Cc: git
In-Reply-To: <ADC7A3B1-6756-4258-93CD-DB40C7D2793C@develooper.com>

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

Hi,

On Fri, 9 Jan 2009, Ask Bjørn Hansen wrote:

> We've (again) replaced a few directories with submodules.  Man, it's 
> madness!
> 
> The typical problem is that we get an error trying to merge a "pre-submodule"
> branch into master:
> 
> 	fatal: cannot read object 894c77319a18c4d48119c2985a9275c9f5883584
> 'some/sub/dir': It is a submodule!
> Mark Levedahl wrote an example in July, but I don't think he got any replies:
> http://marc.info/?l=git&m=121587851313303

So.... Which Git version are you are using?  Did you test any Git version 
containing the commit d5a84fb(merge-recursive: fail gracefully with 
directory/submodule conflicts)?

Ciao,
Dscho

^ permalink raw reply

* [StGit PATCH] Check for local changes with "goto"
From: Catalin Marinas @ 2009-01-14 22:59 UTC (permalink / raw)
  To: git, Karl Hasselström

This is done by default, unless the --keep option is passed, for
consistency with the "pop" command.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/common.py  |    7 +++++++
 stgit/commands/goto.py    |    8 +++++++-
 t/t2300-refresh-subdir.sh |    2 +-
 t/t2800-goto-subdir.sh    |    4 ++--
 t/t3000-dirty-merge.sh    |    2 +-
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 6bb3685..8ae43ff 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -100,6 +100,13 @@ def check_conflicts():
                            ' then use "resolve <files>" or revert the'
                            ' changes with "status --reset".')
 
+def check_clean(repository):
+    """Check whether the index is up to date.
+    """
+    if not repository.default_index.is_clean():
+        raise CmdException('Repository not clean. Use "refresh" or '
+                           '"status --reset"')
+
 def print_crt_patch(crt_series, branch = None):
     if not branch:
         patch = crt_series.get_current()
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 60a917e..6483011 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 from stgit.commands import common
 from stgit.lib import transaction
 from stgit import argparse
+from stgit.argparse import opt
 
 help = 'Push or pop patches to the given one'
 kind = 'stack'
@@ -27,7 +28,10 @@ Push/pop patches to/from the stack until the one given on the command
 line becomes current."""
 
 args = [argparse.other_applied_patches, argparse.unapplied_patches]
-options = []
+options = [
+    opt('-k', '--keep', action = 'store_true',
+        short = 'Keep the local changes')
+]
 
 directory = common.DirectoryHasRepositoryLib()
 
@@ -38,6 +42,8 @@ def func(parser, options, args):
 
     stack = directory.repository.current_stack
     iw = stack.repository.default_iw
+    if not options.keep:
+        common.check_clean(directory.repository)
     trans = transaction.StackTransaction(stack, 'goto')
     if patch in trans.applied:
         to_pop = set(trans.applied[trans.applied.index(patch)+1:])
diff --git a/t/t2300-refresh-subdir.sh b/t/t2300-refresh-subdir.sh
index d731a11..89c95db 100755
--- a/t/t2300-refresh-subdir.sh
+++ b/t/t2300-refresh-subdir.sh
@@ -65,7 +65,7 @@ test_expect_success 'refresh -u -p <subdir>' '
 
 test_expect_success 'refresh an unapplied patch' '
     stg refresh -u &&
-    stg goto p0 &&
+    stg goto --keep p0 &&
     test "$(stg status)" = "M foo.txt" &&
     stg refresh -p p1 &&
     test "$(stg status)" = "" &&
diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
index 28b8292..855972b 100755
--- a/t/t2800-goto-subdir.sh
+++ b/t/t2800-goto-subdir.sh
@@ -25,7 +25,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (just pop)' '
-    (cd foo && stg goto p1) &&
+    (cd foo && stg goto --keep p1) &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
     ls foo > actual.txt &&
@@ -48,7 +48,7 @@ cat > expected2.txt <<EOF
 bar
 EOF
 test_expect_success 'Goto in subdirectory (conflicting push)' '
-    (cd foo && stg goto p3) ;
+    (cd foo && stg goto --keep p3) ;
     [ $? -eq 3 ] &&
     cat foo/bar > actual.txt &&
     test_cmp expected1.txt actual.txt &&
diff --git a/t/t3000-dirty-merge.sh b/t/t3000-dirty-merge.sh
index f0f79d5..419d86e 100755
--- a/t/t3000-dirty-merge.sh
+++ b/t/t3000-dirty-merge.sh
@@ -26,7 +26,7 @@ test_expect_success 'Push with dirty worktree' '
     echo 4 > a &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
-    conflict stg goto p2 &&
+    conflict stg goto --keep p2 &&
     [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
     [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
     [ "$(echo $(cat a))" = "4" ]

^ permalink raw reply related

* RE: jgit merge question
From: David Birchfield @ 2009-01-14 22:03 UTC (permalink / raw)
  To: git
In-Reply-To: <20090114153034.GZ10179@spearce.org>

Great - thanks so much for this feedback and link.  My merge needs are straightforward, so hopefully this will suit the need!

I have pulled the latest jgit updates and downloaded the four .java files that are referenced in your link.  I have added these to the directory structure for jgit in the following new folder: org.spearce.jgit/src/org/spearce/jgit/merge/

However, when I try to now make_jgit.sh I am getting a series of errors (pasted below) that appear to stem from not having the same underlying files.  Is it possible that I am not getting the most recent jgit release files?  Or am I misunderstanding how you expect these Merge files to be used?

Thanks again,
David

<errors>
Entering org.spearce.jgit ...
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:45: cannot find symbol
symbol  : class UnmergedPathException
location: package org.spearce.jgit.errors
import org.spearce.jgit.errors.UnmergedPathException;
                               ^
./org/spearce/jgit/merge/Merger.java:184: cannot find symbol
symbol  : constructor CanonicalTreeParser(<nulltype>,org.spearce.jgit.lib.Repository,org.spearce.jgit.revwalk.RevTree,org.spearce.jgit.lib.WindowCursor)
location: class org.spearce.jgit.treewalk.CanonicalTreeParser
			return new CanonicalTreeParser(null, db, base.getTree(), curs);
                               ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:98: cannot find symbol
symbol  : method newInCore()
location: class org.spearce.jgit.dircache.DirCache
			cache = DirCache.newInCore();
                                        ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:123: cannot find symbol
symbol  : variable STAGE_0
location: class org.spearce.jgit.dircache.DirCacheEntry
					add(T_THEIRS, DirCacheEntry.STAGE_0);
                                                                   ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:125: cannot find symbol
symbol  : variable STAGE_0
location: class org.spearce.jgit.dircache.DirCacheEntry
					add(T_OURS, DirCacheEntry.STAGE_0);
                                                                 ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:137: cannot find symbol
symbol  : method writeTree(org.spearce.jgit.lib.ObjectWriter)
location: class org.spearce.jgit.dircache.DirCache
				resultTree = cache.writeTree(getObjectWriter());
                                                  ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:139: cannot find symbol
symbol  : class UnmergedPathException
location: class org.spearce.jgit.merge.StrategySimpleTwoWayInCore.InCoreMerger
			} catch (UnmergedPathException upe) {
                                 ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:147: cannot find symbol
symbol  : method getRawPath()
location: class org.spearce.jgit.treewalk.NameConflictTreeWalk
				builder.addTree(tw.getRawPath(), db, tw.getObjectId(1));
                                                  ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:149: cannot find symbol
symbol  : variable STAGE_0
location: class org.spearce.jgit.dircache.DirCacheEntry
				add(T_OURS, DirCacheEntry.STAGE_0);
                                                         ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:153: cannot find symbol
symbol  : variable STAGE_1
location: class org.spearce.jgit.dircache.DirCacheEntry
			add(T_BASE, DirCacheEntry.STAGE_1);
                                                 ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:154: cannot find symbol
symbol  : variable STAGE_2
location: class org.spearce.jgit.dircache.DirCacheEntry
			add(T_OURS, DirCacheEntry.STAGE_2);
                                                 ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:155: cannot find symbol
symbol  : variable STAGE_3
location: class org.spearce.jgit.dircache.DirCacheEntry
			add(T_THEIRS, DirCacheEntry.STAGE_3);
                                                   ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: cannot find symbol
symbol  : method getRawPath()
location: class org.spearce.jgit.treewalk.NameConflictTreeWalk
				e = new DirCacheEntry(tw.getRawPath(), stage);
                                                        ^
./org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java:163: internal error; cannot instantiate org.spearce.jgit.dircache.DirCacheEntry.<init> at org.spearce.jgit.dircache.DirCacheEntry to ()
				e = new DirCacheEntry(tw.getRawPath(), stage);
                                    ^

</errors




-----Original Message-----

David is probably talking about the 8 patch series I proposed to add a
crude merge API to JGit.  The patches are available here, based on the
current JGit master:

  http://android.git.kernel.org/?p=tools/egit.git;a=shortlog;h=refs/heads/for-gerrit2
  git://android.git.kernel.org/tools/egit.git for-gerrit2

^ permalink raw reply

* [StGit PATCH] Add --file option to pick
From: Catalin Marinas @ 2009-01-14 22:59 UTC (permalink / raw)
  To: git, Karl Hasselström

This allows folding of specific files only.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/pick.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py
index ee08c01..b0e9114 100644
--- a/stgit/commands/pick.py
+++ b/stgit/commands/pick.py
@@ -52,6 +52,8 @@ options = [
         short = 'Fold the commit object into the current patch'),
     opt('--update', action = 'store_true',
         short = 'Like fold but only update the current patch files'),
+    opt('-f', '--files', action = 'append',
+        short = 'Only fold the given files'),
     opt('--unapplied', action = 'store_true',
         short = 'Keep the patch unapplied')]
 
@@ -83,8 +85,11 @@ def __pick_commit(commit_id, patchname, options):
         out.start('Folding commit %s' % commit_id)
 
         # try a direct git apply first
-        if not git.apply_diff(bottom, top):
-            git.merge_recursive(bottom, git.get_head(), top)
+        if not git.apply_diff(bottom, top, files = options.files):
+            if options.files:
+                raise CmdException, 'Patch folding failed'
+            else:
+                git.merge_recursive(bottom, git.get_head(), top)
 
         out.done()
     elif options.update:
@@ -152,6 +157,9 @@ def func(parser, options, args):
     if not args:
         parser.error('incorrect number of arguments')
 
+    if options.files and not options.fold:
+        parser.error('--file can only be specified with --fold')
+
     if not options.unapplied:
         check_local_changes()
         check_conflicts()

^ 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