Git development
 help / color / mirror / Atom feed
* [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

* Re: 1.5.6.5 fails to clone git.kernel.org/[...]/rostedt/linux-2.6-rt
From: Johannes Schindelin @ 2009-01-14 23:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Tim Shepard, git, Daniel Barkalow
In-Reply-To: <7vpriw26uo.fsf@gitster.siamese.dyndns.org>

Hi,

On Fri, 9 Jan 2009, Junio C Hamano wrote:

> I think we lost the alternate object store support when git-fetch was 
> rewritten from the original shell script (that did support fetching from 
> such a repository over rsync:// transport) to a reimplementation in C, 
> with commit b888d61 (Make fetch a builtin, 2007-09-10).
> 
> Later, cd547b4 (fetch/push: readd rsync support, 2007-10-01) attempted to
> resurrect some rsync support (b888d61 lost rsync support completely for
> git-fetch), but introduced these lines in transport.c:
> 
> 	/* NEEDSWORK: handle one level of alternates */
> 	result = run_command(&rsync);

Indeed... And I know who's responsible for those lines.

However, I am swamped with work these days, and my Git time budget was 
_way_ overspent what with the recent patches.

So whoever would like to give it a go, go wild.

This is actually a very fine opportunity for people to get involved who 
always wanted to; it is a relatively low-hanging fruit.

It should just be a matter of getting objects/info/alternates (one can 
easily reuse a large part of the args[] array filled before the quoted 
code) into a temporary file.

If that does not succeed, return 0, otherwise fetch those objects, too 
(again reusing most of the args[] array).

It is that easy because objects as well as packs are immutable, so we can 
just build the union of objects/packs from the remote and its alternate.

Then all which is left to do is to add a test case to t/t5510-fetch.sh, 
and you're set.

As there are already test cases for rsync:// in it, it should be as simple 
as putting an empty file into a newly created directory, create an 
alternate for the "remote" pointing to the directory, fetching, and 
testing that the empty file was copied.

That's possible because rsync:// is dumb and does not verify the files it 
copied.

Oh, and don't forget to remove the NEEDSWORK comment :-)

And now I'm curious who's up for it...

Ciao,
Dscho

^ permalink raw reply

* Re: jgit merge question
From: Shawn O. Pearce @ 2009-01-14 23:12 UTC (permalink / raw)
  To: David Birchfield; +Cc: git
In-Reply-To: <AB447EEF7BAAB7489B29A4F3F788D02C01CDD792@EX07.asurite.ad.asu.edu>

David Birchfield <dbirchfield@asu.edu> wrote:
> 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/

Instead of copying 4 files, why don't you actually fetch the 8
commits and merge them into your local repository?  You are getting
build errors because you didn't get an exception type in the errors
directory, and at least two existing classes had new methods added
to them in order to support the merge API.

-- 
Shawn.

^ permalink raw reply

* Re: [ANNOUNCE] tig-0.13
From: bill lam @ 2009-01-14 23:24 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git
In-Reply-To: <20090113233643.GA28898@diku.dk>

On Wed, 14 Jan 2009, Jonas Fonseca wrote:
> Tig is an ncurses-based text-mode interface for git. It functions mainly

The Makefile does not link to the unicode version ncursesw, does it
still work for wide characters?

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩264 王昌齡  芙蓉樓送辛漸
    寒雨連江夜入吳  平明送客楚山孤  洛陽親友如相問  一片冰心在玉壺

^ permalink raw reply

* Re: [PATCH] git-am: add --directory=<dir> option
From: Stephan Beyer @ 2009-01-14 23:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Simon 'corecode' Schubert, Kevin Ballard
In-Reply-To: <7vbpudjanf.fsf@gitster.siamese.dyndns.org>

Hi Junio,

Junio C Hamano wrote:
>
>  git-am.sh             |   17 +++++++++++++----
>  t/t4252-am-options.sh |    8 ++++++++
>  2 files changed, 21 insertions(+), 4 deletions(-)

I think this is missing some

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index b9c6fac..64c8178 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -66,6 +66,7 @@ default.   You could use `--no-utf8` to override this.
 
 -C<n>::
 -p<n>::
+--directory=<root>::
 	These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
 	program that applies
 	the patch.

or even

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index b9c6fac..327bc3d 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -59,13 +59,10 @@ default.   You could use `--no-utf8` to override this.
 	it is supposed to apply to, and we have those blobs
 	available locally.
 
---whitespace=<option>::
-	This flag is passed to the 'git-apply' (see linkgit:git-apply[1])
-	program that applies
-	the patch.
-
 -C<n>::
 -p<n>::
+--directory=<root>::
+--whitespace=<option>::
 	These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
 	program that applies
 	the patch.

> diff --git c/git-am.sh w/git-am.sh
> index 4b157fe..7e6329b 100755
> --- c/git-am.sh
> +++ w/git-am.sh
[...]
> @@ -33,6 +34,14 @@ cd_to_toplevel
>  git var GIT_COMMITTER_IDENT >/dev/null ||
>  	die "You need to set your committer info first"
>  
> +sq () {
> +	for sqarg
> +	do
> +		printf "%s" "$sqarg" |
> +		sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
                                  ^^^

	$ echo "/fo'ba" | sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
	 '/fo'''ba'


Do I have a thinko or should it be this:

+		sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
		                   ^^
			(added for escaping ' outside single quotes)

leading to:

	$ echo "/fo'ba" | sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
	 '/fo'\''ba'


Well, I was unsure, so I've tested...


Without this change:

	$ ./git-am.sh --directory="fo'ba" /tmp/test/*
	Applying: abcdefg
	./git-am.sh: eval: line 471: unexpected EOF while looking for matching
	`''
	./git-am.sh: eval: line 472: syntax error: unexpected end of file
	Patch failed at 0001.
	When you have resolved this problem run "git am --resolved".
	If you would prefer to skip this patch, instead run "git am --skip".
	To restore the original branch and stop patching run "git am --abort".

And with this change:

	$ ./git-am.sh --directory="fo'ba" /tmp/test/*
	Applying: abcdefg
	Applying: asdgasfh

> diff --git c/t/t4252-am-options.sh w/t/t4252-am-options.sh
> index 3ab9e8e..e91a6da 100755
> --- c/t/t4252-am-options.sh
> +++ w/t/t4252-am-options.sh
> @@ -50,4 +50,12 @@ test_expect_success 'interrupted am -C1 -p2' '
>  	grep "^Three$" file-2
>  '
>  
> +test_expect_success 'interrupted am --directory="frotz nitfol"' '
> +	rm -rf .git/rebase-apply &&
> +	git reset --hard initial &&
> +	test_must_fail git am --directory="frotz nitfol" "$tm"/am-test-5-? &&

Have you forgotten to add the files prefixed with "am-test-5-" or is this
patch based on another one?

$ git ls-files t/t4252
t/t4252/am-test-1-1
t/t4252/am-test-1-2
t/t4252/am-test-2-1
t/t4252/am-test-2-2
t/t4252/am-test-3-1
t/t4252/am-test-3-2
t/t4252/am-test-4-1
t/t4252/am-test-4-2
t/t4252/file-1-0
t/t4252/file-2-0


Thanks and regards,
  Stephan

--------------- proposed interdiff without am-test-5* ---------------
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index b9c6fac..327bc3d 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -59,13 +59,10 @@ default.   You could use `--no-utf8` to override this.
 	it is supposed to apply to, and we have those blobs
 	available locally.
 
---whitespace=<option>::
-	This flag is passed to the 'git-apply' (see linkgit:git-apply[1])
-	program that applies
-	the patch.
-
 -C<n>::
 -p<n>::
+--directory=<root>::
+--whitespace=<option>::
 	These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
 	program that applies
 	the patch.
diff --git a/git-am.sh b/git-am.sh
index 7e6329b..ca3dbcd 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -38,7 +38,7 @@ sq () {
 	for sqarg
 	do
 		printf "%s" "$sqarg" |
-		sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
+		sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
 	done
 }
 
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

^ permalink raw reply related

* Re: git submodule merge madness
From: Ask Bjørn Hansen @ 2009-01-14 23:49 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0901142354120.3586@pacific.mpi-cbg.de>


On Jan 14, 2009, at 2:55 PM, Johannes Schindelin 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)?

IIRC I tried 1.6.1 and master as of about a week ago.

I don't see d5a84fb in my repository (and google doesn't find it  
referenced anywhere when I search for "directory/submodule conflicts".


  - ask

-- 
http://develooper.com/ - http://askask.com/

^ permalink raw reply

* Re: [ANNOUNCE] tig-0.13
From: Jonas Fonseca @ 2009-01-14 23:56 UTC (permalink / raw)
  To: git
In-Reply-To: <20090114232456.GA6937@b2j>

bill lam <cbill.lam@gmail.com> wrote Thu, Jan 15, 2009:
> On Wed, 14 Jan 2009, Jonas Fonseca wrote:
> > Tig is an ncurses-based text-mode interface for git. It functions mainly
> 
> The Makefile does not link to the unicode version ncursesw, does it
> still work for wide characters?

Yes, it works. You can either create a file called config.make with a
line saying:

	LDLIBS = -lncursesw

or use the configure file. If you are not using the tarball generate it
with:

	make configure

-- 
Jonas Fonseca

^ permalink raw reply

* [PATCH] checkout: implement "-" shortcut name for last branch
From: Thomas Rast @ 2009-01-15  0:06 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Let git-checkout save the old branch as a symref in LAST_HEAD, and
make 'git checkout -' switch back to LAST_HEAD, like 'cd -' does in
the shell.

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

I really wished I had this earlier today.  I'm just not sure if it's a
good idea, or even possible, to reserve the '-'.  I can't seem to
check out a branch '-foo' with git-checkout, but it's easy to create
one with 'git branch -- -foo'.  git-check-ref-format(1) doesn't forbid
it either, although the actual 'git check-ref-format -foo' exits with
status 1.

 Documentation/git-checkout.txt         |    3 +++
 Documentation/gitrepository-layout.txt |    4 ++++
 builtin-checkout.c                     |   26 +++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 9cd5151..1397745 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -133,6 +133,9 @@ the conflicted merge in the specified paths.
 +
 When this parameter names a non-branch (but still a valid commit object),
 your HEAD becomes 'detached'.
++
+You may also specify "`-`", which denotes the last branch you were on
+before the current HEAD.
 
 
 Detached HEAD
diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index 1befca9..f506c98 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -123,6 +123,10 @@ is often called 'detached HEAD', and almost all commands work
 identically as normal.  See linkgit:git-checkout[1] for
 details.
 
+LAST_HEAD::
+	A symref that holds the value of HEAD before the last
+	branch switch.
+
 branches::
 	A slightly deprecated way to store shorthands to be used
 	to specify URL to 'git-fetch', 'git-pull' and 'git-push'
diff --git a/builtin-checkout.c b/builtin-checkout.c
index b5dd9c0..356ad6c 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -480,6 +480,15 @@ static void report_tracking(struct branch_info *new)
 	strbuf_release(&sb);
 }
 
+static void save_old_branch(struct branch_info *old, char *msg)
+{
+	if (old->path) {
+		create_symref("LAST_HEAD", old->path, msg);
+	} else
+		update_ref(msg, "LAST_HEAD", old->commit->object.sha1, NULL,
+			   REF_NODEREF, DIE_ON_ERR);
+}
+
 static void update_refs_for_switch(struct checkout_opts *opts,
 				   struct branch_info *old,
 				   struct branch_info *new)
@@ -505,12 +514,15 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 			if (old->path && !strcmp(new->path, old->path))
 				fprintf(stderr, "Already on \"%s\"\n",
 					new->name);
-			else
+			else {
 				fprintf(stderr, "Switched to%s branch \"%s\"\n",
 					opts->new_branch ? " a new" : "",
 					new->name);
+				save_old_branch(old, msg.buf);
+			}
 		}
 	} else if (strcmp(new->name, "HEAD")) {
+		save_old_branch(old, msg.buf);
 		update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
 			   REF_NODEREF, DIE_ON_ERR);
 		if (!opts->quiet) {
@@ -533,6 +545,8 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 	int flag;
 	memset(&old, 0, sizeof(old));
 	old.path = resolve_ref("HEAD", rev, 0, &flag);
+	if (old.path)
+		old.path = strdup(old.path);
 	old.commit = lookup_commit_reference_gently(rev, 1);
 	if (!(flag & REF_ISSYMREF))
 		old.path = NULL;
@@ -604,6 +618,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		OPT_END(),
 	};
 	int has_dash_dash;
+	int flag;
 
 	memset(&opts, 0, sizeof(opts));
 	memset(&new, 0, sizeof(new));
@@ -671,6 +686,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		arg = argv[0];
 		has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
 
+		if (!strcmp(arg, "-")) {
+			arg = resolve_ref("LAST_HEAD", rev, 0, &flag);
+			if (!arg)
+				die("No last branch saved.");
+			if(!prefixcmp(arg, "refs/heads/"))
+				arg += 11;
+			arg = strdup(arg);
+		}
+
 		if (get_sha1(arg, rev)) {
 			if (has_dash_dash)          /* case (1) */
 				die("invalid reference: %s", arg);
-- 
1.6.1.282.gae4091.dirty

^ permalink raw reply related

* [PATCH v2] checkout: implement "-" shortcut name for last branch
From: Thomas Rast @ 2009-01-15  0:12 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano
In-Reply-To: <1231977976-8739-1-git-send-email-trast@student.ethz.ch>

Let git-checkout save the old branch as a symref in LAST_HEAD, and
make 'git checkout -' switch back to LAST_HEAD, like 'cd -' does in
the shell.

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

Bah, sorry.  I managed to keep it uncommitted AGAIN.

But this fixed version passes tests.  All of them.  Really!  ;-)


 Documentation/git-checkout.txt         |    3 ++
 Documentation/gitrepository-layout.txt |    4 ++
 builtin-checkout.c                     |   27 ++++++++++++++++-
 t/t2012-checkout-last.sh               |   50 ++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+), 1 deletions(-)
 create mode 100755 t/t2012-checkout-last.sh

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 9cd5151..1397745 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -133,6 +133,9 @@ the conflicted merge in the specified paths.
 +
 When this parameter names a non-branch (but still a valid commit object),
 your HEAD becomes 'detached'.
++
+You may also specify "`-`", which denotes the last branch you were on
+before the current HEAD.
 
 
 Detached HEAD
diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index 1befca9..f506c98 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -123,6 +123,10 @@ is often called 'detached HEAD', and almost all commands work
 identically as normal.  See linkgit:git-checkout[1] for
 details.
 
+LAST_HEAD::
+	A symref that holds the value of HEAD before the last
+	branch switch.
+
 branches::
 	A slightly deprecated way to store shorthands to be used
 	to specify URL to 'git-fetch', 'git-pull' and 'git-push'
diff --git a/builtin-checkout.c b/builtin-checkout.c
index b5dd9c0..da74831 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -480,6 +480,16 @@ static void report_tracking(struct branch_info *new)
 	strbuf_release(&sb);
 }
 
+static void save_old_branch(struct branch_info *old, char *msg)
+{
+	if (old->path) {
+		create_symref("LAST_HEAD", old->path, msg);
+	} else if (old->commit) {
+		update_ref(msg, "LAST_HEAD", old->commit->object.sha1, NULL,
+			   REF_NODEREF, DIE_ON_ERR);
+	}
+}
+
 static void update_refs_for_switch(struct checkout_opts *opts,
 				   struct branch_info *old,
 				   struct branch_info *new)
@@ -505,12 +515,15 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 			if (old->path && !strcmp(new->path, old->path))
 				fprintf(stderr, "Already on \"%s\"\n",
 					new->name);
-			else
+			else {
 				fprintf(stderr, "Switched to%s branch \"%s\"\n",
 					opts->new_branch ? " a new" : "",
 					new->name);
+				save_old_branch(old, msg.buf);
+			}
 		}
 	} else if (strcmp(new->name, "HEAD")) {
+		save_old_branch(old, msg.buf);
 		update_ref(msg.buf, "HEAD", new->commit->object.sha1, NULL,
 			   REF_NODEREF, DIE_ON_ERR);
 		if (!opts->quiet) {
@@ -533,6 +546,8 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 	int flag;
 	memset(&old, 0, sizeof(old));
 	old.path = resolve_ref("HEAD", rev, 0, &flag);
+	if (old.path)
+		old.path = strdup(old.path);
 	old.commit = lookup_commit_reference_gently(rev, 1);
 	if (!(flag & REF_ISSYMREF))
 		old.path = NULL;
@@ -604,6 +619,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		OPT_END(),
 	};
 	int has_dash_dash;
+	int flag;
 
 	memset(&opts, 0, sizeof(opts));
 	memset(&new, 0, sizeof(new));
@@ -671,6 +687,15 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		arg = argv[0];
 		has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
 
+		if (!strcmp(arg, "-")) {
+			arg = resolve_ref("LAST_HEAD", rev, 0, &flag);
+			if (!arg)
+				die("No last branch saved.");
+			if(!prefixcmp(arg, "refs/heads/"))
+				arg += 11;
+			arg = strdup(arg);
+		}
+
 		if (get_sha1(arg, rev)) {
 			if (has_dash_dash)          /* case (1) */
 				die("invalid reference: %s", arg);
diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh
new file mode 100755
index 0000000..320f6eb
--- /dev/null
+++ b/t/t2012-checkout-last.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='checkout can switch to last branch'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	echo hello >world &&
+	git add world &&
+	git commit -m initial &&
+	git branch other &&
+	echo "hello again" >>world &&
+	git add world &&
+	git commit -m second
+'
+
+test_expect_success '"checkout -" does not work initially' '
+	test_must_fail git checkout -
+'
+
+test_expect_success 'first branch switch' '
+	git checkout other
+'
+
+test_expect_success '"checkout -" switches back' '
+	git checkout - &&
+	test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
+'
+
+test_expect_success '"checkout -" switches forth' '
+	git checkout - &&
+	test "z$(git symbolic-ref HEAD)" = "zrefs/heads/other"
+'
+
+test_expect_success 'detach HEAD' '
+	git checkout $(git rev-parse HEAD)
+'
+
+test_expect_success '"checkout -" attaches again' '
+	git checkout - &&
+	test "z$(git symbolic-ref HEAD)" = "zrefs/heads/other"
+'
+
+test_expect_success '"checkout -" detaches again' '
+	git checkout - &&
+	test "z$(git rev-parse HEAD)" = "z$(git rev-parse other)" &&
+	test_must_fail git symbolic-ref HEAD
+'
+
+test_done
-- 
1.6.1.282.gae4091.dirty

^ permalink raw reply related

* Re: [PATCH v3] parse-opt: migrate builtin-ls-files.
From: Miklos Vajna @ 2009-01-15  0:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pierre Habouzit, git
In-Reply-To: <1231376145-32331-1-git-send-email-vmiklos@frugalware.org>

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

On Thu, Jan 08, 2009 at 01:55:45AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
>  builtin-ls-files.c |  294 ++++++++++++++++++++++++++++------------------------
>  1 files changed, 159 insertions(+), 135 deletions(-)

Hi Junio,

Was this dropped on the floor by accident?

Thanks.

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

^ permalink raw reply

* Re: [PATCH] git-am: add --directory=<dir> option
From: Junio C Hamano @ 2009-01-15  0:21 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: git, Simon 'corecode' Schubert, Kevin Ballard
In-Reply-To: <20090114234602.GD32313@leksak.fem-net>

Stephan Beyer <s-beyer@gmx.net> writes:

> Do I have a thinko or should it be this:
>
> +		sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
> 		                   ^^
> 			(added for escaping ' outside single quotes)

Almost.

Certainly my original was bad; shell unquotes to "s/'/'\''/g", but that
backslash is not protected from further interpretation by sed, which
happily turns backslash-single quote into a single quote, which I forgot.

You feed "s/'/'\\\''/g" which correctly protects one backslash from sed by
doubling it, but it has one unnecessary extra backslash.  The extra one
does not hurt because the backslash + single quote is eaten by sed to
produce a single quote, but it is not quite right.

We should be feeding sed with "s/'/'\\''/g", so you need to add one
backslash to mine.

> Have you forgotten to add the files prefixed with "am-test-5-" or is this
> patch based on another one?

The one I actually queued is b47dfe9 (git-am: add --directory=<dir>
option, 2009-01-11) and it does include these test vectors.  My bad.

This patch is relative to b47dfe9.

-- >8 --
Fix git-am shell quoting

Noticed by Stephan Beyer; the new test is mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-am.sh             |    2 +-
 t/t4252-am-options.sh |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git c/git-am.sh w/git-am.sh
index 7e6329b..4beb12d 100755
--- c/git-am.sh
+++ w/git-am.sh
@@ -38,7 +38,7 @@ sq () {
 	for sqarg
 	do
 		printf "%s" "$sqarg" |
-		sed -e 's/'\''/'\''\'\'''\''/g' -e 's/.*/ '\''&'\''/'
+		sed -e 's/'\''/'\''\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
 	done
 }
 
diff --git c/t/t4252-am-options.sh w/t/t4252-am-options.sh
index e91a6da..5fdd188 100755
--- c/t/t4252-am-options.sh
+++ w/t/t4252-am-options.sh
@@ -58,4 +58,12 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' '
 	grep One "frotz nitfol/file-5"
 '
 
+test_expect_success 'apply to a funny path' '
+	with_sq="with'\''sq"
+	rm -fr .git/rebase-apply &&
+	git reset --hard initial &&
+	git am --directory="$with_sq" "$tm"/am-test-5-2 &&
+	test -f "$with_sq/file-5"
+'
+
 test_done

^ permalink raw reply related

* [RFC PATCH] Make the rebase edit mode really end up in an edit state
From: Anders Melchiorsen @ 2009-01-15  0:27 UTC (permalink / raw)
  To: git; +Cc: gitster, Johannes.Schindelin

Previously, the interactive rebase edit mode placed the user after the
commit in question. That was awkward because a commit is supposedly
immutable. Thus, she was forced to use "git commit --amend" for her
changes.

To improve on this UI, we now issue "git reset --soft HEAD^" before
exiting to the user. This puts the changes in the index, editable in
the Git sense. It also makes sure that a pre-filled editor is fired up
when doing "git rebase --continue", in case the user just wanted to
fix the commit message.

The revised UI is close to the situation in a merge/rebase conflict,
and thus familiar to the user.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
---


I always have a hard time figuring out what to do during an
interactive rebase. Recently, it dawned on me that the reason is that
I have to do different things: one thing when editing on purpose, and
a different thing when resolving a conflict. So my fingers never learn.

With this change, I propose to make the UI more uniform. I think that
the new way is more intuitive, too, if you will agree that a Git UI
can be intuitive.

As I expect this to not be acceptable due to compatibility concerns, I
have not tested it much. The patch is mostly to catch some attention,
but I will be happy to complete it if there is interest in the change.

It was surprising for me to find the needed code already present. Now
I know that I do not have to do "git commit --amend", it will happen
automatically if I add some files. That trick alone is worth the time
that I have spent on this :-).


Cheers,
Anders.


 Documentation/git-rebase.txt |   10 ++++------
 git-rebase--interactive.sh   |   29 ++++++++---------------------
 2 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 32f0f12..3442a68 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -320,9 +320,8 @@ not look at them but at the commit names ("deadbee" and "fa1afe1" in this
 example), so do not delete or edit the names.
 
 By replacing the command "pick" with the command "edit", you can tell
-'git-rebase' to stop after applying that commit, so that you can edit
-the files and/or the commit message, amend the commit, and continue
-rebasing.
+'git-rebase' to stop after applying that commit. You are free to make
+further modifications before you continue rebasing.
 
 If you want to fold two or more commits into one, replace the command
 "pick" with "squash" for the second and subsequent commit.  If the
@@ -375,9 +374,8 @@ add other commits.  This can be used to split a commit into two:
 
 - Mark the commit you want to split with the action "edit".
 
-- When it comes to editing that commit, execute `git reset HEAD^`.  The
-  effect is that the HEAD is rewound by one, and the index follows suit.
-  However, the working tree stays the same.
+- When it comes to editing that commit, execute `git reset`.  The effect
+  is that the changes in the commit are now only in the working tree.
 
 - Now add the changes to the index that you want to have in the first
   commit.  You can use `git add` (possibly interactively) or
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index bdec43c..0fe678f 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -274,7 +274,7 @@ peek_next_command () {
 
 do_next () {
 	rm -f "$DOTEST"/message "$DOTEST"/author-script \
-		"$DOTEST"/amend || exit
+		|| exit
 	read command sha1 rest < "$TODO"
 	case "$command" in
 	'#'*|'')
@@ -294,13 +294,13 @@ do_next () {
 		pick_one $sha1 ||
 			die_with_patch $sha1 "Could not apply $sha1... $rest"
 		make_patch $sha1
-		git rev-parse --verify HEAD > "$DOTEST"/amend
+		git reset --soft HEAD^ ||
+			die "Cannot rewind the HEAD"
 		warn "Stopped at $sha1... $rest"
-		warn "You can amend the commit now, with"
 		warn
-		warn "	git commit --amend"
-		warn
-		warn "Once you are satisfied with your changes, run"
+		warn "You can edit the commit now. When you are satisfied,"
+		warn "mark the corrected paths with 'git add <paths>', and"
+		warn "then run"
 		warn
 		warn "	git rebase --continue"
 		warn
@@ -442,22 +442,9 @@ do
 		else
 			. "$DOTEST"/author-script ||
 				die "Cannot find the author identity"
-			amend=
-			if test -f "$DOTEST"/amend
-			then
-				amend=$(git rev-parse --verify HEAD)
-				test "$amend" = $(cat "$DOTEST"/amend) ||
-				die "\
-You have uncommitted changes in your working tree. Please, commit them
-first and then run 'git rebase --continue' again."
-				git reset --soft HEAD^ ||
-				die "Cannot rewind the HEAD"
-			fi
 			export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
-			git commit --no-verify -F "$DOTEST"/message -e || {
-				test -n "$amend" && git reset --soft $amend
+			git commit --no-verify -F "$DOTEST"/message -e ||
 				die "Could not commit staged changes."
-			}
 		fi
 
 		require_clean_work_tree
@@ -590,7 +577,7 @@ first and then run 'git rebase --continue' again."
 #
 # Commands:
 #  p, pick = use commit
-#  e, edit = use commit, but stop for amending
+#  e, edit = use commit, but stop for editing
 #  s, squash = use commit, but meld into previous commit
 #
 # If you remove a line here THAT COMMIT WILL BE LOST.
-- 
1.6.0.2.514.g23abd3

^ permalink raw reply related

* Re: [PATCH replacement for take 3 4/4] color-words: take an optional regular expression describing words
From: Thomas Rast @ 2009-01-15  0:32 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Santi Béjar, Junio C Hamano, Teemu Likonen
In-Reply-To: <alpine.DEB.1.00.0901142145200.3586@pacific.mpi-cbg.de>

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

Johannes Schindelin wrote:
> 	This basically contains the fix I sent earlier.

Unfortunately I found another case where it breaks.  It even comes
with a fairly neat test case:

  $ g diff --no-index test_a test_b
  diff --git 1/test_a 2/test_b
  index 289cb9d..2d06f37 100644
  --- 1/test_a
  +++ 2/test_b
  @@ -1 +1 @@
  -(:
  +(
  $ g diff --no-index --color-words='.' test_a test_b
  diff --git 1/test_a 2/test_b
  index 289cb9d..2d06f37 100644
  --- 1/test_a
  +++ 2/test_b
  @@ -1 +1 @@
  :(

-- 
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 submodule merge madness
From: Sverre Rabbelier @ 2009-01-15  0:32 UTC (permalink / raw)
  To: Ask Bjørn Hansen; +Cc: Johannes Schindelin, git
In-Reply-To: <AE1922C4-0543-424B-A635-494445E17E45@develooper.com>

On Thu, Jan 15, 2009 at 00:49, Ask Bjørn Hansen <ask@develooper.com> wrote:
> On Jan 14, 2009, at 2:55 PM, Johannes Schindelin wrote:
>> 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)?
>
> IIRC I tried 1.6.1 and master as of about a week ago.
>
> I don't see d5a84fb in my repository (and google doesn't find it referenced
> anywhere when I search for "directory/submodule conflicts".

I checked current master:
$ git log --grep="fail gracefully with"
returns nothing. Searching the archive I don't see any reference to
"fail gracefully with" either. I don't see it on your gitweb [0]
either. Did that commit magically dissapear?

[0] http://repo.or.cz/w/git/dscho.git

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* [PATCH] Make t3411 executable
From: Miklos Vajna @ 2009-01-15  0:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

I just wanted had an old script, which did:

for i in *merge*
do
        ./$i
        if [ $? != 0 ]; then
		...
        fi
done

which pointed out this permission problem.

 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 t/t3411-rebase-preserve-around-merges.sh

diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh
old mode 100644
new mode 100755
-- 
1.6.1

^ permalink raw reply

* Re: git submodule merge madness
From: Johannes Schindelin @ 2009-01-15  0:36 UTC (permalink / raw)
  To: Ask Bjørn Hansen; +Cc: git
In-Reply-To: <AE1922C4-0543-424B-A635-494445E17E45@develooper.com>

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

Hi,

On Wed, 14 Jan 2009, Ask Bjørn Hansen wrote:

> On Jan 14, 2009, at 2:55 PM, Johannes Schindelin 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)?
> 
> IIRC I tried 1.6.1 and master as of about a week ago.
> 
> I don't see d5a84fb in my repository (and google doesn't find it referenced
> anywhere when I search for "directory/submodule conflicts".

Well.  Can do arithmetics in my head after midnight, but not think 
straight...

In any case, could you please provide a patch to the testsuite 
demonstrating the problem?  History shows that such patches are very 
helpful.

Ciao,
Dscho

^ permalink raw reply

* Re: [Q] git rebase -i -p conflicts with squash
From: Johannes Schindelin @ 2009-01-15  0:38 UTC (permalink / raw)
  To: Constantine Plotnikov; +Cc: git
In-Reply-To: <85647ef50901140813r6e62ae53u1dbcd48cc472dbcc@mail.gmail.com>

Hi,

On Wed, 14 Jan 2009, Constantine Plotnikov wrote:

> If I run git rebase --interactive with --preserve-merges option and 
> select "squash" for one of the commit, the rebase process fails with the 
> message "Refusing to squash a merge: 
> 5e775c536654640c173ba71a0af7e84bf8bc618a". However the neither commit 
> participating in the squash is a merge commit. Even more, there are no 
> merge commits in the repository at all.
> 
> From my limited understanding of squash operation, it should fail only 
> if one of squashed commits is a merge commit, but it should be possible 
> to squash non-merge commits without problem as it looks like quite safe 
> and local operation (and I might want to preserve merges that happened 
> after squashed commits). Is it the current behaviour a bug or a feature?

>From your description, it seems that you are hitting an ordering bug of 
rebase -i -p.

But without a reproduction recipe (preferably as a patch against our 
testsuite), I cannot tell.

Ciao,
Dscho

^ permalink raw reply

* Re: [RFC PATCH] Make the rebase edit mode really end up in an edit state
From: Junio C Hamano @ 2009-01-15  0:43 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git, Johannes.Schindelin
In-Reply-To: <87ab9th0rh.fsf@cup.kalibalik.dk>

Anders Melchiorsen <mail@cup.kalibalik.dk> writes:

> I always have a hard time figuring out what to do during an
> interactive rebase. Recently, it dawned on me that the reason is that
> I have to do different things: one thing when editing on purpose, and
> a different thing when resolving a conflict. So my fingers never learn.
>
> With this change, I propose to make the UI more uniform. I think that
> the new way is more intuitive, too, if you will agree that a Git UI
> can be intuitive.
>
> As I expect this to not be acceptable due to compatibility concerns, I
> have not tested it much. The patch is mostly to catch some attention,
> but I will be happy to complete it if there is interest in the change.
>
> It was surprising for me to find the needed code already present. Now
> I know that I do not have to do "git commit --amend", it will happen
> automatically if I add some files. That trick alone is worth the time
> that I have spent on this :-).

We may need a version bump to 1.7.0 to update the UI for this command, but 
please do test rigorously to build a stronger case for a saner UI.

I've always had trouble with the instruction we give for splitting one
commit into two using the interactive rebase in the documentation, as it
always had a strong "Huh?" effect on me when it suddenly starts talking
about doing a "git reset HEAD^"; I suspect your change may improve this
situation quite a bit.

^ permalink raw reply

* Re: [PATCH] checkout: implement "-" shortcut name for last branch
From: Johannes Schindelin @ 2009-01-15  0:45 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Junio C Hamano
In-Reply-To: <1231977976-8739-1-git-send-email-trast@student.ethz.ch>

Hi,

On Thu, 15 Jan 2009, Thomas Rast wrote:

> Let git-checkout save the old branch as a symref in LAST_HEAD, and
> make 'git checkout -' switch back to LAST_HEAD, like 'cd -' does in
> the shell.

Actually, what you want is in the reflog, no?  So... parsing 
.git/logs/HEAD for the latest occurrence of "checkout: moving from " and 
then using everything up until the next space should give you the branch 
name, right?

It could be a SHA-1, though, if the last branch switch was from a detached 
HEAD, though.

Ciao,
Dscho

^ permalink raw reply

* Re: [RFC PATCH] Make the rebase edit mode really end up in an edit state
From: Stephan Beyer @ 2009-01-15  0:49 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git, gitster, Johannes.Schindelin
In-Reply-To: <87ab9th0rh.fsf@cup.kalibalik.dk>

Hi,

Anders Melchiorsen wrote:
> As I expect this to not be acceptable due to compatibility concerns, I
> have not tested it much. The patch is mostly to catch some attention,
> but I will be happy to complete it if there is interest in the change.

I think I like it and I think it's not the first time this comes up on
the list. (Not sure, and too lazy to grab the archives.)

Also, in the design process of "git-sequencer" we (at least my mentors
and I) discussed about doing this ("edit" vs "pause"), too, but it is
always bad to change behavior many people are used, too.
But sequencer instructions support options. So this could be solved as
an option for "edit", e.g. "edit --no-commit" (or "edit -n").

So I'm writing this on my TODO list for the time after sequencer is
merged into git...

Regards,
  Stephan

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

^ permalink raw reply

* Re: [RFC PATCH] Make the rebase edit mode really end up in an edit state
From: Johannes Schindelin @ 2009-01-15  0:53 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git, gitster
In-Reply-To: <87ab9th0rh.fsf@cup.kalibalik.dk>

Hi,

On Thu, 15 Jan 2009, Anders Melchiorsen wrote:

> Previously, the interactive rebase edit mode placed the user after the 
> commit in question. That was awkward because a commit is supposedly 
> immutable. Thus, she was forced to use "git commit --amend" for her 
> changes.

Maybe, maybe not.  I frequently rebase with "edit" when I actually mean 
"stop" (but "s" was taken from "squash" already).  Then I test things, 
possibly fixing them.

So in that case, I do not want a git reset --soft HEAD^.

In any case, there is a pretty obvious difference between a merge conflict 
and a stop at "edit": the latter even shows you a pretty verbose 
explanation what to do next.

I also have to admit that it escapes me why you would want to force a new 
commit if nothing was changed to begin with.

However, I often would like to have "amend message" or some such, and I 
remember having seen patches, but I do not remember why they did not make 
it in.

Ciao,
Dscho

^ permalink raw reply

* [RFC PATCH] Zooko's merge testcase
From: Miklos Vajna @ 2009-01-15  0:53 UTC (permalink / raw)
  To: git; +Cc: zooko

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

The original page is here:

https://zooko.com/badmerge/simple.html

IIRC it was Robin who mentioned it on IRC.

I obviously not send this patch for inclusion, but to raise a
discussion: if I were a naive user I would think the merge will at least
result in a conflict, however actually it just gaves a wrong result.

 t/t7608-merge-zooko.sh |   88 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100755 t/t7608-merge-zooko.sh

diff --git a/t/t7608-merge-zooko.sh b/t/t7608-merge-zooko.sh
new file mode 100755
index 0000000..32609c0
--- /dev/null
+++ b/t/t7608-merge-zooko.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+test_description='git merge
+
+Testing merge with the examples of Zooko.'
+
+. ./test-lib.sh
+
+#
+# A - D     \
+#   \ B - C - E
+#
+test_expect_success 'setup' '
+	cat <<EOF >file &&
+A
+B
+C
+D
+E
+EOF
+	git add file &&
+	git commit -m A &&
+	git tag A &&
+	cat <<EOF >file &&
+G
+G
+G
+A
+B
+C
+D
+E
+EOF
+	git add file &&
+	git commit -m B &&
+	git tag B &&
+	cat <<EOF >file &&
+A
+B
+C
+D
+E
+G
+G
+G
+A
+B
+C
+D
+E
+EOF
+	git add file &&
+	git commit -m C &&
+	git tag C &&
+	git reset --hard A &&
+	cat <<EOF >file &&
+A
+B
+X
+D
+E
+EOF
+	git add file &&
+	git commit -m D &&
+	git tag D
+'
+
+test_expect_failure 'merge C' '
+	cat <<EOF >expected &&
+A
+B
+C
+D
+E
+G
+G
+G
+A
+B
+X
+D
+E
+EOF
+	git merge C &&
+	test_cmp expected file
+'
+
+test_done
-- 
1.6.1

^ permalink raw reply related

* [PATCH/RFC v1 1/1] +5 cases (4 fail), diff whitespace tests
From: Keith Cascio @ 2009-01-15  0:48 UTC (permalink / raw)
  To: git

  +5 cases (4 fail), diff whitespace tests
  There are 2^3 = eight possible combinations of the three flags:
  -w -b --ignore-space-at-eol
  Three of those combinations were already being tested:
  [none]
  -w
  -b
  Add tests of the other five combinations,
  four of which fail with git
  3cf3b838c7b379824c68ee87799aaaa9028b36cd
  from Tue Jan 13 23:41:32 2009 -0800.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---

All four failures involve combining whitespace ignore options.  It's likely the 
fix will involve one or both of the following two functions in xdiff/xutils.c:
xdl_hash_record_with_whitespace()
xdl_recmatch()

I played around with it and discovered I could make
"git diff -b --ignore-space-at-eol" work by changing
if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
to
else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
But I don't know if that would break something else.

                                          -- Keith

  t/t4015-diff-whitespace.sh |   27 +++++++++++++++++++++++++++
  1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index fc2307e..dbb608c 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -98,6 +98,12 @@ index d99af23..8b32fb5 100644
  EOF
  git diff -w > out
  test_expect_success 'another test, with -w' 'test_cmp expect out'
+git diff -w -b > out
+test_expect_failure 'another test, with -w -b' 'test_cmp expect out'
+git diff -w --ignore-space-at-eol > out
+test_expect_failure 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
+git diff -w -b --ignore-space-at-eol > out
+test_expect_failure 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'

  tr 'Q' '\015' << EOF > expect
  diff --git a/x b/x
@@ -116,6 +122,27 @@ index d99af23..8b32fb5 100644
  EOF
  git diff -b > out
  test_expect_success 'another test, with -b' 'test_cmp expect out'
+git diff -b --ignore-space-at-eol > out
+test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
+
+tr 'Q' '\015' << EOF > expect
+diff --git a/x b/x
+index d99af23..8b32fb5 100644
+--- a/x
++++ b/x
+@@ -1,6 +1,6 @@
+-whitespace at beginning
+-whitespace change
+-whitespace in the middle
++	whitespace at beginning
++whitespace 	 change
++white space in the middle
+ whitespace at end
+ unchanged line
+ CR at endQ
+EOF
+git diff --ignore-space-at-eol > out
+test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect out'

  test_expect_success 'check mixed spaces and tabs in indent' '

-- 
1.6.1.137.gb17b6

^ permalink raw reply related

* Re: [PATCH] git-am: add --directory=<dir> option
From: Stephan Beyer @ 2009-01-15  1:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Simon 'corecode' Schubert, Kevin Ballard
In-Reply-To: <7vzlhtxvu5.fsf@gitster.siamese.dyndns.org>

Hi,

Junio C Hamano wrote:
> > Do I have a thinko or should it be this:
> >
> > +		sed -e 's/'\''/'\''\\\'\'''\''/g' -e 's/.*/ '\''&'\''/'
> > 		                   ^^
> > 			(added for escaping ' outside single quotes)
> 
> Almost.
> 
> Certainly my original was bad; shell unquotes to "s/'/'\''/g", but that
> backslash is not protected from further interpretation by sed, which
> happily turns backslash-single quote into a single quote, which I forgot.
> 
> You feed "s/'/'\\\''/g" which correctly protects one backslash from sed by
> doubling it, but it has one unnecessary extra backslash.

My attempt was to escape one backslash and to escape one single quote.

> The extra one
> does not hurt because the backslash + single quote is eaten by sed to
> produce a single quote, but it is not quite right.

Well, this explains why my syntax highlighting has "gone mad" in your
former and in my version.

> We should be feeding sed with "s/'/'\\''/g", so you need to add one
> backslash to mine.

Ok, works like a charm :-)

> > Have you forgotten to add the files prefixed with "am-test-5-" or is this
> > patch based on another one?
> 
> The one I actually queued is b47dfe9 (git-am: add --directory=<dir>
> option, 2009-01-11) and it does include these test vectors.  My bad.

Ohh, I did not even notice that you queued it, because I do not track "next".

And in my git-am.txt snippet I even forgot adding the option to the synopsis.
Oh, boy. :-)

I think it's fine now. :-)

Regards,
  Stephan

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

^ permalink raw reply

* Re: [PATCH replacement for take 3 4/4] color-words: take an optional regular expression describing words
From: Johannes Schindelin @ 2009-01-15  1:12 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, Santi Béjar, Junio C Hamano, Teemu Likonen
In-Reply-To: <200901150132.14106.trast@student.ethz.ch>

Hi,

On Thu, 15 Jan 2009, Thomas Rast wrote:

> Johannes Schindelin wrote:
> > 	This basically contains the fix I sent earlier.
> 
> Unfortunately I found another case where it breaks.  It even comes
> with a fairly neat test case:
> 
>   $ g diff --no-index test_a test_b
>   diff --git 1/test_a 2/test_b
>   index 289cb9d..2d06f37 100644
>   --- 1/test_a
>   +++ 2/test_b
>   @@ -1 +1 @@
>   -(:
>   +(

The diff of the words would look like this:

diff --git a/a1 b/a2
index 8309acb..2d06f37 100644
--- a/a1
+++ b/a2
@@ -2 +1,0 @@
-:


Notice the "+1,0"?  I fully expected this to be "+2,0", but apparently I 
was mistaken...

Can anybody explain to me why this is so?

Ciao,
Dscho

^ 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