git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (unknown), 
@ 2012-02-09 23:58 Zbigniew Jędrzejewski-Szmek
  2012-02-09 23:58 ` [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes Zbigniew Jędrzejewski-Szmek
                   ` (3 more replies)
  0 siblings, 4 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-09 23:58 UTC (permalink / raw)
  To: git; +Cc: gitster, Michael J Gruber

Hi,

this is a patch series to make 'git diff --stat' use full terminal
width instead of hard-coded 80 columns.

This is quite useful when working on projects with nested directory
structure, e.g. Java:
 .../{ => workspace/tasks}/GetTaskResultAction.java |   10 +-
 .../tasks}/RemoveAllAbortedTasksAction.java        |    7 +-
 .../tasks}/RemoveAllFailedTasksAction.java         |    7 +-
is changed to display full paths if the terminal window is wide
enough.

Git usually uses the full terminal width automatically, so it should
do so with --stat too.

The "big" functional change in the patch series is s/80/term_columns()/
in show_stats(). The fourth patch also changes the partitioning of
available columns to dedicate more space to file names.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes
  2012-02-09 23:58 (unknown), Zbigniew Jędrzejewski-Szmek
@ 2012-02-09 23:58 ` Zbigniew Jędrzejewski-Szmek
  2012-02-10  0:46   ` Junio C Hamano
  2012-02-09 23:58 ` [PATCH 2/4] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-09 23:58 UTC (permalink / raw)
  To: git; +Cc: gitster, Michael J Gruber, Zbigniew Jędrzejewski-Szmek

git_version_string is declared in builtins.h, but lived in git.c.

When diff.c starts to use functions from help.c, linking against
libgit.a will fail, unless git.o containing git_version_string is
linked too. This variable is only used in a couple of places, help.c
being one of them. git.o is biggish, so it let's move
git_version_string to help.c.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 Makefile |    5 +++--
 git.c    |    2 --
 help.c   |    2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index a782409..264fe4f 100644
--- a/Makefile
+++ b/Makefile
@@ -1851,7 +1851,7 @@ strip: $(PROGRAMS) git$X
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
 
 git.o: common-cmds.h
-git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
+git.sp git.s git.o: EXTRA_CPPFLAGS = \
 	'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
 	'-DGIT_MAN_PATH="$(mandir_SQ)"' \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
@@ -1860,7 +1860,8 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.sp help.o: common-cmds.h
+help.o: common-cmds.h
+help.sp help.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"'
 
 builtin/help.sp builtin/help.o: common-cmds.h
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
diff --git a/git.c b/git.c
index 3805616..a24a0fd 100644
--- a/git.c
+++ b/git.c
@@ -256,8 +256,6 @@ static int handle_alias(int *argcp, const char ***argv)
 	return ret;
 }
 
-const char git_version_string[] = GIT_VERSION;
-
 #define RUN_SETUP		(1<<0)
 #define RUN_SETUP_GENTLY	(1<<1)
 #define USE_PAGER		(1<<2)
diff --git a/help.c b/help.c
index cbbe966..bc15066 100644
--- a/help.c
+++ b/help.c
@@ -409,6 +409,8 @@ const char *help_unknown_cmd(const char *cmd)
 	exit(1);
 }
 
+const char git_version_string[] = GIT_VERSION;
+
 int cmd_version(int argc, const char **argv, const char *prefix)
 {
 	printf("git version %s\n", git_version_string);
-- 
1.7.9.rc2.127.gcb239

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 2/4] help.c: make term_columns() cached and export it
  2012-02-09 23:58 (unknown), Zbigniew Jędrzejewski-Szmek
  2012-02-09 23:58 ` [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes Zbigniew Jędrzejewski-Szmek
@ 2012-02-09 23:58 ` Zbigniew Jędrzejewski-Szmek
  2012-02-10  0:50   ` Junio C Hamano
  2012-02-09 23:58 ` [PATCH 3/4] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
  2012-02-09 23:58 ` [PATCH 4/4] diff --stat: use most of the space for file names Zbigniew Jędrzejewski-Szmek
  3 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-09 23:58 UTC (permalink / raw)
  To: git; +Cc: gitster, Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Since term_columns() will usually fail, when a pager is installed,
the cache is primed before the pager is installed. If a pager is not
installed, then the cache will be set on first use.

Conforms to The Single UNIX Specification, Version 2
(http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 help.c  |   31 +++++++++++++++++++++++--------
 help.h  |    2 ++
 pager.c |    5 +++++
 3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/help.c b/help.c
index bc15066..75b8d4b 100644
--- a/help.c
+++ b/help.c
@@ -5,26 +5,41 @@
 #include "help.h"
 #include "common-cmds.h"
 
-/* most GUI terminals set COLUMNS (although some don't export it) */
-static int term_columns(void)
+/* cache for term_columns() value. Set on first use or when
+ * installing a pager and replacing stdout.
+ */
+static int term_columns_cache;
+
+/* Return cached value (iff set) or $COLUMNS (iff set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ */
+int term_columns(void)
 {
-	char *col_string = getenv("COLUMNS");
-	int n_cols;
+	if (term_columns_cache)
+		return term_columns_cache;
 
-	if (col_string && (n_cols = atoi(col_string)) > 0)
-		return n_cols;
+	{
+		char *col_string = getenv("COLUMNS");
+		int n_cols;
+
+		if (col_string && (n_cols = atoi(col_string)) > 0)
+			return (term_columns_cache = n_cols);
+	}
 
 #ifdef TIOCGWINSZ
 	{
 		struct winsize ws;
 		if (!ioctl(1, TIOCGWINSZ, &ws)) {
 			if (ws.ws_col)
-				return ws.ws_col;
+				return (term_columns_cache = ws.ws_col);
 		}
 	}
 #endif
 
-	return 80;
+	return (term_columns_cache = 80);
 }
 
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
diff --git a/help.h b/help.h
index b6b12d5..880a4b4 100644
--- a/help.h
+++ b/help.h
@@ -29,4 +29,6 @@ extern void list_commands(const char *title,
 			  struct cmdnames *main_cmds,
 			  struct cmdnames *other_cmds);
 
+extern int term_columns(void);
+
 #endif /* HELP_H */
diff --git a/pager.c b/pager.c
index 975955b..e7032de 100644
--- a/pager.c
+++ b/pager.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "run-command.h"
 #include "sigchain.h"
+#include "help.h"
 
 #ifndef DEFAULT_PAGER
 #define DEFAULT_PAGER "less"
@@ -76,6 +77,10 @@ void setup_pager(void)
 	if (!pager)
 		return;
 
+	/* prime the term_columns() cache before it is too
+	 * late and stdout is replaced */
+	(void) term_columns();
+
 	setenv("GIT_PAGER_IN_USE", "true", 1);
 
 	/* spawn the pager */
-- 
1.7.9.rc2.127.gcb239

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 3/4] diff --stat: use the real terminal width
  2012-02-09 23:58 (unknown), Zbigniew Jędrzejewski-Szmek
  2012-02-09 23:58 ` [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes Zbigniew Jędrzejewski-Szmek
  2012-02-09 23:58 ` [PATCH 2/4] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
@ 2012-02-09 23:58 ` Zbigniew Jędrzejewski-Szmek
  2012-02-10  0:54   ` Junio C Hamano
  2012-02-10  6:15   ` Nguyen Thai Ngoc Duy
  2012-02-09 23:58 ` [PATCH 4/4] diff --stat: use most of the space for file names Zbigniew Jędrzejewski-Szmek
  3 siblings, 2 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-09 23:58 UTC (permalink / raw)
  To: git; +Cc: gitster, Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the stat output can be almost useless. If the middle part
between { and } is long (because the file was moved to a completely
different directory), then most of the path would be truncated.

It makes sense to use the full terminal width.

The output is still not optimal, because too many columns are devoted
to +- output, and not enough to filenames, but this is a policy
question, changed in next commit.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 diff.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 7e15426..8406a0d 100644
--- a/diff.c
+++ b/diff.c
@@ -7,6 +7,7 @@
 #include "diffcore.h"
 #include "delta.h"
 #include "xdiff-interface.h"
+#include "help.h"
 #include "color.h"
 #include "attr.h"
 #include "run-command.h"
@@ -1341,7 +1342,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		line_prefix = msg->buf;
 	}
 
-	width = options->stat_width ? options->stat_width : 80;
+	width = options->stat_width ? options->stat_width : term_columns();
 	name_width = options->stat_name_width ? options->stat_name_width : 50;
 	count = options->stat_count ? options->stat_count : data->nr;
 
-- 
1.7.9.rc2.127.gcb239

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 4/4] diff --stat: use most of the space for file names
  2012-02-09 23:58 (unknown), Zbigniew Jędrzejewski-Szmek
                   ` (2 preceding siblings ...)
  2012-02-09 23:58 ` [PATCH 3/4] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
@ 2012-02-09 23:58 ` Zbigniew Jędrzejewski-Szmek
  2012-02-10  0:55   ` Junio C Hamano
  3 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-09 23:58 UTC (permalink / raw)
  To: git; +Cc: gitster, Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 diff.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 8406a0d..6220190 100644
--- a/diff.c
+++ b/diff.c
@@ -1343,7 +1343,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	}
 
 	width = options->stat_width ? options->stat_width : term_columns();
-	name_width = options->stat_name_width ? options->stat_name_width : 50;
+	name_width = options->stat_name_width ? options->stat_name_width
+		: term_columns() - 20; /* the graph defaults to 20 columns */
 	count = options->stat_count ? options->stat_count : data->nr;
 
 	/* Sanity: give at least 5 columns to the graph,
-- 
1.7.9.rc2.127.gcb239

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes
  2012-02-09 23:58 ` [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes Zbigniew Jędrzejewski-Szmek
@ 2012-02-10  0:46   ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10  0:46 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> git_version_string is declared in builtins.h, but lived in git.c.
>
> When diff.c starts to use functions from help.c, linking against
> libgit.a will fail,  unless git.o containing git_version_string is
> linked too.

Sorry, it is unclear what you mean by the above, nor why you need this
change in the first place. The resulting diff.o will certainly linked to
git.o as it does not have its own "main()" at all.  And builtins.h is a
perfect place to declare things that are for the use of built-in commands
like implementations of diff family of commands, as they all are linked
into git.o (namely the commands[] array in handle_internal_command()) to
be usable.

What am I missing from between the lines of your log message?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/4] help.c: make term_columns() cached and export it
  2012-02-09 23:58 ` [PATCH 2/4] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
@ 2012-02-10  0:50   ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10  0:50 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> diff --git a/help.c b/help.c
> index bc15066..75b8d4b 100644
> --- a/help.c
> +++ b/help.c
> @@ -5,26 +5,41 @@
>  #include "help.h"
>  #include "common-cmds.h"
>  
> -/* most GUI terminals set COLUMNS (although some don't export it) */
> -static int term_columns(void)
> +/* cache for term_columns() value. Set on first use or when
> + * installing a pager and replacing stdout.
> + */

Just a style.

	/*
         * We format multi-line
         * comment block like
         * this.
         */

> +static int term_columns_cache;
> +
> +/* Return cached value (iff set) or $COLUMNS (iff set and positive) or
> + * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
> + *
> + * $COLUMNS even if set, is usually not exported, so
> + * the variable can be used to override autodection.
> + */
> +int term_columns(void)
>  {
> -	char *col_string = getenv("COLUMNS");
> -	int n_cols;
> +	if (term_columns_cache)
> +		return term_columns_cache;
>  
> -	if (col_string && (n_cols = atoi(col_string)) > 0)
> -		return n_cols;
> +	{
> +		char *col_string = getenv("COLUMNS");
> +		int n_cols;
> +
> +		if (col_string && (n_cols = atoi(col_string)) > 0)
> +			return (term_columns_cache = n_cols);
> +	}

I can see the justification for the existing one inside the #ifdef below,
but why do you need the extra scope above?

We tend to avoid assignment as a part of another expression.  The old code
already violates that convention, but please do not make it worse by
introducing three new ones.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/4] diff --stat: use the real terminal width
  2012-02-09 23:58 ` [PATCH 3/4] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
@ 2012-02-10  0:54   ` Junio C Hamano
  2012-02-10  6:15   ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10  0:54 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Some projects (especially in Java), have long filename paths, with
> nested directories or long individual filenames. When files are
> renamed, the stat output can be almost useless. If the middle part
> between { and } is long (because the file was moved to a completely
> different directory), then most of the path would be truncated.
>
> It makes sense to use the full terminal width.
>
> The output is still not optimal, because too many columns are devoted
> to +- output, and not enough to filenames, but this is a policy
> question, changed in next commit.
>
> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---
>  diff.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 7e15426..8406a0d 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -7,6 +7,7 @@
>  #include "diffcore.h"
>  #include "delta.h"
>  #include "xdiff-interface.h"
> +#include "help.h"
>  #include "color.h"
>  #include "attr.h"
>  #include "run-command.h"
> @@ -1341,7 +1342,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>  		line_prefix = msg->buf;
>  	}
>  
> -	width = options->stat_width ? options->stat_width : 80;
> +	width = options->stat_width ? options->stat_width : term_columns();

The output from "git format-patch" shouldn't be affected at all by the
width of the terminal the patch sender happened to have used when the
command was run when the user did not explicitly ask a custom width by
giving a --stat-width command line option.

How do you prevent regression to the command in this series?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 4/4] diff --stat: use most of the space for file names
  2012-02-09 23:58 ` [PATCH 4/4] diff --stat: use most of the space for file names Zbigniew Jędrzejewski-Szmek
@ 2012-02-10  0:55   ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10  0:55 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---
>  diff.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 8406a0d..6220190 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1343,7 +1343,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>  	}
>  
>  	width = options->stat_width ? options->stat_width : term_columns();
> -	name_width = options->stat_name_width ? options->stat_name_width : 50;
> +	name_width = options->stat_name_width ? options->stat_name_width
> +		: term_columns() - 20; /* the graph defaults to 20 columns */

Why?  Isn't 80-50 = 30?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/4] diff --stat: use the real terminal width
  2012-02-09 23:58 ` [PATCH 3/4] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
  2012-02-10  0:54   ` Junio C Hamano
@ 2012-02-10  6:15   ` Nguyen Thai Ngoc Duy
  2012-02-10 11:25     ` Zbigniew Jędrzejewski-Szmek
  1 sibling, 1 reply; 206+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-02-10  6:15 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

2012/2/10 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>:
> @@ -1341,7 +1342,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>                line_prefix = msg->buf;
>        }
>
> -       width = options->stat_width ? options->stat_width : 80;
> +       width = options->stat_width ? options->stat_width : term_columns();
>        name_width = options->stat_name_width ? options->stat_name_width : 50;
>        count = options->stat_count ? options->stat_count : data->nr;

I tried this in the past and "git log -p" looked ugly on git.git
mainly because commit messages are still ~70 char long lines on my 279
char wide terminal. If this is project dependent, perhaps a config
key? Also the "50" below the changed line, maybe you want to change it
to 0.6 * width.
-- 
Duy

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/4] diff --stat: use the real terminal width
  2012-02-10  6:15   ` Nguyen Thai Ngoc Duy
@ 2012-02-10 11:25     ` Zbigniew Jędrzejewski-Szmek
  2012-02-10 13:00       ` Nguyen Thai Ngoc Duy
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
  0 siblings, 2 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 11:25 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy, git, gitster; +Cc: Michael J Gruber

On 02/10/2012 07:15 AM, Nguyen Thai Ngoc Duy wrote:
> 2012/2/10 Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>:
>> @@ -1341,7 +1342,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>>                 line_prefix = msg->buf;
>>         }
>>
>> -       width = options->stat_width ? options->stat_width : 80;
>> +       width = options->stat_width ? options->stat_width : term_columns();
>>         name_width = options->stat_name_width ? options->stat_name_width : 50;
>>         count = options->stat_count ? options->stat_count : data->nr;
>
> I tried this in the past and "git log -p" looked ugly on git.git
> mainly because commit messages are still ~70 char long lines on my 279
> char wide terminal. If this is project dependent, perhaps a config
> key? Also the "50" below the changed line, maybe you want to change it
> to 0.6 * width.

Thanks for all the comments. I'll post a newer version, but I have two 
questions:

I agree that making the output very wide with lots of +- is not very 
elegant. (E.g. 8f24a6323ece9be1bf1a04b4b5856112438337f2 has
    builtin/grep.c |  142 +++--------------------------------....--
which doesn't look right.). So I think it would make sense to limit
the graph part to something like 50 columns, even if there's more space.
I believe that git.git would look fine with this change. There are some 
fairly long lines 
(t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master 
is 86 chars) but with 50 columns of graph the output would take 140 
columns -- with the graph part slightly sticking out from the 80 column 
descriptions, but still not too ugly.

Should I add a new option --stat-graph-width in analogy to 
--stat-name-width, or should this be hard-coded?

JC:
 > The output from "git format-patch" shouldn't be affected at all by the
 > width of the terminal the patch sender happened to have used when the
 > command was run when the user did not explicitly ask a custom width by
 > giving a --stat-width command line option.
 >
 > How do you prevent regression to the command in this series?
git format-patch is not affected by default. But with --stdout
the width is changed, iff stdout is a tty. When --stdout output
is connected to a pipe, the width is not changed. I think that
this behaviour is OK.

Should a test be added to check that 'git format-patch --stat' output 
doesn't change? Should I test for something else?

--
Zbyszek

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/4] diff --stat: use the real terminal width
  2012-02-10 11:25     ` Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 13:00       ` Nguyen Thai Ngoc Duy
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
  1 sibling, 0 replies; 206+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-02-10 13:00 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

2012/2/10 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>:
>> I tried this in the past and "git log -p" looked ugly on git.git
>> mainly because commit messages are still ~70 char long lines on my 279
>> char wide terminal. If this is project dependent, perhaps a config
>> key? Also the "50" below the changed line, maybe you want to change it
>> to 0.6 * width.
>
>
> Thanks for all the comments. I'll post a newer version, but I have two
> questions:
>
> I agree that making the output very wide with lots of +- is not very
> elegant. (E.g. 8f24a6323ece9be1bf1a04b4b5856112438337f2 has
>   builtin/grep.c |  142 +++--------------------------------....--
> which doesn't look right.). So I think it would make sense to limit
> the graph part to something like 50 columns, even if there's more space.
> I believe that git.git would look fine with this change. There are some
> fairly long lines
> (t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
> is 86 chars) but with 50 columns of graph the output would take 140 columns
> -- with the graph part slightly sticking out from the 80 column
> descriptions, but still not too ugly.

You also need to pay attention, not to exceed term_columns() because
of this dynamic name part. But the idea sounds good to me.

It would be even better if we had some heuristics to shorten
exceptionally long names with ellipsis, to keep the name part from
being overly stretched.

> Should I add a new option --stat-graph-width in analogy to
> --stat-name-width, or should this be hard-coded?

I don't know about other people, but I have no urge to change graph width.
-- 
Duy

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH 0/3 v2] diff --stat: use the real terminal width
  2012-02-10 11:25     ` Zbigniew Jędrzejewski-Szmek
  2012-02-10 13:00       ` Nguyen Thai Ngoc Duy
@ 2012-02-10 16:39       ` Zbigniew Jędrzejewski-Szmek
  2012-02-10 16:39         ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
                           ` (3 more replies)
  1 sibling, 4 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 16:39 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber

Hi,
this is version 2.
Changes:

- style fixes
- some tests for git-format-patch added
- patches 3 and 4 squashed together, since they touch the same lines
- graph width is limited to 40 columns, even if there's more space
- patch descriptions extended and cleared up

Description (modified):

this is a patch series to make 'git diff --stat' use full terminal
width instead of hard-coded 80 columns.

This is quite useful when working on projects with nested directory
structure, e.g. Java:
 .../{ => workspace/tasks}/GetTaskResultAction.java |   10 +-
 .../tasks}/RemoveAllAbortedTasksAction.java        |    7 +-
 .../tasks}/RemoveAllFailedTasksAction.java         |    7 +-
is changed to display full paths if the terminal window is wide
enough.

Git usually uses the full terminal width automatically, so it should
do so with --stat too.

The "big" functional change in the patch series is
s/80/term_columns()/ in show_stats(). The partitioning of available
columns is changed to dedicate more space to file names and the number
of columns used for +- graph is limited.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH 1/3] Move git_version_string to help.c before diff changes
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 16:39         ` Zbigniew Jędrzejewski-Szmek
  2012-02-10 17:58           ` Junio C Hamano
  2012-02-10 16:39         ` [PATCH 2/3] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 16:39 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

git_version_string lives in git.c. When diff.c starts to use functions
from help.c, which in turn use git_version_string, linking against
libgit.a will fail. This is because git_version_string is physically
located in git.o, and this object file is not part of libgit.a. One
option would be to add git.o to libgit.a, but git.o is biggish. The
second, better option is to move git_version_string to somewhere where
it'll become part of libgit.a. This variable is only used in a couple
of places, help.c being one of them, so it let's move
git_version_string from git.c to help.c. The git binary is linked with
help.o, so it is not affected by this move.

Without this change the next commit would fail with:
$ gcc  -g -O0 -I. -DUSE_LIBPCRE  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS -o git-daemon   daemon.o libgit.a xdiff/lib.a  -lpcre -lz  -lcrypto -lpthread
libgit.a(help.o): In function `cmd_version':
/home/zbyszek/git/git/help.c:435: undefined reference to `git_version_string'

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 Makefile |    5 +++--
 git.c    |    2 --
 help.c   |    2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 4817157..ccafb95 100644
--- a/Makefile
+++ b/Makefile
@@ -1890,7 +1890,7 @@ strip: $(PROGRAMS) git$X
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
 
 git.o: common-cmds.h
-git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
+git.sp git.s git.o: EXTRA_CPPFLAGS = \
 	'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
 	'-DGIT_MAN_PATH="$(mandir_SQ)"' \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
@@ -1899,7 +1899,8 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
-help.sp help.o: common-cmds.h
+help.o: common-cmds.h
+help.sp help.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"'
 
 builtin/help.sp builtin/help.o: common-cmds.h
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
diff --git a/git.c b/git.c
index 3805616..a24a0fd 100644
--- a/git.c
+++ b/git.c
@@ -256,8 +256,6 @@ static int handle_alias(int *argcp, const char ***argv)
 	return ret;
 }
 
-const char git_version_string[] = GIT_VERSION;
-
 #define RUN_SETUP		(1<<0)
 #define RUN_SETUP_GENTLY	(1<<1)
 #define USE_PAGER		(1<<2)
diff --git a/help.c b/help.c
index cbbe966..bc15066 100644
--- a/help.c
+++ b/help.c
@@ -409,6 +409,8 @@ const char *help_unknown_cmd(const char *cmd)
 	exit(1);
 }
 
+const char git_version_string[] = GIT_VERSION;
+
 int cmd_version(int argc, const char **argv, const char *prefix)
 {
 	printf("git version %s\n", git_version_string);
-- 
1.7.9.263.g4be11.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 2/3] help.c: make term_columns() cached and export it
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
  2012-02-10 16:39         ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 16:39         ` Zbigniew Jędrzejewski-Szmek
  2012-02-11  4:36           ` Nguyen Thai Ngoc Duy
  2012-02-10 16:39         ` [PATCH 3/3] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
  2012-02-10 18:24         ` [PATCH 0/3 v2] " Junio C Hamano
  3 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 16:39 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Since term_columns() will usually fail, when a pager is installed,
the cache is primed before the pager is installed. If a pager is not
installed, then the cache will be set on first use.

Conforms to The Single UNIX Specification, Version 2
(http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 help.c  |   37 +++++++++++++++++++++++++++++--------
 help.h  |    2 ++
 pager.c |    5 +++++
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/help.c b/help.c
index bc15066..5d1cb1d 100644
--- a/help.c
+++ b/help.c
@@ -5,26 +5,47 @@
 #include "help.h"
 #include "common-cmds.h"
 
-/* most GUI terminals set COLUMNS (although some don't export it) */
-static int term_columns(void)
+/* 
+ * Cache for term_columns() value. Set on first use or when
+ * installing a pager and replacing stdout.
+ */
+static int term_columns_cache;
+
+/* 
+ * Return cached value (if set) or $COLUMNS (if set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ */
+int term_columns(void)
 {
-	char *col_string = getenv("COLUMNS");
+	char *col_string;
 	int n_cols;
 
-	if (col_string && (n_cols = atoi(col_string)) > 0)
-		return n_cols;
+	if (term_columns_cache)
+		return term_columns_cache;
+
+	col_string = getenv("COLUMNS");
+	if (col_string && (n_cols = atoi(col_string)) > 0) {
+		term_columns_cache = n_cols;
+		return term_columns_cache;
+	}
 
 #ifdef TIOCGWINSZ
 	{
 		struct winsize ws;
 		if (!ioctl(1, TIOCGWINSZ, &ws)) {
-			if (ws.ws_col)
-				return ws.ws_col;
+			if (ws.ws_col) {
+				term_columns_cache = ws.ws_col;
+				return term_columns_cache;
+			}
 		}
 	}
 #endif
 
-	return 80;
+	term_columns_cache = 80;
+	return term_columns_cache;
 }
 
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
diff --git a/help.h b/help.h
index b6b12d5..880a4b4 100644
--- a/help.h
+++ b/help.h
@@ -29,4 +29,6 @@ extern void list_commands(const char *title,
 			  struct cmdnames *main_cmds,
 			  struct cmdnames *other_cmds);
 
+extern int term_columns(void);
+
 #endif /* HELP_H */
diff --git a/pager.c b/pager.c
index 975955b..e7032de 100644
--- a/pager.c
+++ b/pager.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "run-command.h"
 #include "sigchain.h"
+#include "help.h"
 
 #ifndef DEFAULT_PAGER
 #define DEFAULT_PAGER "less"
@@ -76,6 +77,10 @@ void setup_pager(void)
 	if (!pager)
 		return;
 
+	/* prime the term_columns() cache before it is too
+	 * late and stdout is replaced */
+	(void) term_columns();
+
 	setenv("GIT_PAGER_IN_USE", "true", 1);
 
 	/* spawn the pager */
-- 
1.7.9.263.g4be11.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 3/3] diff --stat: use the real terminal width
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
  2012-02-10 16:39         ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
  2012-02-10 16:39         ` [PATCH 2/3] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 16:39         ` Zbigniew Jędrzejewski-Szmek
  2012-02-10 18:24         ` [PATCH 0/3 v2] " Junio C Hamano
  3 siblings, 0 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-10 16:39 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the stat output can be almost useless. If the middle part
between { and } is long (because the file was moved to a completely
different directory), then most of the path would be truncated.

It makes sense to use the full terminal width.

If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph uses the full width,
the output looks bad. Messages wrapped to about 80 columns are
interspersed with very long +- lines. It makes sense to limit the
width of the graph to a fixed value, even if more columns are
available. This fixed value is subjectively hard-coded to be 40
columns, but seems to work well for git.git and linux-2.6.git and
other repositories.

Three tests are added: the first one check that --stat output for a
long file name is the same as previously (the test should pass
independently of this patch). The last two check that --stat output
with a massive change uses only 40 columns for +- in graph output.
Those two tests are dependent on this patch.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 diff.c                  |   26 ++++++++++++++------------
 t/t4014-format-patch.sh |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/diff.c b/diff.c
index 84780fd..8176d74 100644
--- a/diff.c
+++ b/diff.c
@@ -7,6 +7,7 @@
 #include "diffcore.h"
 #include "delta.h"
 #include "xdiff-interface.h"
+#include "help.h"
 #include "color.h"
 #include "attr.h"
 #include "run-command.h"
@@ -1376,7 +1377,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
 	int total_files = data->nr;
-	int width, name_width, count;
+	int width, name_width, graph_width, count;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1390,8 +1391,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		line_prefix = msg->buf;
 	}
 
-	width = options->stat_width ? options->stat_width : 80;
-	name_width = options->stat_name_width ? options->stat_name_width : 50;
+	width = options->stat_width ? options->stat_width : term_columns();
+	name_width = options->stat_name_width ? options->stat_name_width
+		: width * 5/8; /* this gives 50 if not on tty */
 	count = options->stat_count ? options->stat_count : data->nr;
 
 	/* Sanity: give at least 5 columns to the graph,
@@ -1433,14 +1435,14 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	 * 10 is for one blank at the beginning of the line plus
 	 * " | count " between the name and the graph.
 	 *
-	 * From here on, name_width is the width of the name area,
-	 * and width is the width of the graph area.
+	 * From here name_width is the width of the name area,
+	 * and graph_width is the width of the graph area.
+	 * max_change is used to scale graph properly.
 	 */
 	name_width = (name_width < max_len) ? name_width : max_len;
-	if (width < (name_width + 10) + max_change)
-		width = width - (name_width + 10);
-	else
-		width = max_change;
+	graph_width = max_change < 40 ? max_change : 40;
+	if (width < (name_width + 10) + graph_width)
+		graph_width = width - (name_width + 10);
 
 	for (i = 0; i < count; i++) {
 		const char *prefix = "";
@@ -1497,9 +1499,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		adds += add;
 		dels += del;
 
-		if (width <= max_change) {
-			add = scale_linear(add, width, max_change);
-			del = scale_linear(del, width, max_change);
+		if (graph_width <= max_change) {
+			add = scale_linear(add, graph_width, max_change);
+			del = scale_linear(del, graph_width, max_change);
 		}
 		fprintf(options->file, "%s", line_prefix);
 		show_name(options->file, prefix, name, len);
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 7dfe716..bd3002b 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -894,4 +894,44 @@ test_expect_success 'format patch ignores color.ui' '
 	test_cmp expect actual
 '
 
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |	 1 +
+EOF
+name=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+test_expect_success 'format patch filename width is limited' "
+	> ${name} &&
+	git add ${name} &&
+	git commit -m message &&
+	echo a > ${name} &&
+	git commit -m message ${name} &&
+	git format-patch --stat --stdout -1 |
+		grep -m 1 aaaaa > actual &&
+	test_cmp expect actual
+"
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch graph width is 40 columns' '
+	> abcd &&
+	git add abcd &&
+	git commit -m message &&
+	seq 1000 > abcd &&
+	git commit -m message abcd &&
+	git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch ignores COLUMNS' '
+	> abcd &&
+	git add abcd &&
+	git commit -m message &&
+	seq 1000 > abcd &&
+	git commit -m message abcd &&
+	COLUMNS=200 git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
1.7.9.263.g4be11.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3] Move git_version_string to help.c before diff changes
  2012-02-10 16:39         ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 17:58           ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10 17:58 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, pclouds, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> git_version_string lives in git.c. When diff.c starts to use functions
> from help.c, which in turn use git_version_string, linking against
> libgit.a will fail. This is because git_version_string is physically
> located in git.o, and this object file is not part of libgit.a.

But what is wrong about that?

If you are making the termio related code reusable and sharable by turning
the static "term_columns()" in help.o into an external symbol, there is no
reason that termio related function, which is now useful outside the
context of giving help, must stay in help.c where its life happened to
have started.  In fact, "tell me how wide the terminal is" does not belong
to something called "help subsystem", no?

Wouldn't a new file, term.c or something, be a lot more suitable home for
the function you will be reusing from diff and other parts of the system?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 0/3 v2] diff --stat: use the real terminal width
  2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
                           ` (2 preceding siblings ...)
  2012-02-10 16:39         ` [PATCH 3/3] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
@ 2012-02-10 18:24         ` Junio C Hamano
  2012-02-12 14:30           ` [PATCH v3] diff --stat: use the full " Zbigniew Jędrzejewski-Szmek
  3 siblings, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2012-02-10 18:24 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, pclouds, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> - style fixes

I think I still saw at least one malformatted multi-line comments in this
round, though (I stopped looking after I saw one, so there may be others).

> - some tests for git-format-patch added
> - patches 3 and 4 squashed together, since they touch the same lines
> - graph width is limited to 40 columns, even if there's more space

Hmm.

This is what we have in the documentation.

        --stat[=<width>[,<name-width>[,<count>]]]::
                Generate a diffstat.  You can override the default
                output width for 80-column terminal by `--stat=<width>`.
                The width of the filename part can be controlled by
                giving another width to it separated by a comma.

Naïvely, one would expect that a "use the real terminal width" series
would be only to learn the width of the terminal and tweak its hardcoded
default "80" to that width, and change nothing else, leaving the default
for name-width to "50", which still can be overridable if needed.

But the reason somebody wants to have a wider width is more often not
because they want to see longer bars, but because they want to see long
names without truncation, so in retrospect, the order the "--stat=" option
takes its values is inconvenient.  Users would more often want to tinker
with name-width than width because the latter can be auto-detected.

Which is a bit unfortunate.

In any case, the above needs to be updated to describe what the updated
logic does.  Do you have documentation updates in the series?

Judging from what you wrote in the above, the updated logic is, instead of
the "naïve" version:

 - auto-detect, if possible, to set the default "width" to COLUMNS instead
   of hardcoded 80; and

 - instead of using hardcoded 50, use width-40 as the default as the
   default "name-width".

But if that is what is going on, shouldn't your "40" be "30" to retain
backward compatibility for people who work on 80-column terminals?

Or is there something more complex going on that you are not describing
here?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/3] help.c: make term_columns() cached and export it
  2012-02-10 16:39         ` [PATCH 2/3] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
@ 2012-02-11  4:36           ` Nguyen Thai Ngoc Duy
  2012-02-11 10:49             ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 206+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-02-11  4:36 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

2012/2/10 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>:
> Since term_columns() will usually fail, when a pager is installed,
> the cache is primed before the pager is installed. If a pager is not
> installed, then the cache will be set on first use.

Conflict alert. term_columns() is also moved out of help.c in
nd/columns series on pu, commit cb0850f (Save terminal width before
setting up pager - 2012-02-04)

>
> Conforms to The Single UNIX Specification, Version 2
> (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).
>
> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---
>  help.c  |   37 +++++++++++++++++++++++++++++--------
>  help.h  |    2 ++
>  pager.c |    5 +++++
>  3 files changed, 36 insertions(+), 8 deletions(-)
>
> diff --git a/help.c b/help.c
> index bc15066..5d1cb1d 100644
> --- a/help.c
> +++ b/help.c
> @@ -5,26 +5,47 @@
>  #include "help.h"
>  #include "common-cmds.h"
>
> -/* most GUI terminals set COLUMNS (although some don't export it) */
> -static int term_columns(void)
> +/*
> + * Cache for term_columns() value. Set on first use or when
> + * installing a pager and replacing stdout.
> + */
> +static int term_columns_cache;
> +
> +/*
> + * Return cached value (if set) or $COLUMNS (if set and positive) or
> + * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
> + *
> + * $COLUMNS even if set, is usually not exported, so
> + * the variable can be used to override autodection.
> + */
> +int term_columns(void)
>  {
> -       char *col_string = getenv("COLUMNS");
> +       char *col_string;
>        int n_cols;
>
> -       if (col_string && (n_cols = atoi(col_string)) > 0)
> -               return n_cols;
> +       if (term_columns_cache)
> +               return term_columns_cache;
> +
> +       col_string = getenv("COLUMNS");
> +       if (col_string && (n_cols = atoi(col_string)) > 0) {
> +               term_columns_cache = n_cols;
> +               return term_columns_cache;
> +       }
>
>  #ifdef TIOCGWINSZ
>        {
>                struct winsize ws;
>                if (!ioctl(1, TIOCGWINSZ, &ws)) {
> -                       if (ws.ws_col)
> -                               return ws.ws_col;
> +                       if (ws.ws_col) {
> +                               term_columns_cache = ws.ws_col;
> +                               return term_columns_cache;
> +                       }
>                }
>        }
>  #endif
>
> -       return 80;
> +       term_columns_cache = 80;
> +       return term_columns_cache;
>  }
>
>  void add_cmdname(struct cmdnames *cmds, const char *name, int len)
> diff --git a/help.h b/help.h
> index b6b12d5..880a4b4 100644
> --- a/help.h
> +++ b/help.h
> @@ -29,4 +29,6 @@ extern void list_commands(const char *title,
>                          struct cmdnames *main_cmds,
>                          struct cmdnames *other_cmds);
>
> +extern int term_columns(void);
> +
>  #endif /* HELP_H */
> diff --git a/pager.c b/pager.c
> index 975955b..e7032de 100644
> --- a/pager.c
> +++ b/pager.c
> @@ -1,6 +1,7 @@
>  #include "cache.h"
>  #include "run-command.h"
>  #include "sigchain.h"
> +#include "help.h"
>
>  #ifndef DEFAULT_PAGER
>  #define DEFAULT_PAGER "less"
> @@ -76,6 +77,10 @@ void setup_pager(void)
>        if (!pager)
>                return;
>
> +       /* prime the term_columns() cache before it is too
> +        * late and stdout is replaced */
> +       (void) term_columns();
> +
>        setenv("GIT_PAGER_IN_USE", "true", 1);
>
>        /* spawn the pager */
> --
> 1.7.9.263.g4be11.dirty
>



-- 
Duy

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/3] help.c: make term_columns() cached and export it
  2012-02-11  4:36           ` Nguyen Thai Ngoc Duy
@ 2012-02-11 10:49             ` Zbigniew Jędrzejewski-Szmek
  2012-02-12  9:40               ` Junio C Hamano
  0 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-11 10:49 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git, gitster, Michael J Gruber, Ramsay Jones

On 02/11/2012 05:36 AM, Nguyen Thai Ngoc Duy wrote:
> 2012/2/10 Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>:
>> Since term_columns() will usually fail, when a pager is installed,
>> the cache is primed before the pager is installed. If a pager is not
>> installed, then the cache will be set on first use.
>
> Conflict alert. term_columns() is also moved out of help.c in
> nd/columns series on pu, commit cb0850f (Save terminal width before
> setting up pager - 2012-02-04)

Thanks for the heads-up. I think that the two patches should be
merged, especially because there's an error in cb0850f (a variable is
read-only, never written).

Tweaks to cb0850f (Save terminal width before setting up pager - 
2012-02-04):

[This actually was done on top of today's pu, so it will not apply
  cleanly to cb0850f].

- term_columns() lives in pager.c so it should be declared in
   cache.h like other public functions in pager.c. It has nothing to do
   with columns.h.
- simplify logic to use a static variable instead of two global
   variables (cb0850f actually doesn't work at all because
   spawned_pager wasn't ever set).
- check the cache first, then do getenv(COLUMNS) + atoi, then do
   ioctl(). The behaviour is equivalent to checking COLUMNS first, but
   is slightly more efficient.
- document the function
- remove #include "column.h" added in 88c9754c4097 column: Fix some
   compiler and sparse warnings (Wed Feb 8 2012).

Junio suggested that "a new file, term.c or something, be a lot more
suitable home for the function you will be reusing from diff and other
parts of the system". Nevertheless, I think that adding two files (.c
and .h) to hold one function isn't worth it. It can live in pager.c.
Terminal size is logically connected to paging after all.
---
  cache.h  |    1 +
  column.h |    1 -
  pager.c  |   64 +++++++++++++++++++++++-----------------
  3 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/cache.h b/cache.h
index 6c70dbc..b4422d4 100644
--- a/cache.h
+++ b/cache.h
@@ -1196,6 +1196,7 @@ extern void setup_pager(void);
  extern const char *pager_program;
  extern int pager_in_use(void);
  extern int pager_use_color;
+extern int term_columns(void);

  extern const char *editor_program;
  extern const char *askpass_program;
diff --git a/column.h b/column.h
index b9dec64..142299e 100644
--- a/column.h
+++ b/column.h
@@ -17,7 +17,6 @@ struct column_options {
  	const char *nl;
  };

-extern int term_columns(void);
  extern void print_columns(const struct string_list *list,
  			  unsigned int mode,
  			  struct column_options *opts);
diff --git a/pager.c b/pager.c
index fe203a7..d105761 100644
--- a/pager.c
+++ b/pager.c
@@ -7,21 +7,6 @@
  #define DEFAULT_PAGER "less"
  #endif

-static int spawned_pager;
-static int max_columns;
-
-static int retrieve_terminal_width(void)
-{
-#ifdef TIOCGWINSZ
-	struct winsize ws;
-	if (ioctl(1, TIOCGWINSZ, &ws))  /* e.g., ENOSYS */
-		return 0;
-	return ws.ws_col;
-#else
-	return 0;
-#endif
-}
-
  /*
   * This is split up from the rest of git so that we can do
   * something different on Windows.
@@ -88,16 +73,15 @@ const char *git_pager(int stdout_is_tty)
  void setup_pager(void)
  {
  	const char *pager = git_pager(isatty(1));
-	int width;

  	if (!pager || pager_in_use())
  		return;

-	setenv("GIT_PAGER_IN_USE", "true", 1);
+	/* prime the term_columns() cache before it is too
+	 * late and stdout is replaced */
+	(void) term_columns();

-	width = retrieve_terminal_width();
-	if (width)
-		max_columns = width;
+	setenv("GIT_PAGER_IN_USE", "true", 1);

  	/* spawn the pager */
  	pager_argv[0] = pager;
@@ -132,17 +116,43 @@ int pager_in_use(void)
  	return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
  }

+/*
+ * Return cached value (if set) or $COLUMNS (if set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ * This behaviour conforms to The Single UNIX Specification, Version 2
+ * 
(http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).
+ */
  int term_columns(void)
  {
-	char *col_string = getenv("COLUMNS");
+	static int term_columns_cache;
+
+	char *col_string;
  	int n_cols;

-	if (col_string && (n_cols = atoi(col_string)) > 0)
-		return n_cols;
+	if (term_columns_cache)
+		return term_columns_cache;
+
+	col_string = getenv("COLUMNS");
+	if (col_string && (n_cols = atoi(col_string)) > 0) {
+		term_columns_cache = n_cols;
+		return term_columns_cache;
+	}

-	if (spawned_pager && max_columns)
-		return max_columns;
+#ifdef TIOCGWINSZ
+	{
+		struct winsize ws;
+		if (!ioctl(1, TIOCGWINSZ, &ws)) {
+			if (ws.ws_col) {
+				term_columns_cache = ws.ws_col;
+				return term_columns_cache;
+			}
+		}
+	}
+#endif

-	n_cols = retrieve_terminal_width();
-	return n_cols ? n_cols : 80;
+	term_columns_cache = 80;
+	return term_columns_cache;
  }
-- 
1.7.9.310.g883d84c.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/3] help.c: make term_columns() cached and export it
  2012-02-11 10:49             ` Zbigniew Jędrzejewski-Szmek
@ 2012-02-12  9:40               ` Junio C Hamano
  2012-02-12 14:12                 ` [PATCH 1/2] Save terminal width before setting up pager and export term_columns() Zbigniew Jędrzejewski-Szmek
  2012-02-12 14:16                 ` [PATCH 2/2] Rename lineno_width to decimal_width and export it Zbigniew Jędrzejewski-Szmek
  0 siblings, 2 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-12  9:40 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek
  Cc: Nguyen Thai Ngoc Duy, git, Michael J Gruber, Ramsay Jones

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Junio suggested that "a new file, term.c or something, be a lot more
> suitable home for the function you will be reusing from diff and other
> parts of the system". Nevertheless, I think that adding two files (.c
> and .h) to hold one function isn't worth it. It can live in pager.c.
> Terminal size is logically connected to paging after all.

I do not have any objection to the above reasoning.

Given that Nguyen's columns topic hasn't been merged to 'next' and I
expect it will be re-rolled anyway, I would prefer a patch that does the
move from help.c to pager.c that is based directly on v1.7.9, on top of
which your work and the columns topic can both be built independently.

Thanks.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH 1/2] Save terminal width before setting up pager and export term_columns()
  2012-02-12  9:40               ` Junio C Hamano
@ 2012-02-12 14:12                 ` Zbigniew Jędrzejewski-Szmek
  2012-02-13 23:00                   ` Junio C Hamano
  2012-02-14 11:44                   ` Nguyen Thai Ngoc Duy
  2012-02-12 14:16                 ` [PATCH 2/2] Rename lineno_width to decimal_width and export it Zbigniew Jędrzejewski-Szmek
  1 sibling, 2 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:12 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

term_columns() checks for terminal width via ioctl(2). After
redirecting, stdin is no longer terminal to get terminal width.

Check terminal width and save it before redirecting stdin in
setup_pager() by calling term_columns().

Move term_columns() to pager.c and export it in cache.h.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 cache.h |  1 +
 help.c  | 22 -------------------
 pager.c | 45 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 22 deletions(-)

This replaces cb0850f (Save terminal width before setting up pager -
2012-02-04) from Nguyễn Thái Ngọc Duy and my previous patch to export
term_columns().

This is directly on top of v1.7.9 as requested.

I removed Signed-off-by from Nguyễn and Junio because the patch is
substantially changed.

diff --git a/cache.h b/cache.h
index 10afd71..2f30b3a 100644
--- a/cache.h
+++ b/cache.h
@@ -1175,6 +1175,7 @@ extern void setup_pager(void);
 extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
+extern int term_columns(void);
 
 extern const char *editor_program;
 extern const char *askpass_program;
diff --git a/help.c b/help.c
index cbbe966..14eefc9 100644
--- a/help.c
+++ b/help.c
@@ -5,28 +5,6 @@
 #include "help.h"
 #include "common-cmds.h"
 
-/* most GUI terminals set COLUMNS (although some don't export it) */
-static int term_columns(void)
-{
-	char *col_string = getenv("COLUMNS");
-	int n_cols;
-
-	if (col_string && (n_cols = atoi(col_string)) > 0)
-		return n_cols;
-
-#ifdef TIOCGWINSZ
-	{
-		struct winsize ws;
-		if (!ioctl(1, TIOCGWINSZ, &ws)) {
-			if (ws.ws_col)
-				return ws.ws_col;
-		}
-	}
-#endif
-
-	return 80;
-}
-
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 {
 	struct cmdname *ent = xmalloc(sizeof(*ent) + len + 1);
diff --git a/pager.c b/pager.c
index 975955b..b8049a4 100644
--- a/pager.c
+++ b/pager.c
@@ -76,6 +76,10 @@ void setup_pager(void)
 	if (!pager)
 		return;
 
+	/* prime the term_columns() cache before it is too
+	 * late and stdout is replaced */
+	(void) term_columns();
+
 	setenv("GIT_PAGER_IN_USE", "true", 1);
 
 	/* spawn the pager */
@@ -110,3 +114,44 @@ int pager_in_use(void)
 	env = getenv("GIT_PAGER_IN_USE");
 	return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
 }
+
+/*
+ * Return cached value (if set) or $COLUMNS (if set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ * This behaviour conforms to The Single UNIX Specification, Version 2
+ * (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).
+ */
+int term_columns(void)
+{
+	static int term_columns_cache;
+
+	char *col_string;
+	int n_cols;
+
+	if (term_columns_cache)
+		return term_columns_cache;
+
+	col_string = getenv("COLUMNS");
+	if (col_string && (n_cols = atoi(col_string)) > 0) {
+		term_columns_cache = n_cols;
+		return term_columns_cache;
+	}
+
+#ifdef TIOCGWINSZ
+	{
+		struct winsize ws;
+		if (!ioctl(1, TIOCGWINSZ, &ws)) {
+			if (ws.ws_col) {
+				term_columns_cache = ws.ws_col;
+				return term_columns_cache;
+			}
+		}
+	}
+#endif
+
+	term_columns_cache = 80;
+	return term_columns_cache;
+}
-- 
1.7.9.3.g2429d.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 2/2] Rename lineno_width to decimal_width and export it
  2012-02-12  9:40               ` Junio C Hamano
  2012-02-12 14:12                 ` [PATCH 1/2] Save terminal width before setting up pager and export term_columns() Zbigniew Jędrzejewski-Szmek
@ 2012-02-12 14:16                 ` Zbigniew Jędrzejewski-Szmek
  2012-02-13 23:29                   ` Junio C Hamano
  1 sibling, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:16 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

This function will be used in calculating diff --stat graph width.
The name is changed because the function works for any number.
The function is moved from builtins/blame.c to pager.c because it
will be used not only in builtins/blame.c.
---
 builtin/blame.c | 18 +++---------------
 cache.h         |  1 +
 pager.c         | 12 ++++++++++++
 3 files changed, 16 insertions(+), 15 deletions(-)

This is another function to be exported. I hope it can be exported
together with term_columns(). I'll use it the next version of the diff
--stat patch.

diff --git a/builtin/blame.c b/builtin/blame.c
index 5a67c20..f028e8a 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1829,18 +1829,6 @@ static int read_ancestry(const char *graft_file)
 }
 
 /*
- * How many columns do we need to show line numbers in decimal?
- */
-static int lineno_width(int lines)
-{
-	int i, width;
-
-	for (width = 1, i = 10; i <= lines; width++)
-		i *= 10;
-	return width;
-}
-
-/*
  * How many columns do we need to show line numbers, authors,
  * and filenames?
  */
@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
 		if (largest_score < ent_score(sb, e))
 			largest_score = ent_score(sb, e);
 	}
-	max_orig_digits = lineno_width(longest_src_lines);
-	max_digits = lineno_width(longest_dst_lines);
-	max_score_digits = lineno_width(largest_score);
+	max_orig_digits = decimal_width(longest_src_lines);
+	max_digits = decimal_width(longest_dst_lines);
+	max_score_digits = decimal_width(largest_score);
 }
 
 /*
diff --git a/cache.h b/cache.h
index 2f30b3a..3857dfd 100644
--- a/cache.h
+++ b/cache.h
@@ -1176,6 +1176,7 @@ extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 extern int term_columns(void);
+extern int decimal_width(int number);
 
 extern const char *editor_program;
 extern const char *askpass_program;
diff --git a/pager.c b/pager.c
index b8049a4..b6d44ef 100644
--- a/pager.c
+++ b/pager.c
@@ -155,3 +155,15 @@ int term_columns(void)
 	term_columns_cache = 80;
 	return term_columns_cache;
 }
+
+/*
+ * How many columns do we need to show numbers in decimal?
+ */
+int decimal_width(int number)
+{
+	int i, width;
+
+	for (width = 1, i = 10; i <= number; width++)
+		i *= 10;
+	return width;
+}
-- 
1.7.9.3.g2429d.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH v3] diff --stat: use the full terminal width
  2012-02-10 18:24         ` [PATCH 0/3 v2] " Junio C Hamano
@ 2012-02-12 14:30           ` Zbigniew Jędrzejewski-Szmek
  2012-02-14  1:08             ` Junio C Hamano
  0 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-12 14:30 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

Use as many columns as necessary for filenames, as few columns as
necessary for change counts, and up to 40 columns for the histogram.

Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the stat output can be almost useless. If the middle part
between { and } is long (because the file was moved to a completely
different directory), then most of the path would be truncated.

It makes sense to detect and use the full terminal width and display
full filenames if possible.

If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph would use the full
width, the output would look bad. Messages wrapped to about 80
columns would be interspersed with very long +- lines. It makes
sense to limit the width of the histogram to a fixed value, even if more
columns are available. This fixed value is subjectively hard-coded to
be 40 columns, which seems to work well for git.git and linux-2.6.git and
some other repositories.

If there isn't enough columns to print both the filename and the histogram,
at least 5/8 of available space is devoted to filenames. On a standard 80 column
terminal, or if not connected to a terminal and using the default of 80 columns,
this gives the same partition as before.

Number of columns required for change counts is computed based on
the maximum number of changed lines. This means that usually a few more
columns will be available for the filenames and the histogram.

Tests are added for various combinations of long filename and big change
count and ways to specify widths.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
Hi,
this is v3 (reduced to one patch) on top of:
- Save terminal width before setting up pager and export term_columns(),
- Rename lineno_width to decimal_width and export it.

The logic is described in a comment in show_stats() in diff.c. In case
of a column 80 terminal window, the output will not be identical,
because of using decimal_width, but it'll be very close to what was
there previously.

v3:
- use decimal_width(max_change) to calculate number of columns
  required for change counts
- rework the logic to divide columns
- document the logic in comments, update docs
- add more tests

v2:
- style fixes
- some tests for git-format-patch added
- patches 3 and 4 squashed together, since they touch the same lines
- graph width is limited to 40 columns, even if there's more space
- patch descriptions extended and cleared up

 Documentation/diff-options.txt | 14 +++---
 diff.c                         | 93 +++++++++++++++++++++++++------------
 t/t4014-format-patch.sh        | 98 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 168 insertions(+), 37 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9f7cba2..35dfdfb 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -53,13 +53,15 @@ endif::git-format-patch[]
 	Generate a diff using the "patience diff" algorithm.
 
 --stat[=<width>[,<name-width>[,<count>]]]::
-	Generate a diffstat.  You can override the default
-	output width for 80-column terminal by `--stat=<width>`.
-	The width of the filename part can be controlled by
-	giving another width to it separated by a comma.
+	Generate a diffstat. By default, as much space as necessary
+	will be used for the filename part, and up to 40 columns for
+	the graph histogram. Maximum width defaults to terminal width,
+	or 80 columns if not connected to a terminal, and can be
+	overriden by `<width>`. The width of the filename part can be
+	limited by giving another width `<name-width>` after a comma.
 	By giving a third parameter `<count>`, you can limit the
-	output to the first `<count>` lines, followed by
-	`...` if there are more.
+	output to the first `<count>` lines, followed by `...` if
+	there are more.
 +
 These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
diff --git a/diff.c b/diff.c
index 7e15426..7abcbe9 100644
--- a/diff.c
+++ b/diff.c
@@ -1327,7 +1327,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
 	int total_files = data->nr;
-	int width, name_width, count;
+	int width, name_width, graph_width, number_width, count;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1341,25 +1341,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		line_prefix = msg->buf;
 	}
 
-	width = options->stat_width ? options->stat_width : 80;
-	name_width = options->stat_name_width ? options->stat_name_width : 50;
-	count = options->stat_count ? options->stat_count : data->nr;
-
-	/* Sanity: give at least 5 columns to the graph,
-	 * but leave at least 10 columns for the name.
-	 */
-	if (width < 25)
-		width = 25;
-	if (name_width < 10)
-		name_width = 10;
-	else if (width < name_width + 15)
-		name_width = width - 15;
-
 	/* Find the longest filename and max number of changes */
 	reset = diff_get_color_opt(options, DIFF_RESET);
 	add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
 	del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
 
+	count = options->stat_count ? options->stat_count : data->nr;
+
 	for (i = 0; (i < count) && (i < data->nr); i++) {
 		struct diffstat_file *file = data->files[i];
 		uintmax_t change = file->added + file->deleted;
@@ -1380,19 +1368,63 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	}
 	count = i; /* min(count, data->nr) */
 
-	/* Compute the width of the graph part;
-	 * 10 is for one blank at the beginning of the line plus
-	 * " | count " between the name and the graph.
+	/* We have width = stat_width or term_columns() columns total.
+	 * We want a maximum of min(max_len, stat_name_width) for the name part.
+	 * We want a maximum of min(max_change, 40) for the +- part.
+	 * We also need 1 for " " and 4 + decimal_width(max_change)
+	 * for " | NNNN " and one for " " at the end, altogether
+	 * 6 + decimal_width(max_change).
+	 *
+	 * If there's not enough space, we will use stat_name_width
+	 * or 5/8*width for filename, and the rest for constant
+	 * elements + histogram, but no more than 40 for the histogram.
+	 * (5/8 gives 50 for filename and 30 for constant parts and
+	 * histogram for the standard terminal size).
 	 *
-	 * From here on, name_width is the width of the name area,
-	 * and width is the width of the graph area.
+	 * In other words: stat_width limits the maximum width, and
+	 * stat_name_width fixes the maximum width of the filename,
+	 * and is also used to divide available columns if there
+	 * aren't enough.
 	 */
-	name_width = (name_width < max_len) ? name_width : max_len;
-	if (width < (name_width + 10) + max_change)
-		width = width - (name_width + 10);
-	else
-		width = max_change;
+	width = options->stat_width ? options->stat_width : term_columns();
+	number_width = decimal_width(max_change);
+	/* first sizes that are wanted */
+	graph_width = max_change < 40 ? max_change : 40;
+	name_width = (options->stat_name_width > 0 &&
+		      options->stat_name_width < max_len) ?
+		options->stat_name_width : max_len;
+
+	/* sanity: guarantee a minimum and maximum width */
+	if (width < 25)
+		width = 25;
+
+	if (name_width + number_width + 6 + graph_width > width) {
+		if (graph_width > width * 3/8 - number_width - 6)
+			graph_width = width * 3/8 - number_width - 6;
+		if (graph_width > 40)
+			graph_width =  40;
+		if (name_width > width - number_width - 6 - graph_width)
+			name_width = width - number_width - 6 - graph_width;
+		else
+			graph_width = width - number_width - 6 - name_width;
+	}
 
+	/* More sanity: give at least 5 columns to the graph,
+	 * but leave at least 10 columns for the name.
+	 *
+	 * This should already be satisfied, unless max_change is
+	 * really huge. If the window is extemely narrow, this might
+	 * overflow available columns.
+	 */
+	if (name_width < 10 && max_len >= 10)
+		name_width = 10;
+	if (graph_width < 5 && max_change >= 5)
+		graph_width = 5;
+
+	/* From here name_width is the width of the name area,
+	 * and graph_width is the width of the graph area.
+	 * max_change is used to scale graph properly.
+	 */
 	for (i = 0; i < count; i++) {
 		const char *prefix = "";
 		char *name = data->files[i]->print_name;
@@ -1448,14 +1480,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		adds += add;
 		dels += del;
 
-		if (width <= max_change) {
-			add = scale_linear(add, width, max_change);
-			del = scale_linear(del, width, max_change);
+		if (graph_width <= max_change) {
+			add = scale_linear(add, graph_width, max_change);
+			del = scale_linear(del, graph_width, max_change);
 		}
 		fprintf(options->file, "%s", line_prefix);
 		show_name(options->file, prefix, name, len);
-		fprintf(options->file, "%5"PRIuMAX"%s", added + deleted,
-				added + deleted ? " " : "");
+		fprintf(options->file, " %*"PRIuMAX"%s",
+			number_width, added + deleted,
+			added + deleted ? " " : "");
 		show_graph(options->file, '+', add, add_c, reset);
 		show_graph(options->file, '-', del, del_c, reset);
 		fprintf(options->file, "\n");
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6797512..91be989 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
 
 cat > expect << EOF
 ---
- file |   16 ++++++++++++++++
+ file | 16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)
 
 diff --git a/file b/file
@@ -894,4 +894,100 @@ test_expect_success 'format patch ignores color.ui' '
 	test_cmp expect actual
 '
 
+name=aaaaaaaaaa
+name=$name$name$name$name$name$name$name$name$name$name$name$name
+test_expect_success 'preparation' "
+	> ${name} &&
+	git add ${name} &&
+	git commit -m message &&
+	echo a > ${name} &&
+	git commit -m message ${name}
+"
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch graph width is 80 columns' '
+	git format-patch --stat --stdout -1 |
+		grep -m 1 aaaaa > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch --stat=width with long name' '
+	git format-patch --stat=40 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width works long name' '
+	git format-patch --stat-width=40 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat=...,name-width with long name' '
+	git format-patch --stat=60,32 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-name-width with long name' '
+	git format-patch --stat-name-width=32 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'preparation' '
+	> abcd &&
+	git add abcd &&
+	git commit -m message &&
+	seq 1000 > abcd &&
+	git commit -m message abcd
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch graph width is 40 columns' '
+	git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch ignores COLUMNS' '
+	COLUMNS=200 git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change' '
+	git format-patch --stat=40 --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width with big change' '
+	git format-patch --stat-width=40 --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change and long name' '
+	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git commit -m message &&
+	git format-patch --stat-width=60 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
1.7.9.3.g2429d.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/2] Save terminal width before setting up pager and export term_columns()
  2012-02-12 14:12                 ` [PATCH 1/2] Save terminal width before setting up pager and export term_columns() Zbigniew Jędrzejewski-Szmek
@ 2012-02-13 23:00                   ` Junio C Hamano
  2012-02-14 11:44                   ` Nguyen Thai Ngoc Duy
  1 sibling, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-13 23:00 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, pclouds, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> term_columns() checks for terminal width via ioctl(2). After
> redirecting, stdin is no longer terminal to get terminal width.

s/stdin/stdout/

> Check terminal width and save it before redirecting stdin in
> setup_pager() by calling term_columns().
>
> Move term_columns() to pager.c and export it in cache.h.
>
> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---

Thanks.

It probably is worth mentioning what the end-user visible effect of this
change is somewhere in the log message.

I somehow find "term_columns_cache" a funny name for this variable and
does not describe what it does.  Unlike a real cache, we cannot discard it
and re-read it even if we later wanted to.

I am tempted to rewrite the patch like this to update other minor style
issues.

-- >8 --
From: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date: Sun, 12 Feb 2012 15:12:32 +0100
Subject: [PATCH] pager: find out the terminal width before spawning the pager

term_columns() checks for terminal width via ioctl(2) on the standard
output, but we spawn the pager too early for this check to be useful.

The effect of this buglet can be observed by opening a wide terminal and
running "git -p help --all", which still shows 80-column output, while
"git help --all" uses the full terminal width. Run the check before we
spawn the pager to fix this.

While at it, move term_columns() to pager.c and export it from cache.h so
that callers other than the help subsystem can use it.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 cache.h |    1 +
 help.c  |   22 ----------------------
 pager.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/cache.h b/cache.h
index 79c612f..c7e3b4d 100644
--- a/cache.h
+++ b/cache.h
@@ -1172,6 +1172,7 @@ extern void setup_pager(void);
 extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
+extern int term_columns(void);
 
 extern const char *editor_program;
 extern const char *askpass_program;
diff --git a/help.c b/help.c
index cbbe966..14eefc9 100644
--- a/help.c
+++ b/help.c
@@ -5,28 +5,6 @@
 #include "help.h"
 #include "common-cmds.h"
 
-/* most GUI terminals set COLUMNS (although some don't export it) */
-static int term_columns(void)
-{
-	char *col_string = getenv("COLUMNS");
-	int n_cols;
-
-	if (col_string && (n_cols = atoi(col_string)) > 0)
-		return n_cols;
-
-#ifdef TIOCGWINSZ
-	{
-		struct winsize ws;
-		if (!ioctl(1, TIOCGWINSZ, &ws)) {
-			if (ws.ws_col)
-				return ws.ws_col;
-		}
-	}
-#endif
-
-	return 80;
-}
-
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 {
 	struct cmdname *ent = xmalloc(sizeof(*ent) + len + 1);
diff --git a/pager.c b/pager.c
index 975955b..e06cfa0 100644
--- a/pager.c
+++ b/pager.c
@@ -76,6 +76,12 @@ void setup_pager(void)
 	if (!pager)
 		return;
 
+	/*
+	 * force computing the width of the terminal before we redirect
+	 * the standard output to the pager.
+	 */
+	(void) term_columns();
+
 	setenv("GIT_PAGER_IN_USE", "true", 1);
 
 	/* spawn the pager */
@@ -110,3 +116,40 @@ int pager_in_use(void)
 	env = getenv("GIT_PAGER_IN_USE");
 	return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
 }
+
+/*
+ * Return cached value (if set) or $COLUMNS (if set and positive) or
+ * ioctl(1, TIOCGWINSZ).ws_col (if positive) or 80.
+ *
+ * $COLUMNS even if set, is usually not exported, so
+ * the variable can be used to override autodection.
+ * This behaviour conforms to The Single UNIX Specification, Version 2
+ * (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003).
+ */
+int term_columns(void)
+{
+	static int term_columns_at_startup;
+
+	char *col_string;
+	int n_cols;
+
+	if (term_columns_at_startup)
+		return term_columns_at_startup;
+
+	term_columns_at_startup = 80;
+
+	col_string = getenv("COLUMNS");
+	if (col_string && (n_cols = atoi(col_string)) > 0)
+		term_columns_at_startup = n_cols;
+#ifdef TIOCGWINSZ
+	else {
+		struct winsize ws;
+		if (!ioctl(1, TIOCGWINSZ, &ws)) {
+			if (ws.ws_col) {
+				term_columns_at_startup = ws.ws_col;
+			}
+		}
+	}
+#endif
+	return term_columns_at_startup;
+}
-- 
1.7.9.300.gd47e4

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/2] Rename lineno_width to decimal_width and export it
  2012-02-12 14:16                 ` [PATCH 2/2] Rename lineno_width to decimal_width and export it Zbigniew Jędrzejewski-Szmek
@ 2012-02-13 23:29                   ` Junio C Hamano
  2012-02-14 12:24                     ` [PATCH v2] make lineno_width() from blame reusable for others Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2012-02-13 23:29 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, pclouds, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> This function will be used in calculating diff --stat graph width.
> The name is changed because the function works for any number.
> The function is moved from builtins/blame.c to pager.c because it
> will be used not only in builtins/blame.c.

I'd prefer to see description of preliminary changes phrased without
depending too heavily on things that hasn't happened when possible.
Making a generic helper function to count digits necessary to print a
cardinal number available to future callers is a good thing by itself,
even if the "dynamic --stat width computation" turned out to be a bad
idea for whatever reason (I am not saying it is a bad idea here).

Perhaps like this.

	Subject: make lineno_width() from blame reusable for others

	builtin/blame.c has a helper function to compute how many columns
	we need to show a line-number, whose implementation is reusable as
	a more generic helper function to count the number of columns
	necessary to show any cardinal number.

	Rename it to decimal_width(), move it to pager.c and export it for
        use by future callers.

And you can say something like "I'll be using this in 'diff --stat' in
later patches" after the three-dash line.

> ---

Sign-off before the three-dash line?

> +/*
> + * How many columns do we need to show numbers in decimal?

s/numbers/this number/;

> + */
> +int decimal_width(int number)

Don't we want to make the argument "unsigned number" instead?

> +{
> +	int i, width;
> +
> +	for (width = 1, i = 10; i <= number; width++)
> +		i *= 10;
> +	return width;
> +}

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH v3] diff --stat: use the full terminal width
  2012-02-12 14:30           ` [PATCH v3] diff --stat: use the full " Zbigniew Jędrzejewski-Szmek
@ 2012-02-14  1:08             ` Junio C Hamano
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2012-02-14  1:08 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, pclouds, Michael J Gruber

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Use as many columns as necessary for filenames, as few columns as
> necessary for change counts, and up to 40 columns for the histogram.
>
> Some projects (especially in Java), have long filename paths, with
> nested directories or long individual filenames. When files are
> renamed, the stat output can be almost useless. If the middle part

s/the stat output/the name part in &/;

> between { and } is long (because the file was moved to a completely
> different directory), then most of the path would be truncated.
>
> It makes sense to detect and use the full terminal width and display
> full filenames if possible.
>
> If commits changing a lot of lines are displayed in a wide terminal
> window (200 or more columns), and the +- graph would use the full
> width, the output would look bad. Messages wrapped to about 80
> columns would be interspersed with very long +- lines. It makes
> sense to limit the width of the histogram to a fixed value, even if more

I do not think the graph ++++++--- part is "histogram", which is a name
for a specific type of graph that depicts a distribution of data.

We show the number of lines changed in a graph.  Unless people come up
with a better name, I would suggest calling it just "the graph part", or
simply "the graph", throughout the patch.

> columns are available. This fixed value is subjectively hard-coded to
> be 40 columns, which seems to work well for git.git and linux-2.6.git and
> some other repositories.
>
> If there isn't enough columns to print both the filename and the histogram,
> at least 5/8 of available space is devoted to filenames. On a standard 80 column
> terminal, or if not connected to a terminal and using the default of 80 columns,
> this gives the same partition as before.
>
> Number of columns required for change counts is computed based on
> the maximum number of changed lines. This means that usually a few more
> columns will be available for the filenames and the histogram.
>
> Tests are added for various combinations of long filename and big change
> count and ways to specify widths.
>
> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---
> ...
> diff --git a/diff.c b/diff.c
> index 7e15426..7abcbe9 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1327,7 +1327,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>  	int i, len, add, del, adds = 0, dels = 0;
>  	uintmax_t max_change = 0, max_len = 0;
>  	int total_files = data->nr;
> -	int width, name_width, count;
> +	int width, name_width, graph_width, number_width, count;
>  	const char *reset, *add_c, *del_c;
>  	const char *line_prefix = "";
>  	int extra_shown = 0;
> @@ -1341,25 +1341,13 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>  		line_prefix = msg->buf;
>  	}
>  
> -	width = options->stat_width ? options->stat_width : 80;
> -	name_width = options->stat_name_width ? options->stat_name_width : 50;
> -	count = options->stat_count ? options->stat_count : data->nr;

It was somewhat distracting that you moved this "count =" below, which I
do not think was necessary.

> -	/* Sanity: give at least 5 columns to the graph,
> -	 * but leave at least 10 columns for the name.
> -	 */
> -	if (width < 25)
> -		width = 25;
> -	if (name_width < 10)
> -		name_width = 10;
> -	else if (width < name_width + 15)
> -		name_width = width - 15;

Removal of this sanity check is fine as long as sanity is kept by the new
code in the later part. This was primarily so that people won't specify
impossible values (e.g. what happens when name_width that is wider than
the total width is given).

> ...
> +	count = options->stat_count ? options->stat_count : data->nr;
> +
> @@ -1380,19 +1368,63 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
>  	}
>  	count = i; /* min(count, data->nr) */
>  
> -	/* Compute the width of the graph part;
> -	 * 10 is for one blank at the beginning of the line plus
> -	 * " | count " between the name and the graph.


> +	/* We have width = stat_width or term_columns() columns total.

Just a style, but in the more recent part of the codebase,

	/*
         * We have width = ....

is preferred.

> +	 * We want a maximum of min(max_len, stat_name_width) for the name part.
> +	 * We want a maximum of min(max_change, 40) for the +- part.
> +	 * We also need 1 for " " and 4 + decimal_width(max_change)
> +	 * for " | NNNN " and one for " " at the end, altogether
> +	 * 6 + decimal_width(max_change).

The math looks correct but 'one for " " at the end' sounds as if you are
printing a SP, but I think we simply avoid printing anything, so perhaps
rewrite it to "we leave one column at the end" or something.

> +	 * If there's not enough space, we will use stat_name_width
> +	 * or 5/8*width for filename, and the rest for constant

"A or B for filename"---unclear how it picks between A or B.

"A or B, whichever is shorter, for filename", perhaps?

> +	 * elements + histogram, but no more than 40 for the histogram.
> +	 * (5/8 gives 50 for filename and 30 for constant parts and
> +	 * histogram for the standard terminal size).
>  	 *
> -	 * From here on, name_width is the width of the name area,
> -	 * and width is the width of the graph area.
> +	 * In other words: stat_width limits the maximum width, and
> +	 * stat_name_width fixes the maximum width of the filename,
> +	 * and is also used to divide available columns if there
> +	 * aren't enough.
>  	 */
> -	name_width = (name_width < max_len) ? name_width : max_len;
> -	if (width < (name_width + 10) + max_change)
> -		width = width - (name_width + 10);
> -	else
> -		width = max_change;
> +	width = options->stat_width ? options->stat_width : term_columns();
> +	number_width = decimal_width(max_change);
> +	/* first sizes that are wanted */

Missing verb; "first, compute sizes that are ..."?

> +	graph_width = max_change < 40 ? max_change : 40;
> +	name_width = (options->stat_name_width > 0 &&
> +		      options->stat_name_width < max_len) ?
> +		options->stat_name_width : max_len;

mental note: name_width can be limited to max_len, and graph_width may be
quite small when max_change is small.  The total graph may be much smaller
than the terminal width in such a case (and it is not a wasted space on
the right hand side of the terminal).

> +	/* sanity: guarantee a minimum and maximum width */
> +	if (width < 25)
> +		width = 25;
> +
> +	if (name_width + number_width + 6 + graph_width > width) {
> +		if (graph_width > width * 3/8 - number_width - 6)
> +			graph_width = width * 3/8 - number_width - 6;
> +		if (graph_width > 40)
> +			graph_width =  40;
> +		if (name_width > width - number_width - 6 - graph_width)
> +			name_width = width - number_width - 6 - graph_width;
> +		else
> +			graph_width = width - number_width - 6 - name_width;
> +	}
>  
> +	/* More sanity: give at least 5 columns to the graph,

Hrm, having to have a separate "More sanity" is ugly, and you seem to
already know it "This should already be satisfied...".

Can the logic above be tightened to make this "mopping up" unnecessary?

> +	 * but leave at least 10 columns for the name.
> +	 *
> +	 * This should already be satisfied, unless max_change is
> +	 * really huge. If the window is extemely narrow, this might
> +	 * overflow available columns.
> +	 */
> +	if (name_width < 10 && max_len >= 10)
> +		name_width = 10;

The logic up to this point uses the same "25 <= width, 10 <= name_width"
as the original to ensure that graph and the fixed part can use at least
15 columns.  And then you do this:

> +	if (graph_width < 5 && max_change >= 5)
> +		graph_width = 5;

which means you are allocating 10 columns for fixed part.  In the
original, it was OK to give fixed number of columns for fixed part like
this, as it always gave fixed 5 columns to show the number.  Don't you
need to adjust that 10 depending on the decimal_width(max_change), now
your number_width flexes?

This patch also breaks many existing tests that need to be adjusted for
the change to use decimal_width(max_change), which I do not care to fix up
for you.  Perhaps that part of the change needs to be split out into a
separate patch.

Among the tests it breaks is t1200-tutorial.sh, which means that the
tutorial document that has illustration of the sample output also needs to
be updated before the final round.

Thanks.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/2] Save terminal width before setting up pager and export term_columns()
  2012-02-12 14:12                 ` [PATCH 1/2] Save terminal width before setting up pager and export term_columns() Zbigniew Jędrzejewski-Szmek
  2012-02-13 23:00                   ` Junio C Hamano
@ 2012-02-14 11:44                   ` Nguyen Thai Ngoc Duy
  2012-02-14 11:53                     ` Zbigniew Jędrzejewski-Szmek
  1 sibling, 1 reply; 206+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-02-14 11:44 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

2012/2/12 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>:
> This replaces cb0850f (Save terminal width before setting up pager -
> 2012-02-04) from Nguyễn Thái Ngọc Duy and my previous patch to export
> term_columns().
>
> This is directly on top of v1.7.9 as requested.
>
> I removed Signed-off-by from Nguyễn and Junio because the patch is
> substantially changed.

No problems. I will rebase my series on top of this patch (its final
version, that is).
-- 
Duy

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/2] Save terminal width before setting up pager and export term_columns()
  2012-02-14 11:44                   ` Nguyen Thai Ngoc Duy
@ 2012-02-14 11:53                     ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-14 11:53 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git, gitster, Michael J Gruber

On 02/14/2012 12:44 PM, Nguyen Thai Ngoc Duy wrote:
> 2012/2/12 Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>:
>> This replaces cb0850f (Save terminal width before setting up pager -
>> 2012-02-04) from Nguyễn Thái Ngọc Duy and my previous patch to export
>> term_columns().
>>
>> This is directly on top of v1.7.9 as requested.
>>
>> I removed Signed-off-by from Nguyễn and Junio because the patch is
>> substantially changed.
>
> No problems. I will rebase my series on top of this patch (its final
> version, that is).
Hi, I think that Junio's will be the final version. I have no objections 
to it.

Zbyszek

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH v2] make lineno_width() from blame reusable for others
  2012-02-13 23:29                   ` Junio C Hamano
@ 2012-02-14 12:24                     ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-14 12:24 UTC (permalink / raw)
  To: git, gitster, pclouds; +Cc: Michael J Gruber, Zbigniew Jędrzejewski-Szmek

builtin/blame.c has a helper function to compute how many columns we
need to show a line-number, whose implementation is reusable as a more
generic helper function to count the number of columns necessary to
show any cardinal number.

Rename it to decimal_width(), move it to pager.c and export it for use
by future callers. The argument type is changed to unsigned to underline
the fact that the function supports only non-negative numbers.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
I'll be using this in the 'diff --stat: use the full terminal width'
patch.

v2: - change arg type to unsigned
    - corrected commit message

 builtin/blame.c | 18 +++---------------
 cache.h         |  1 +
 pager.c         | 12 ++++++++++++
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 5a67c20..f028e8a 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1829,18 +1829,6 @@ static int read_ancestry(const char *graft_file)
 }
 
 /*
- * How many columns do we need to show line numbers in decimal?
- */
-static int lineno_width(int lines)
-{
-	int i, width;
-
-	for (width = 1, i = 10; i <= lines; width++)
-		i *= 10;
-	return width;
-}
-
-/*
  * How many columns do we need to show line numbers, authors,
  * and filenames?
  */
@@ -1880,9 +1868,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
 		if (largest_score < ent_score(sb, e))
 			largest_score = ent_score(sb, e);
 	}
-	max_orig_digits = lineno_width(longest_src_lines);
-	max_digits = lineno_width(longest_dst_lines);
-	max_score_digits = lineno_width(largest_score);
+	max_orig_digits = decimal_width(longest_src_lines);
+	max_digits = decimal_width(longest_dst_lines);
+	max_score_digits = decimal_width(largest_score);
 }
 
 /*
diff --git a/cache.h b/cache.h
index 2f30b3a..3504bcc 100644
--- a/cache.h
+++ b/cache.h
@@ -1176,6 +1176,7 @@ extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 extern int term_columns(void);
+extern int decimal_width(unsigned number);
 
 extern const char *editor_program;
 extern const char *askpass_program;
diff --git a/pager.c b/pager.c
index e06cfa0..2e16a9c 100644
--- a/pager.c
+++ b/pager.c
@@ -153,3 +153,15 @@ int term_columns(void)
 #endif
 	return term_columns_at_startup;
 }
+
+/*
+ * How many columns do we need to show this number in decimal?
+ */
+int decimal_width(unsigned number)
+{
+	int i, width;
+
+	for (width = 1, i = 10; i <= number; width++)
+		i *= 10;
+	return width;
+}
-- 
1.7.9.3.g2429d.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 1/3 v4] diff --stat: use the full terminal width
  2012-02-14  1:08             ` Junio C Hamano
@ 2012-02-14 23:45               ` Zbigniew Jędrzejewski-Szmek
  2012-02-14 23:45                 ` [PATCH 2/3 v4] diff --stat: better alignment for binary files Zbigniew Jędrzejewski-Szmek
                                   ` (4 more replies)
  0 siblings, 5 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-14 23:45 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

Use as many columns as necessary for filenames, as few columns as
necessary for change counts, and up to 40 columns for the graph.

Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the filename part in stat output can be almost useless. If
the middle part between { and } is long (because the file was moved to
a completely different directory), then most of the path would be
truncated.

It makes sense to detect and use the full terminal width and display
full filenames if possible.

If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph would use the full
width, the output would look bad. Messages wrapped to about 80 columns
would be interspersed with very long +- lines. It makes sense to limit
the width of the graph part to a fixed value, even if more columns are
available. This fixed value is subjectively hard-coded to be 40
columns, which seems to work well for git.git and linux-2.6.git and
some other repositories.

If there isn't enough columns to print both the filename and the
graph, at least 5/8 of available space is devoted to filenames. On a
standard 80 column terminal, or if not connected to a terminal and
using the default of 80 columns, this gives the same partition as
before.

Number of columns required for change counts is computed based on the
maximum number of changed lines. This means that usually a few more
columns will be available for the filenames and the graph.

Eleven tests are added for various combinations of long filename and
big change count and ways to specify widths.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
Hi,

thank you for the review and comments. I think that they are all taken
into account.

While working on the tests, I noticed that it would be nice to align
the output for binary files ("Bin XXX -> YYY bytes") -- that change
is the subject of patch 2/3.

Tutorial is updated along with tests in 3/3.

I've added 'v4' to the other two patches in this series like to this
one, despite them beeing new. I hope that this is proper form.

v4:
- comments are updated and the word "histogram" is banished
- "mopping up" is removed (but the minimum width are guaranteed)

v3:
- use decimal_width(max_change) to calculate number of columns
  required for change counts
- rework the logic to divide columns
- document the logic in comments, update docs
- add more tests

v2:
- style fixes
- some tests for git-format-patch added
- patches 3 and 4 squashed together, since they touch the same lines
- graph width is limited to 40 columns, even if there's more space
- patch descriptions extended and cleared up


 Documentation/diff-options.txt | 14 +++---
 diff.c                         | 94 +++++++++++++++++++++++++++------------
 t/t4014-format-patch.sh        | 96 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 169 insertions(+), 35 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9f7cba2..36e4ee3 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -53,13 +53,15 @@ endif::git-format-patch[]
 	Generate a diff using the "patience diff" algorithm.
 
 --stat[=<width>[,<name-width>[,<count>]]]::
-	Generate a diffstat.  You can override the default
-	output width for 80-column terminal by `--stat=<width>`.
-	The width of the filename part can be controlled by
-	giving another width to it separated by a comma.
+	Generate a diffstat. By default, as much space as necessary
+	will be used for the filename part, and up to 40 columns for
+	the graph part. Maximum width defaults to terminal width,
+	or 80 columns if not connected to a terminal, and can be
+	overriden by `<width>`. The width of the filename part can be
+	limited by giving another width `<name-width>` after a comma.
 	By giving a third parameter `<count>`, you can limit the
-	output to the first `<count>` lines, followed by
-	`...` if there are more.
+	output to the first `<count>` lines, followed by `...` if
+	there are more.
 +
 These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
diff --git a/diff.c b/diff.c
index 7e15426..4dc2b5c 100644
--- a/diff.c
+++ b/diff.c
@@ -1327,7 +1327,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
 	int total_files = data->nr;
-	int width, name_width, count;
+	int width, name_width, graph_width, number_width, count;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1341,25 +1341,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		line_prefix = msg->buf;
 	}
 
-	width = options->stat_width ? options->stat_width : 80;
-	name_width = options->stat_name_width ? options->stat_name_width : 50;
 	count = options->stat_count ? options->stat_count : data->nr;
 
-	/* Sanity: give at least 5 columns to the graph,
-	 * but leave at least 10 columns for the name.
-	 */
-	if (width < 25)
-		width = 25;
-	if (name_width < 10)
-		name_width = 10;
-	else if (width < name_width + 15)
-		name_width = width - 15;
-
-	/* Find the longest filename and max number of changes */
 	reset = diff_get_color_opt(options, DIFF_RESET);
 	add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
 	del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
 
+	/*
+	 * Find the longest filename and max number of changes
+	 */
 	for (i = 0; (i < count) && (i < data->nr); i++) {
 		struct diffstat_file *file = data->files[i];
 		uintmax_t change = file->added + file->deleted;
@@ -1380,19 +1370,64 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	}
 	count = i; /* min(count, data->nr) */
 
-	/* Compute the width of the graph part;
-	 * 10 is for one blank at the beginning of the line plus
-	 * " | count " between the name and the graph.
+	/*
+	 * We have width = stat_width or term_columns() columns total.
+	 * We want a maximum of min(max_len, stat_name_width) for the name part.
+	 * We want a maximum of min(max_change, 40) for the +- part.
+	 * We also need 1 for " " and 4 + decimal_width(max_change)
+	 * for " | NNNN " and one the empty column at the end, altogether
+	 * 6 + decimal_width(max_change).
+	 *
+	 * If there's not enough space, we will use the smaller of
+	 * stat_name_width (if set) and 5/8*width for the filename,
+	 * and the rest for constant elements + histogram, but no more
+	 * than 40 for the histogram.
+	 * (5/8 gives 50 for filename and 30 for constant parts +
+	 * histogram for the standard terminal size).
 	 *
-	 * From here on, name_width is the width of the name area,
-	 * and width is the width of the graph area.
+	 * In other words: stat_width limits the maximum width, and
+	 * stat_name_width fixes the maximum width of the filename,
+	 * and is also used to divide available columns if there
+	 * aren't enough.
 	 */
-	name_width = (name_width < max_len) ? name_width : max_len;
-	if (width < (name_width + 10) + max_change)
-		width = width - (name_width + 10);
-	else
-		width = max_change;
 
+	width = options->stat_width ? options->stat_width : term_columns();
+	number_width = decimal_width(max_change);
+
+	/*
+	 * Guarantee 3/8*16==6 for the graph part
+	 * and 5/8*16==10 for the filename part
+	 */
+	if (width < 16 + 6 + number_width)
+		width = 16 + 6 + number_width;
+
+	/*
+	 * First assign sizes that are wanted, ignoring available width.
+	 */
+	graph_width = max_change < 40 ? max_change : 40;
+	name_width = (options->stat_name_width > 0 &&
+		      options->stat_name_width < max_len) ?
+		options->stat_name_width : max_len;
+
+	/*
+	 * Adjust adjustable widths not to exceed maximum width
+	 */
+	if (name_width + number_width + 6 + graph_width > width) {
+		if (graph_width > width * 3/8 - number_width - 6)
+			graph_width = width * 3/8 - number_width - 6;
+		if (graph_width > 40)
+			graph_width =  40;
+		if (name_width > width - number_width - 6 - graph_width)
+			name_width = width - number_width - 6 - graph_width;
+		else
+			graph_width = width - number_width - 6 - name_width;
+	}
+
+	/*
+	 * From here name_width is the width of the name area,
+	 * and graph_width is the width of the graph area.
+	 * max_change is used to scale graph properly.
+	 */
 	for (i = 0; i < count; i++) {
 		const char *prefix = "";
 		char *name = data->files[i]->print_name;
@@ -1448,14 +1483,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		adds += add;
 		dels += del;
 
-		if (width <= max_change) {
-			add = scale_linear(add, width, max_change);
-			del = scale_linear(del, width, max_change);
+		if (graph_width <= max_change) {
+			add = scale_linear(add, graph_width, max_change);
+			del = scale_linear(del, graph_width, max_change);
 		}
 		fprintf(options->file, "%s", line_prefix);
 		show_name(options->file, prefix, name, len);
-		fprintf(options->file, "%5"PRIuMAX"%s", added + deleted,
-				added + deleted ? " " : "");
+		fprintf(options->file, " %*"PRIuMAX"%s",
+			number_width, added + deleted,
+			added + deleted ? " " : "");
 		show_graph(options->file, '+', add, add_c, reset);
 		show_graph(options->file, '-', del, del_c, reset);
 		fprintf(options->file, "\n");
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6797512..a65ade4 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -894,4 +894,100 @@ test_expect_success 'format patch ignores color.ui' '
 	test_cmp expect actual
 '
 
+name=aaaaaaaaaa
+name=$name$name$name$name$name$name$name$name$name$name$name$name
+test_expect_success 'preparation' "
+	> ${name} &&
+	git add ${name} &&
+	git commit -m message &&
+	echo a > ${name} &&
+	git commit -m message ${name}
+"
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch graph width is 80 columns' '
+	git format-patch --stat --stdout -1 |
+		grep -m 1 aaaaa > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
+EOF
+test_expect_success 'format patch --stat=width with long name' '
+	git format-patch --stat=40 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width works long name' '
+	git format-patch --stat-width=40 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat=...,name-width with long name' '
+	git format-patch --stat=60,32 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-name-width with long name' '
+	git format-patch --stat-name-width=32 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'preparation' '
+	> abcd &&
+	git add abcd &&
+	git commit -m message &&
+	seq 1000 > abcd &&
+	git commit -m message abcd
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch graph width is 40 columns' '
+	git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch ignores COLUMNS' '
+	COLUMNS=200 git format-patch --stat --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change' '
+	git format-patch --stat=40 --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width with big change' '
+	git format-patch --stat-width=40 --stdout -1 |
+		grep -m 1 abcd > actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change and long name' '
+	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git commit -m message &&
+	git format-patch --stat-width=60 --stdout -1 |
+		grep -m 1 aaaa > actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
1.7.9.6.ga1838.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 2/3 v4] diff --stat: better alignment for binary files
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
@ 2012-02-14 23:45                 ` Zbigniew Jędrzejewski-Szmek
  2012-02-14 23:45                 ` [PATCH 3/3 v4] Update diff --stat output in tests and tutorial Zbigniew Jędrzejewski-Szmek
                                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-14 23:45 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

The output for binary and unmerged files was not updated in
'diff --stat': use the full terminal width'. This fixes this
omission and modifies the graph width logic to include enough
space for "Bin XXX -> YYY bytes".

If changes to binary files are mixed with changes to text files,
change counts are padded to take at least three columns. And the other
way around, if change counts require more than three columns, then
"Bin"s is padded to align with the change count. This way, the +- part
starts in the same column as "XXX -> YYY" part for binary files. This
makes the graph easier to parse visually thanks to the empty column.
This mimics the old layout of diff --stat.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
 diff.c                 | 39 ++++++++++++++++++++++++++++++++-------
 t/t4012-diff-binary.sh | 17 +++++++++++++++++
 2 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/diff.c b/diff.c
index 4dc2b5c..0732623 100644
--- a/diff.c
+++ b/diff.c
@@ -1326,8 +1326,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 {
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
-	int total_files = data->nr;
-	int width, name_width, graph_width, number_width, count;
+	int total_files = data->nr, count;
+	int width, name_width, graph_width, number_width = 0, bin_width = 0;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1363,8 +1363,21 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		if (max_len < len)
 			max_len = len;
 
-		if (file->is_binary || file->is_unmerged)
+		if (file->is_unmerged) {
+			/* "Unmerged" is 8 characters */
+			bin_width = bin_width < 8 ? 8 : bin_width;
 			continue;
+		}
+		if (file->is_binary) {
+			/* "Bin XXX -> YYY bytes" */
+			int w = 14 + decimal_width(file->added)
+				+ decimal_width(file->deleted);
+			bin_width = bin_width < w ? w : bin_width;
+			/* Display change counts aligned with "Bin" */
+			number_width = 3;
+			continue;
+		}
+
 		if (max_change < change)
 			max_change = change;
 	}
@@ -1389,10 +1402,19 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	 * stat_name_width fixes the maximum width of the filename,
 	 * and is also used to divide available columns if there
 	 * aren't enough.
+	 *
+	 * Binary files are displayed with "Bin XXX -> YYY bytes"
+	 * instead of the change count and graph. This part is treated
+	 * similarly to the graph part, except that it is not
+	 * "scaled". If total width is too small to accomodate the
+	 * guaranteed minimum width of the filename part and the
+	 * separators and this message, this message will "overflow"
+	 * making the line longer than the maximum width.
 	 */
 
 	width = options->stat_width ? options->stat_width : term_columns();
-	number_width = decimal_width(max_change);
+	number_width = decimal_width(max_change) > number_width ?
+		decimal_width(max_change) : number_width;
 
 	/*
 	 * Guarantee 3/8*16==6 for the graph part
@@ -1403,8 +1425,11 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 
 	/*
 	 * First assign sizes that are wanted, ignoring available width.
+	 * (strlen("Bin XXX -> YYY bytes") is bin_width + 4)
 	 */
-	graph_width = max_change < 40 ? max_change : 40;
+	graph_width = max_change + 4 > bin_width ? max_change : bin_width - 4;
+	if (graph_width > 40)
+		graph_width = 40;
 	name_width = (options->stat_name_width > 0 &&
 		      options->stat_name_width < max_len) ?
 		options->stat_name_width : max_len;
@@ -1458,7 +1483,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		if (data->files[i]->is_binary) {
 			fprintf(options->file, "%s", line_prefix);
 			show_name(options->file, prefix, name, len);
-			fprintf(options->file, "  Bin ");
+			fprintf(options->file, " %*s ", number_width, "Bin");
 			fprintf(options->file, "%s%"PRIuMAX"%s",
 				del_c, deleted, reset);
 			fprintf(options->file, " -> ");
@@ -1471,7 +1496,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		else if (data->files[i]->is_unmerged) {
 			fprintf(options->file, "%s", line_prefix);
 			show_name(options->file, prefix, name, len);
-			fprintf(options->file, "  Unmerged\n");
+			fprintf(options->file, " Unmerged\n");
 			continue;
 		}
 
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index 2d9f9a0..ea0b376 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -90,4 +90,21 @@ test_expect_success 'diff --no-index with binary creation' '
 	test_cmp expected actual
 '
 
+cat >expect <<EOF
+ binfile  |   Bin 0 -> 1026 bytes
+ textfile | 10000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+
+test_expect_success 'diff with binary files and big change count
+
+	Verify that "Bin" and the change count are properly aligned when
+	change count is big' '
+	echo X | dd of=binfile bs=1k seek=1 &&
+	git add binfile &&
+	seq 10000 > textfile &&
+	git add textfile &&
+	git diff --cached --stat binfile textfile | grep " | " > actual
+	test_cmp expect actual
+'
+
 test_done
-- 
1.7.9.6.ga1838.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 3/3 v4] Update diff --stat output in tests and tutorial
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
  2012-02-14 23:45                 ` [PATCH 2/3 v4] diff --stat: better alignment for binary files Zbigniew Jędrzejewski-Szmek
@ 2012-02-14 23:45                 ` Zbigniew Jędrzejewski-Szmek
  2012-02-15  1:21                   ` Junio C Hamano
  2012-02-15  0:07                 ` [PATCH 1/3 v4] diff --stat: use the full terminal width Junio C Hamano
                                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-14 23:45 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
All tests pass for me after this change.

git grep -l -E '^\s+[-a-z A-Z0-9/{}=>.]+ +\|  +[0-9]+ +[-+]+' t/ |
  grep -v apply |
  xargs sed -i -r 's/^(\s+[-a-zA-Z0-9/ {}=>.]+ +\| ) +([0-9]+ +[-+]+)/\1\2/; s/^(\s+[-a-zA-Z0-9/{}=>.]+ +\| ) +(Bin.*)/\1\2/'
+ manual fixes.

 Documentation/gitcore-tutorial.txt                 |  4 +-
 t/t0023-crlf-am.sh                                 |  2 +-
 t/t1200-tutorial.sh                                |  4 +-
 t/t3404-rebase-interactive.sh                      |  2 +-
 t/t3903-stash.sh                                   |  4 +-
 ...ff-tree_--cc_--patch-with-stat_--summary_master |  4 +-
 ...diff-tree_--cc_--patch-with-stat_--summary_side |  6 +-
 .../diff.diff-tree_--cc_--patch-with-stat_master   |  4 +-
 .../diff.diff-tree_--cc_--stat_--summary_master    |  4 +-
 t/t4013/diff.diff-tree_--cc_--stat_--summary_side  |  6 +-
 t/t4013/diff.diff-tree_--cc_--stat_master          |  4 +-
 ...pretty=oneline_--root_--patch-with-stat_initial |  6 +-
 .../diff.diff-tree_--pretty_--patch-with-stat_side |  6 +-
 ...-tree_--pretty_--root_--patch-with-stat_initial |  6 +-
 ...f-tree_--pretty_--root_--stat_--summary_initial |  6 +-
 .../diff.diff-tree_--pretty_--root_--stat_initial  |  6 +-
 ...diff.diff-tree_--root_--patch-with-stat_initial |  6 +-
 t/t4013/diff.diff-tree_-c_--stat_--summary_master  |  4 +-
 t/t4013/diff.diff-tree_-c_--stat_--summary_side    |  6 +-
 t/t4013/diff.diff-tree_-c_--stat_master            |  4 +-
 .../diff.diff_--patch-with-stat_-r_initial..side   |  6 +-
 t/t4013/diff.diff_--patch-with-stat_initial..side  |  6 +-
 t/t4013/diff.diff_--stat_initial..side             |  6 +-
 t/t4013/diff.diff_-r_--stat_initial..side          |  6 +-
 ..._--attach_--stdout_--suffix=.diff_initial..side |  6 +-
 ....format-patch_--attach_--stdout_initial..master | 16 +++---
 ...format-patch_--attach_--stdout_initial..master^ | 10 ++--
 ...ff.format-patch_--attach_--stdout_initial..side |  6 +-
 ...nline_--stdout_--numbered-files_initial..master | 16 +++---
 ...tdout_--subject-prefix=TESTCASE_initial..master | 16 +++---
 ....format-patch_--inline_--stdout_initial..master | 16 +++---
 ...format-patch_--inline_--stdout_initial..master^ | 10 ++--
 ...ormat-patch_--inline_--stdout_initial..master^^ |  6 +-
 ...ff.format-patch_--inline_--stdout_initial..side |  6 +-
 ...tch_--stdout_--cover-letter_-n_initial..master^ | 18 ++++----
 ...at-patch_--stdout_--no-numbered_initial..master | 16 +++---
 ...ormat-patch_--stdout_--numbered_initial..master | 16 +++---
 t/t4013/diff.format-patch_--stdout_initial..master | 16 +++---
 .../diff.format-patch_--stdout_initial..master^    | 10 ++--
 t/t4013/diff.format-patch_--stdout_initial..side   |  6 +-
 ....log_--patch-with-stat_--summary_master_--_dir_ |  6 +-
 t/t4013/diff.log_--patch-with-stat_master          | 16 +++---
 t/t4013/diff.log_--patch-with-stat_master_--_dir_  |  6 +-
 ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++-----
 ...f.log_--root_--patch-with-stat_--summary_master | 22 ++++----
 t/t4013/diff.log_--root_--patch-with-stat_master   | 22 ++++----
 ...og_--root_-c_--patch-with-stat_--summary_master | 26 +++++-----
 t/t4013/diff.show_--patch-with-stat_--summary_side |  6 +-
 t/t4013/diff.show_--patch-with-stat_side           |  6 +-
 t/t4013/diff.show_--stat_--summary_side            |  6 +-
 t/t4013/diff.show_--stat_side                      |  6 +-
 ...nged_--patch-with-stat_--summary_master_--_dir_ |  6 +-
 t/t4013/diff.whatchanged_--patch-with-stat_master  | 16 +++---
 ...ff.whatchanged_--patch-with-stat_master_--_dir_ |  6 +-
 ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++-----
 ...anged_--root_--patch-with-stat_--summary_master | 22 ++++----
 ...iff.whatchanged_--root_--patch-with-stat_master | 22 ++++----
 ...ed_--root_-c_--patch-with-stat_--summary_master | 26 +++++-----
 t/t4014-format-patch.sh                            |  2 +-
 t/t4016-diff-quote.sh                              | 14 +++---
 t/t4030-diff-textconv.sh                           |  2 +-
 t/t4043-diff-rename-binary.sh                      |  4 +-
 t/t4045-diff-relative.sh                           |  2 +-
 t/t4047-diff-dirstat.sh                            | 54 +++++++++++-----------
 t/t4049-diff-stat-count.sh                         |  4 +-
 t/t5100/patch0001                                  |  2 +-
 t/t5100/patch0002                                  |  2 +-
 t/t5100/patch0003                                  |  2 +-
 t/t5100/patch0005                                  |  4 +-
 t/t5100/patch0006                                  |  2 +-
 t/t5100/patch0010                                  |  2 +-
 t/t5100/patch0011                                  |  2 +-
 t/t5100/patch0014                                  |  2 +-
 t/t5100/patch0014--scissors                        |  2 +-
 t/t5100/sample.mbox                                | 18 ++++----
 t/t7602-merge-octopus-many.sh                      | 12 ++--
 76 files changed, 356 insertions(+), 356 deletions(-)

diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt
index c27d086..b781bbf 100644
--- a/Documentation/gitcore-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -1002,8 +1002,8 @@ would be different)
 ----------------
 Updating from ae3a2da... to a80b4aa....
 Fast-forward (no commit created; -m option ignored)
- example |    1 +
- hello   |    1 +
+ example | 1 +
+ hello   | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
 ----------------
 
diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh
index aaed725..f9bbb91 100755
--- a/t/t0023-crlf-am.sh
+++ b/t/t0023-crlf-am.sh
@@ -11,7 +11,7 @@ Date: Thu, 23 Aug 2007 13:00:00 +0200
 Subject: test1
 
 ---
- foo |    1 +
+ foo | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 foo
 
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 5e29e13..77ff21c 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -154,8 +154,8 @@ test_expect_success 'git show-branch' '
 cat > resolve.expect << EOF
 Updating VARIABLE..VARIABLE
 FASTFORWARD (no commit created; -m option ignored)
- example |    1 +
- hello   |    1 +
+ example | 1 +
+ hello   | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
 EOF
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b981572..c8fe1a9 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -323,7 +323,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
 	echo resolved > file1 &&
 	git add file1 &&
 	git rebase --continue > output &&
-	grep "^ file1 |    2 +-$" output
+	grep "^ file1 | 2 +-$" output
 '
 
 test_expect_success 'multi-squash only fires up editor once' '
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index dbe2ac1..fbf064e 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -443,7 +443,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	cat >expected <<-EOF &&
-	 file |    1 +
+	 file | 1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
 	git stash show ${STASH_ID} >actual &&
@@ -481,7 +481,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	cat >expected <<-EOF &&
-	 file |    1 +
+	 file | 1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
 	git stash show ${STASH_ID} >actual &&
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
index 3a9f78a..b87f758 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
@@ -1,7 +1,7 @@
 $ git diff-tree --cc --patch-with-stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
index a61ad8c..47665f9 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree --cc --patch-with-stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
index 49f23b9..efe6dcc 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
@@ -1,7 +1,7 @@
 $ git diff-tree --cc --patch-with-stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
index cc6eb3b..1b465f0 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
@@ -1,6 +1,6 @@
 $ git diff-tree --cc --stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
index 50362be..44fcf4e 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree --cc --stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_master b/t/t4013/diff.diff-tree_--cc_--stat_master
index fae7f33..6dffb7f 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_master
+++ b/t/t4013/diff.diff-tree_--cc_--stat_master
@@ -1,6 +1,6 @@
 $ git diff-tree --cc --stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
index d5c333a..a7d91c9 100644
--- a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
@@ -1,8 +1,8 @@
 $ git diff-tree --pretty=oneline --root --patch-with-stat initial
 444ac553ac7612cc88969031b02b3767fb8a353a Initial
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
index 4d30e7e..2061f37 100644
--- a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
+++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
index 7dfa6af..71d912e 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
index 43bfce2..b80dbcc 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
index 9154aa4..88cb5c9 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
index 1562b62..748ba93 100644
--- a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
@@ -1,8 +1,8 @@
 $ git diff-tree --root --patch-with-stat initial
 444ac553ac7612cc88969031b02b3767fb8a353a
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_master b/t/t4013/diff.diff-tree_-c_--stat_--summary_master
index ac9f641..700c386 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_master
+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_master
@@ -1,6 +1,6 @@
 $ git diff-tree -c --stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_side b/t/t4013/diff.diff-tree_-c_--stat_--summary_side
index 2afcca1..520aa4f 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_side
+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree -c --stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.diff-tree_-c_--stat_master b/t/t4013/diff.diff-tree_-c_--stat_master
index c2fe6a9..cdc7c40 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_master
+++ b/t/t4013/diff.diff-tree_-c_--stat_master
@@ -1,6 +1,6 @@
 $ git diff-tree -c --stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
index 9ed317a..abf43a9 100644
--- a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
+++ b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
@@ -1,7 +1,7 @@
 $ git diff --patch-with-stat -r initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff_--patch-with-stat_initial..side b/t/t4013/diff.diff_--patch-with-stat_initial..side
index 8b50629..f88262e 100644
--- a/t/t4013/diff.diff_--patch-with-stat_initial..side
+++ b/t/t4013/diff.diff_--patch-with-stat_initial..side
@@ -1,7 +1,7 @@
 $ git diff --patch-with-stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff_--stat_initial..side b/t/t4013/diff.diff_--stat_initial..side
index 0517b5d..17a07be 100644
--- a/t/t4013/diff.diff_--stat_initial..side
+++ b/t/t4013/diff.diff_--stat_initial..side
@@ -1,6 +1,6 @@
 $ git diff --stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff_-r_--stat_initial..side b/t/t4013/diff.diff_-r_--stat_initial..side
index 245220d..54507eb 100644
--- a/t/t4013/diff.diff_-r_--stat_initial..side
+++ b/t/t4013/diff.diff_-r_--stat_initial..side
@@ -1,6 +1,6 @@
 $ git diff -r --stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
index 52116d3..6996877 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
+++ b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
index ce49bd6..d56a1a3 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
index 5f1b238..b76e61f 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
index 4a2364a..769cf32 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
index 43b81eb..0ee7338 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
index ca3f60b..fbf3bd4 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_initial..master
index 08f2301..d68e3ee 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
index 07f1230..668e38f 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
index 29e00ab..caec553 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..side b/t/t4013/diff.format-patch_--inline_--stdout_initial..side
index 67633d4..6b84b1b 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
index 3b4e113..d8cba57 100644
--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
@@ -10,10 +10,10 @@ A U Thor (2):
   Second
   Third
 
- dir/sub |    4 ++++
- file0   |    3 +++
- file1   |    3 +++
- file2   |    3 ---
+ dir/sub | 4 ++++
+ file0   | 3 +++
+ file1   | 3 +++
+ file2   | 3 ---
  4 files changed, 10 insertions(+), 3 deletions(-)
  create mode 100644 file1
  delete mode 100644 file2
@@ -28,9 +28,9 @@ Subject: [DIFFERENT_PREFIX 1/2] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [DIFFERENT_PREFIX 2/2] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
index f7752eb..a2a4726 100644
--- a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
index 8e67dbf..602f4b0 100644
--- a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/3] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH 3/3] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master b/t/t4013/diff.format-patch_--stdout_initial..master
index 7b89978..bcf739e 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/3] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH 3/3] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master^ b/t/t4013/diff.format-patch_--stdout_initial..master^
index b7f9725..7d5ba0f 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_initial..master^
@@ -6,9 +6,9 @@ Subject: [PATCH 1/2] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/2] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..side b/t/t4013/diff.format-patch_--stdout_initial..side
index e765088..9ed0ea2 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--stdout_initial..side
@@ -5,9 +5,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
index bd7f5c0..e2954d3 100644
--- a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
+++ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--patch-with-stat_master b/t/t4013/diff.log_--patch-with-stat_master
index 14595a6..e417873 100644
--- a/t/t4013/diff.log_--patch-with-stat_master
+++ b/t/t4013/diff.log_--patch-with-stat_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--patch-with-stat_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_
index 5a4e727..cebec52 100644
--- a/t/t4013/diff.log_--patch-with-stat_master_--_dir_
+++ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_
@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
index df0aaa9..540633f 100644
--- a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
index c11b5f2c..fb289d8 100644
--- a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -55,8 +55,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -88,9 +88,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -130,9 +130,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.log_--root_--patch-with-stat_master b/t/t4013/diff.log_--root_--patch-with-stat_master
index 5f0c98f..84f535d 100644
--- a/t/t4013/diff.log_--root_--patch-with-stat_master
+++ b/t/t4013/diff.log_--root_--patch-with-stat_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -127,9 +127,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
index e62c368..3e89ace 100644
--- a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --combined dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.show_--patch-with-stat_--summary_side b/t/t4013/diff.show_--patch-with-stat_--summary_side
index 377f2b7..38c1841 100644
--- a/t/t4013/diff.show_--patch-with-stat_--summary_side
+++ b/t/t4013/diff.show_--patch-with-stat_--summary_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.show_--patch-with-stat_side b/t/t4013/diff.show_--patch-with-stat_side
index fb14c53..38f6be2 100644
--- a/t/t4013/diff.show_--patch-with-stat_side
+++ b/t/t4013/diff.show_--patch-with-stat_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.show_--stat_--summary_side b/t/t4013/diff.show_--stat_--summary_side
index 5bd5977..e6f30a4 100644
--- a/t/t4013/diff.show_--stat_--summary_side
+++ b/t/t4013/diff.show_--stat_--summary_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.show_--stat_side b/t/t4013/diff.show_--stat_side
index 3b22327..58ee49a 100644
--- a/t/t4013/diff.show_--stat_side
+++ b/t/t4013/diff.show_--stat_side
@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
index 6a467cc..ee340b8 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master b/t/t4013/diff.whatchanged_--patch-with-stat_master
index 1e1bbe1..4adeab7 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_master
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
index 13789f1..63a3043 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
index e96ff1f..60f3788 100644
--- a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
index 0291153..9b7f63f 100644
--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -48,8 +48,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -81,9 +81,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -123,9 +123,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
index 9b0349c..cba8f3c 100644
--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
index c0aff68..8e24293 100644
--- a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --combined dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index a65ade4..91be989 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
 
 cat > expect << EOF
 ---
- file |   16 ++++++++++++++++
+ file | 16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)
 
 diff --git a/file b/file
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index ab0c2f0..e451f2a 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -59,13 +59,13 @@ test_expect_success TABS_IN_FILENAMES 'git diff --summary -M HEAD' '
 
 test_expect_success TABS_IN_FILENAMES 'setup expected files' '
 cat >expect <<\EOF
- pathname.1 => "Rpathname\twith HT.0"            |    0
- pathname.3 => "Rpathname\nwith LF.0"            |    0
- "pathname\twith HT.3" => "Rpathname\nwith LF.1" |    0
- pathname.2 => Rpathname with SP.0               |    0
- "pathname\twith HT.2" => Rpathname with SP.1    |    0
- pathname.0 => Rpathname.0                       |    0
- "pathname\twith HT.0" => Rpathname.1            |    0
+ pathname.1 => "Rpathname\twith HT.0"            | 0
+ pathname.3 => "Rpathname\nwith LF.0"            | 0
+ "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0
+ pathname.2 => Rpathname with SP.0               | 0
+ "pathname\twith HT.2" => Rpathname with SP.1    | 0
+ pathname.0 => Rpathname.0                       | 0
+ "pathname\twith HT.0" => Rpathname.1            | 0
  7 files changed, 0 insertions(+), 0 deletions(-)
 EOF
 '
diff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh
index 88c5619..6a6344c 100755
--- a/t/t4030-diff-textconv.sh
+++ b/t/t4030-diff-textconv.sh
@@ -85,7 +85,7 @@ test_expect_success 'status -v produces text' '
 '
 
 cat >expect.stat <<'EOF'
- file |  Bin 2 -> 4 bytes
+ file | Bin 2 -> 4 bytes
  1 files changed, 0 insertions(+), 0 deletions(-)
 EOF
 test_expect_success 'diffstat does not run textconv' '
diff --git a/t/t4043-diff-rename-binary.sh b/t/t4043-diff-rename-binary.sh
index 0601281..ad0b2da 100755
--- a/t/t4043-diff-rename-binary.sh
+++ b/t/t4043-diff-rename-binary.sh
@@ -23,8 +23,8 @@ test_expect_success 'move the files into a "sub" directory' '
 '
 
 cat > expected <<\EOF
- bar => sub/bar |  Bin 5 -> 5 bytes
- foo => sub/foo |    0
+ bar => sub/bar | Bin 5 -> 5 bytes
+ foo => sub/foo |   0
  2 files changed, 0 insertions(+), 0 deletions(-)
 
 diff --git a/bar b/sub/bar
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 8a3c63b..336df82 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -32,7 +32,7 @@ test_expect_success "-p $*" "
 check_stat() {
 expect=$1; shift
 cat >expected <<EOF
- $expect |    1 +
+ $expect | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 EOF
 test_expect_success "--stat $*" "
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index 29e80a5..75eaf16 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -252,41 +252,41 @@ EOF
 '
 
 cat <<EOF >expect_diff_stat
- changed/text             |    2 +-
- dst/copy/changed/text    |   10 ++++++++++
- dst/copy/rearranged/text |   10 ++++++++++
- dst/copy/unchanged/text  |   10 ++++++++++
- dst/move/changed/text    |   10 ++++++++++
- dst/move/rearranged/text |   10 ++++++++++
- dst/move/unchanged/text  |   10 ++++++++++
- rearranged/text          |    2 +-
- src/move/changed/text    |   10 ----------
- src/move/rearranged/text |   10 ----------
- src/move/unchanged/text  |   10 ----------
+ changed/text             |  2 +-
+ dst/copy/changed/text    | 10 ++++++++++
+ dst/copy/rearranged/text | 10 ++++++++++
+ dst/copy/unchanged/text  | 10 ++++++++++
+ dst/move/changed/text    | 10 ++++++++++
+ dst/move/rearranged/text | 10 ++++++++++
+ dst/move/unchanged/text  | 10 ++++++++++
+ rearranged/text          |  2 +-
+ src/move/changed/text    | 10 ----------
+ src/move/rearranged/text | 10 ----------
+ src/move/unchanged/text  | 10 ----------
  11 files changed, 62 insertions(+), 32 deletions(-)
 EOF
 
 cat <<EOF >expect_diff_stat_M
- changed/text                      |    2 +-
- dst/copy/changed/text             |   10 ++++++++++
- dst/copy/rearranged/text          |   10 ++++++++++
- dst/copy/unchanged/text           |   10 ++++++++++
- {src => dst}/move/changed/text    |    2 +-
- {src => dst}/move/rearranged/text |    2 +-
- {src => dst}/move/unchanged/text  |    0
- rearranged/text                   |    2 +-
+ changed/text                      |  2 +-
+ dst/copy/changed/text             | 10 ++++++++++
+ dst/copy/rearranged/text          | 10 ++++++++++
+ dst/copy/unchanged/text           | 10 ++++++++++
+ {src => dst}/move/changed/text    |  2 +-
+ {src => dst}/move/rearranged/text |  2 +-
+ {src => dst}/move/unchanged/text  |  0
+ rearranged/text                   |  2 +-
  8 files changed, 34 insertions(+), 4 deletions(-)
 EOF
 
 cat <<EOF >expect_diff_stat_CC
- changed/text                      |    2 +-
- {src => dst}/copy/changed/text    |    2 +-
- {src => dst}/copy/rearranged/text |    2 +-
- {src => dst}/copy/unchanged/text  |    0
- {src => dst}/move/changed/text    |    2 +-
- {src => dst}/move/rearranged/text |    2 +-
- {src => dst}/move/unchanged/text  |    0
- rearranged/text                   |    2 +-
+ changed/text                      | 2 +-
+ {src => dst}/copy/changed/text    | 2 +-
+ {src => dst}/copy/rearranged/text | 2 +-
+ {src => dst}/copy/unchanged/text  | 0
+ {src => dst}/move/changed/text    | 2 +-
+ {src => dst}/move/rearranged/text | 2 +-
+ {src => dst}/move/unchanged/text  | 0
+ rearranged/text                   | 2 +-
  8 files changed, 6 insertions(+), 6 deletions(-)
 EOF
 
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index 641e70d..5edac4e 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -14,8 +14,8 @@ test_expect_success setup '
 	echo a >a &&
 	echo b >b &&
 	cat >expect <<-\EOF
-	 a |    1 +
-	 b |    1 +
+	 a | 1 +
+	 b | 1 +
 	 2 files changed, 2 insertions(+), 0 deletions(-)
 	EOF
 	git diff --stat --stat-count=2 >actual &&
diff --git a/t/t5100/patch0001 b/t/t5100/patch0001
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0001
+++ b/t/t5100/patch0001
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0002 b/t/t5100/patch0002
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0002
+++ b/t/t5100/patch0002
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0003 b/t/t5100/patch0003
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0003
+++ b/t/t5100/patch0003
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0005 b/t/t5100/patch0005
index 7d24b24..ab7a383 100644
--- a/t/t5100/patch0005
+++ b/t/t5100/patch0005
@@ -1,7 +1,7 @@
 ---
 
- Documentation/git-cvsimport-script.txt |    9 ++++++++-
- git-cvsimport-script                   |    4 ++--
+ Documentation/git-cvsimport-script.txt | 9 ++++++++-
+ git-cvsimport-script                   | 4 ++--
  2 files changed, 10 insertions(+), 3 deletions(-)
 
 50452f9c0c2df1f04d83a26266ba704b13861632
diff --git a/t/t5100/patch0006 b/t/t5100/patch0006
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0006
+++ b/t/t5100/patch0006
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0010 b/t/t5100/patch0010
index f055481..436821c 100644
--- a/t/t5100/patch0010
+++ b/t/t5100/patch0010
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |    2 +-
+ builtin-mailinfo.c | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/patch0011 b/t/t5100/patch0011
index 8841d3c..0988713 100644
--- a/t/t5100/patch0011
+++ b/t/t5100/patch0011
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c  |    4 ++--
+ builtin-mailinfo.c  | 4 ++--
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
 index 3e5fe51..aabfe5c 100644
diff --git a/t/t5100/patch0014 b/t/t5100/patch0014
index 124efd2..3f3825f 100644
--- a/t/t5100/patch0014
+++ b/t/t5100/patch0014
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/patch0014--scissors b/t/t5100/patch0014--scissors
index 124efd2..3f3825f 100644
--- a/t/t5100/patch0014--scissors
+++ b/t/t5100/patch0014--scissors
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox
index de10312..34a09a0 100644
--- a/t/t5100/sample.mbox
+++ b/t/t5100/sample.mbox
@@ -12,7 +12,7 @@ Subject: [PATCH] a commit.
 Here is a patch from A U Thor.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -52,7 +52,7 @@ two truly blank and another full of spaces in between.
 Hope this helps.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -83,7 +83,7 @@ Message-Id: <nitpicker.12121212@example.net>
 Hopefully this would fix the problem stated there.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -249,8 +249,8 @@ actual flags.
 Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>
 ---
 
- Documentation/git-cvsimport-script.txt |    9 ++++++++-
- git-cvsimport-script                   |    4 ++--
+ Documentation/git-cvsimport-script.txt | 9 ++++++++-
+ git-cvsimport-script                   | 4 ++--
  2 files changed, 10 insertions(+), 3 deletions(-)
 
 50452f9c0c2df1f04d83a26266ba704b13861632
@@ -379,7 +379,7 @@ Subject: [PATCH] a commit.
 Here is a patch from A U Thor.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -449,7 +449,7 @@ memcmp("Subject: ", header[i], 7) will never match.
 Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
 Signed-off-by: Junio C Hamano <gitster@pobox.com>
 ---
- builtin-mailinfo.c |    2 +-
+ builtin-mailinfo.c | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
@@ -482,7 +482,7 @@ Content-Transfer-Encoding: quoted-printable
 Here comes a commit log message, and
 its second line is here.
 ---
- builtin-mailinfo.c  |    4 ++--
+ builtin-mailinfo.c  | 4 ++--
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
 index 3e5fe51..aabfe5c 100644
@@ -587,7 +587,7 @@ everything before it in the message body.
 
 Signed-off-by: Junio C Hamano <gitster@pobox.com>
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 61f36ba..5a86e24 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -54,9 +54,9 @@ Trying simple merge with c2
 Trying simple merge with c3
 Trying simple merge with c4
 Merge made by the 'octopus' strategy.
- c2.c |    1 +
- c3.c |    1 +
- c4.c |    1 +
+ c2.c | 1 +
+ c3.c | 1 +
+ c4.c | 1 +
  3 files changed, 3 insertions(+), 0 deletions(-)
  create mode 100644 c2.c
  create mode 100644 c3.c
@@ -73,7 +73,7 @@ cat >expected <<\EOF
 Already up-to-date with c4
 Trying simple merge with c5
 Merge made by the 'octopus' strategy.
- c5.c |    1 +
+ c5.c | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 c5.c
 EOF
@@ -87,8 +87,8 @@ cat >expected <<\EOF
 Fast-forwarding to: c1
 Trying simple merge with c2
 Merge made by the 'octopus' strategy.
- c1.c |    1 +
- c2.c |    1 +
+ c1.c | 1 +
+ c2.c | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
  create mode 100644 c1.c
  create mode 100644 c2.c
-- 
1.7.9.6.ga1838.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v4] diff --stat: use the full terminal width
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
  2012-02-14 23:45                 ` [PATCH 2/3 v4] diff --stat: better alignment for binary files Zbigniew Jędrzejewski-Szmek
  2012-02-14 23:45                 ` [PATCH 3/3 v4] Update diff --stat output in tests and tutorial Zbigniew Jędrzejewski-Szmek
@ 2012-02-15  0:07                 ` Junio C Hamano
  2012-02-15  1:18                 ` Junio C Hamano
  2012-02-15  7:39                 ` Johannes Sixt
  4 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15  0:07 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> I've added 'v4' to the other two patches in this series like to this
> one, despite them beeing new. I hope that this is proper form.

Yeah, we usually say [PATCH v4 1/3] to mean that this is the fourth
incarnation of the whole series (it is an instruction to reviewers to
discard anything labeled without v$N and $N smaller than 4, and read only
the ones marked with "v4") and it often happens that the earlier round did
not have three patches, so that is perfectly fine.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v4] diff --stat: use the full terminal width
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
                                   ` (2 preceding siblings ...)
  2012-02-15  0:07                 ` [PATCH 1/3 v4] diff --stat: use the full terminal width Junio C Hamano
@ 2012-02-15  1:18                 ` Junio C Hamano
  2012-02-15  7:39                 ` Johannes Sixt
  4 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15  1:18 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> - comments are updated and the word "histogram" is banished

Heh, I still see at least three instances of them in this patch.

> - use decimal_width(max_change) to calculate number of columns

Please see comments for 3/3 I'll send separately.

> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 6797512..a65ade4 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -894,4 +894,100 @@ test_expect_success 'format patch ignores color.ui' '
>  	test_cmp expect actual
>  '
>  
> +name=aaaaaaaaaa
> +name=$name$name$name$name$name$name$name$name$name$name$name$name

How long is this name?  120 columns?  I think that should be fine for any
filesystem we care about.

> +test_expect_success 'preparation' "
> +	> ${name} &&
> +	git add ${name} &&
> +	git commit -m message &&
> +	echo a > ${name} &&
> +	git commit -m message ${name}
> +"

Please write these (exactly -- paying close attention to SP) like this:

	>"$name" &&
	git add "$name" &&
        git commit -m message &&
        echo a >"$name" &&
        git commit -m message "$name"

Points to note:

 - Even though you (and the reader) may know that "$name" does not contain
   word-breaking spaces, writing double-quotes around it reduces the
   mental burden from the readers;

 - Strictly speaking, the target of I/O redirection (e.g. >"$name") does
   not have to have quotes around it, but some versions of bash are known
   to give misguided warnings against it;

 - We do not write SP between the redirection and filename, but we do have
   one SP before the redirection; and

 - Unless you want to express concatenation with string that can appear
   later in words (e.g. "${name}1"), avoid ${name} to lessen the mental
   burden to readers, as "${" often signals there is some magic coming
   (e.g. "${name#strip}").

> +cat >expect <<'EOF'
> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
> +EOF
> +test_expect_success 'format patch graph width is 80 columns' '

Please make sure this test (and all the other new tests) pass with or
without your the patch that updates diff.c, as we need to ensure that
COLUMNS=80 or vanilla format-patch produces result that is identical to
the old output without regression (again, see comments to [PATCH 3/3]).

> +	git format-patch --stat --stdout -1 |
> +		grep -m 1 aaaaa > actual &&

Do not use "grep -m $count"; it is not portable.

Literal translation of the above would be:

	sed -n -e "/aaaaa/{
        	p
                q
	}"

but you can perhaps rely on the fact that there is only one path and '|'
does not ppear in the payload or log message, and use this instead:

	grep "|" >actual

Also to catch errors in format-patch that unexpectedly dies (after all,
you are touching diff machinery with your patch), avoid using pipes, and
write it perhaps like this:

	git format-patch --stat --stdout -1 >output &&
        grep "|" >actual &&

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/3 v4] Update diff --stat output in tests and tutorial
  2012-02-14 23:45                 ` [PATCH 3/3 v4] Update diff --stat output in tests and tutorial Zbigniew Jędrzejewski-Szmek
@ 2012-02-15  1:21                   ` Junio C Hamano
  2012-02-15 11:03                     ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts Zbigniew Jędrzejewski-Szmek
  0 siblings, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15  1:21 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
> ---
> All tests pass for me after this change.

Err, this is not what I meant when I said "split that part to a different
patch".

If you didn't have this bit in [PATCH 1/3]

        -               fprintf(options->file, "%5"PRIuMAX"%s", added + deleted,
        -                               added + deleted ? " " : "");
        +               fprintf(options->file, " %*"PRIuMAX"%s",
        +                       number_width, added + deleted,

then I think most of the changes in [PATCH 3/3] is unnecessary when using
the default 80-column output, which is how the test is run.

In other words, ideally, the [PATCH 1/3] should improve the diffstat
generation code in such a way that it produces output that is identical to
the existing test vectors when COLUMNS is set to 80 but takes advantage of
wider terminal when available.  So either the above change should not be
part of [PATCH 1/3] at all, or you still chnage this fprintf(), but use
number_width that is hardcoded to 4 instead of using the value computed
with decimal_width(max_change).  As to the test part, when a wider COLUMNS
is given, the code would obviously take advantage of it, so it may:

 - contain a change to the test suite somewhere, probably t/test-lib.sh,
   to set COLUMNS=80 and export it, to make sure that the existing test
   won't be broken when the number of columns learned from ioctl(1) is
   different from 80; and

 - add a new test that explicitly sets wider COLUMNS and makes sure you
   get a wider diffstat graph.

and almost no other changes to the expected output.

If you do not arrange [PATCH 1/3] that way, we cannot verify that it does
not introduce any regression to existing users.  Just applying [1/3] would
start failing tests, and we cannot tell which failure is a false alarm due
to this change, and which ones is a real regression that you are producing
wrong output when COLUMNS is set to 80.

And then as a separate patch [PATCH 3/3] at the very end of the series,
you would either introduce the above change to fprintf(), or if you
changed fprintf() in [PATCH 1/3] but used hardcoded number_width, then
change it to use decimal_width().

That change in turn makes the bulk of this patch to update the expected
output necessary.

If your series is organized that way, we can weigh pros-and-cons of the
change to use decimal_width() a lot more easily.

Thanks.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v4] diff --stat: use the full terminal width
  2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
                                   ` (3 preceding siblings ...)
  2012-02-15  1:18                 ` Junio C Hamano
@ 2012-02-15  7:39                 ` Johannes Sixt
  4 siblings, 0 replies; 206+ messages in thread
From: Johannes Sixt @ 2012-02-15  7:39 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber, pclouds

Am 2/15/2012 0:45, schrieb Zbigniew Jędrzejewski-Szmek:
> +test_expect_success 'preparation' '
> +	> abcd &&
> +	git add abcd &&
> +	git commit -m message &&
> +	seq 1000 > abcd &&
> +	git commit -m message abcd

Please don't use seq (here and in some more places in this series); we
don't have it on Windows. You can write it explicitly:

	i=0 &&
	while test $i -lt 1000
	do
		i=$(($i + 1))
		echo $i &&
	done >abcd &&
	...

-- Hannes

^ permalink raw reply	[flat|nested] 206+ messages in thread

* [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts
  2012-02-15  1:21                   ` Junio C Hamano
@ 2012-02-15 11:03                     ` Zbigniew Jędrzejewski-Szmek
  2012-02-15 11:03                       ` [PATCH 2/3 v5] diff --stat: use the full terminal width Zbigniew Jędrzejewski-Szmek
                                         ` (2 more replies)
  0 siblings, 3 replies; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-15 11:03 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

Eleven tests for various combinations of a long filename and/or big
change count and ways to specify widths for diff --stat.
---
Tests added in previous version of 'diff --stat: use full terminal width'
are extracted into a separate patch. The tests are usefull independently
of that patch anyway.

changes to tests since v4:
- seq is replaced with a while loop for windows compatibility
- grep -m 1 is replaced with grep " | "
- redirects are made portable
- piped output is split into two commands to verify that the first command
  sucessfully runs to completion

 t/t4014-format-patch.sh | 101 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 insertions(+), 0 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6797512..f6ebb51 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -894,4 +894,105 @@ test_expect_success 'format patch ignores color.ui' '
 	test_cmp expect actual
 '
 
+# 120 character name
+name=aaaaaaaaaa
+name=$name$name$name$name$name$name$name$name$name$name$name$name
+test_expect_success 'preparation' "
+	>\"$name\" &&
+	git add \"$name\" &&
+	git commit -m message &&
+	echo a >\"$name\" &&
+	git commit -m message \"$name\"
+"
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
+EOF
+test_expect_success 'format patch graph width defaults to 80 columns' '
+	git format-patch --stat --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
+EOF
+test_expect_success 'format patch --stat=width with long name' '
+	git format-patch --stat=40 --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width works with long name' '
+	git format-patch --stat-width=40 --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat=...,name-width with long name' '
+	git format-patch --stat=60,29 --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-name-width with long name' '
+	git format-patch --stat-name-width=29 --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'preparation' '
+	>abcd &&
+	git add abcd &&
+	git commit -m message &&
+	i=0 &&
+	while test $i -lt 1000; do
+		echo $i &&
+		i=$(($i + 1))
+	done >abcd &&
+	git commit -m message abcd
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch graph part width is 40 columns' '
+	git format-patch --stat --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch ignores COLUMNS' '
+	COLUMNS=200 git format-patch --stat --stdout -1 >output
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change' '
+	git format-patch --stat=40 --stdout -1 >output
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'format patch --stat-width=width with big change' '
+	git format-patch --stat-width=40 --stdout -1 >output
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
+EOF
+test_expect_success 'format patch --stat=width with big change and long name' '
+	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
+	git commit -m message &&
+	git format-patch --stat-width=60 --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
 test_done
-- 
1.7.9.5.g91d5

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 2/3 v5] diff --stat: use the full terminal width
  2012-02-15 11:03                     ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts Zbigniew Jędrzejewski-Szmek
@ 2012-02-15 11:03                       ` Zbigniew Jędrzejewski-Szmek
  2012-02-15 18:07                         ` Junio C Hamano
  2012-02-15 11:03                       ` [PATCH 3/3 v5] diff --stat: use less columns for change counts Zbigniew Jędrzejewski-Szmek
  2012-02-15 17:12                       ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big " Junio C Hamano
  2 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-15 11:03 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

Use as many columns as necessary for the filenames and up to 40
columns for the graph.

Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the filename part in stat output can be almost useless. If
the middle part between { and } is long (because the file was moved to
a completely different directory), then most of the path would be
truncated.

It makes sense to detect and use the full terminal width and display
full filenames if possible.

If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph would use the full
width, the output would look bad. Messages wrapped to about 80 columns
would be interspersed with very long +- lines. It makes sense to limit
the width of the graph part to a fixed value, even if more columns are
available. This fixed value is subjectively hard-coded to be 40
columns, which seems to work well for git.git and linux-2.6.git and
some other repositories.

If there isn't enough columns to print both the filename and the
graph, at least 5/8 of available space is devoted to filenames. On a
standard 80 column terminal, or if not connected to a terminal and
using the default of 80 columns, this gives the same partition as
before.

The --stat output in tests is not affected.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
This is the main patch. Presented with the two options (either
hardcode number_width=4 or remove fprintf(options->file, "
%*"PRIuMAX"%s", number_width, ...)), I've taken the middle way:
number_width=4 is hardcoded, but the fprintf is reverted to the previous
version. I think that this way the code is most readable, independently
if later changes.

Junio suggested to:
 - contain a change to the test suite somewhere, probably t/test-lib.sh,
   to set COLUMNS=80 and export it, to make sure that the existing test
   won't be broken when the number of columns learned from ioctl(1) is
   different from 80; and

 - add a new test that explicitly sets wider COLUMNS and makes sure you
   get a wider diffstat graph.

I haven't done this, because $COLUMNS and the actual terminal width is always
ignored in tests. There's even a test to verify that COLUMNS=200 doesn't
mess up git format-patch output.

A test to check that diff --stat responds to terminal size would be
nice, but I don't know how to force git-diff to use the real terminal
size in tests.

v5:
- tests are moved to an earlier patch
- using decimal_width(change count) is moved to a later patch
- "histogram" is really not used

v4:
- comments are updated and the word "histogram" is banished
- "mopping up" is removed (but the minimum width are guaranteed)

v3:
- use decimal_width(max_change) to calculate number of columns
  required for change counts
- rework the logic to divide columns
- document the logic in comments, update docs
- add more tests

v2:
- style fixes
- some tests for git-format-patch added
- patches 3 and 4 squashed together, since they touch the same lines
- graph width is limited to 40 columns, even if there's more space
- patch descriptions extended and cleared up


 Documentation/diff-options.txt | 14 ++++---
 diff.c                         | 88 +++++++++++++++++++++++++++------------
 2 files changed, 69 insertions(+), 33 deletions(-)

diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9f7cba2..36e4ee3 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -53,13 +53,15 @@ endif::git-format-patch[]
 	Generate a diff using the "patience diff" algorithm.
 
 --stat[=<width>[,<name-width>[,<count>]]]::
-	Generate a diffstat.  You can override the default
-	output width for 80-column terminal by `--stat=<width>`.
-	The width of the filename part can be controlled by
-	giving another width to it separated by a comma.
+	Generate a diffstat. By default, as much space as necessary
+	will be used for the filename part, and up to 40 columns for
+	the graph part. Maximum width defaults to terminal width,
+	or 80 columns if not connected to a terminal, and can be
+	overriden by `<width>`. The width of the filename part can be
+	limited by giving another width `<name-width>` after a comma.
 	By giving a third parameter `<count>`, you can limit the
-	output to the first `<count>` lines, followed by
-	`...` if there are more.
+	output to the first `<count>` lines, followed by `...` if
+	there are more.
 +
 These parameters can also be set individually with `--stat-width=<width>`,
 `--stat-name-width=<name-width>` and `--stat-count=<count>`.
diff --git a/diff.c b/diff.c
index 7e15426..be6d40b 100644
--- a/diff.c
+++ b/diff.c
@@ -1327,7 +1327,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
 	int total_files = data->nr;
-	int width, name_width, count;
+	int width, name_width, graph_width, number_width = 4, count;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1341,25 +1341,15 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		line_prefix = msg->buf;
 	}
 
-	width = options->stat_width ? options->stat_width : 80;
-	name_width = options->stat_name_width ? options->stat_name_width : 50;
 	count = options->stat_count ? options->stat_count : data->nr;
 
-	/* Sanity: give at least 5 columns to the graph,
-	 * but leave at least 10 columns for the name.
-	 */
-	if (width < 25)
-		width = 25;
-	if (name_width < 10)
-		name_width = 10;
-	else if (width < name_width + 15)
-		name_width = width - 15;
-
-	/* Find the longest filename and max number of changes */
 	reset = diff_get_color_opt(options, DIFF_RESET);
 	add_c = diff_get_color_opt(options, DIFF_FILE_NEW);
 	del_c = diff_get_color_opt(options, DIFF_FILE_OLD);
 
+	/*
+	 * Find the longest filename and max number of changes
+	 */
 	for (i = 0; (i < count) && (i < data->nr); i++) {
 		struct diffstat_file *file = data->files[i];
 		uintmax_t change = file->added + file->deleted;
@@ -1380,19 +1370,63 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	}
 	count = i; /* min(count, data->nr) */
 
-	/* Compute the width of the graph part;
-	 * 10 is for one blank at the beginning of the line plus
-	 * " | count " between the name and the graph.
+	/*
+	 * We have width = stat_width or term_columns() columns total.
+	 * We want a maximum of min(max_len, stat_name_width) for the name part.
+	 * We want a maximum of min(max_change, 40) for the +- part.
+	 * We also need 1 for " " and 4 + decimal_width(max_change)
+	 * for " | NNNN " and one the empty column at the end, altogether
+	 * 6 + decimal_width(max_change).
+	 *
+	 * If there's not enough space, we will use the smaller of
+	 * stat_name_width (if set) and 5/8*width for the filename,
+	 * and the rest for constant elements + graph part, but no more
+	 * than 40 for the graph part.
+	 * (5/8 gives 50 for filename and 30 for the constant parts + graph
+	 * for the standard terminal size).
 	 *
-	 * From here on, name_width is the width of the name area,
-	 * and width is the width of the graph area.
+	 * In other words: stat_width limits the maximum width, and
+	 * stat_name_width fixes the maximum width of the filename,
+	 * and is also used to divide available columns if there
+	 * aren't enough.
 	 */
-	name_width = (name_width < max_len) ? name_width : max_len;
-	if (width < (name_width + 10) + max_change)
-		width = width - (name_width + 10);
-	else
-		width = max_change;
 
+	width = options->stat_width ? options->stat_width : term_columns();
+
+	/*
+	 * Guarantee 3/8*16==6 for the graph part
+	 * and 5/8*16==10 for the filename part
+	 */
+	if (width < 16 + 6 + number_width)
+		width = 16 + 6 + number_width;
+
+	/*
+	 * First assign sizes that are wanted, ignoring available width.
+	 */
+	graph_width = max_change < 40 ? max_change : 40;
+	name_width = (options->stat_name_width > 0 &&
+		      options->stat_name_width < max_len) ?
+		options->stat_name_width : max_len;
+
+	/*
+	 * Adjust adjustable widths not to exceed maximum width
+	 */
+	if (name_width + number_width + 6 + graph_width > width) {
+		if (graph_width > width * 3/8 - number_width - 6)
+			graph_width = width * 3/8 - number_width - 6;
+		if (graph_width > 40)
+			graph_width =  40;
+		if (name_width > width - number_width - 6 - graph_width)
+			name_width = width - number_width - 6 - graph_width;
+		else
+			graph_width = width - number_width - 6 - name_width;
+	}
+
+	/*
+	 * From here name_width is the width of the name area,
+	 * and graph_width is the width of the graph area.
+	 * max_change is used to scale graph properly.
+	 */
 	for (i = 0; i < count; i++) {
 		const char *prefix = "";
 		char *name = data->files[i]->print_name;
@@ -1448,9 +1482,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		adds += add;
 		dels += del;
 
-		if (width <= max_change) {
-			add = scale_linear(add, width, max_change);
-			del = scale_linear(del, width, max_change);
+		if (graph_width <= max_change) {
+			add = scale_linear(add, graph_width, max_change);
+			del = scale_linear(del, graph_width, max_change);
 		}
 		fprintf(options->file, "%s", line_prefix);
 		show_name(options->file, prefix, name, len);
-- 
1.7.9.5.g91d5

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* [PATCH 3/3 v5] diff --stat: use less columns for change counts
  2012-02-15 11:03                     ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts Zbigniew Jędrzejewski-Szmek
  2012-02-15 11:03                       ` [PATCH 2/3 v5] diff --stat: use the full terminal width Zbigniew Jędrzejewski-Szmek
@ 2012-02-15 11:03                       ` Zbigniew Jędrzejewski-Szmek
  2012-02-15 12:12                         ` Nguyen Thai Ngoc Duy
  2012-02-15 17:12                       ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big " Junio C Hamano
  2 siblings, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-15 11:03 UTC (permalink / raw)
  To: git, gitster; +Cc: Michael J Gruber, pclouds, Zbigniew Jędrzejewski-Szmek

Number of columns required for change counts is computed based on the
maximum number of changed lines. This means that usually a few more
columns will be available for the filenames and the graph.

The graph width logic is also modified to include enough space for
"Bin XXX -> YYY bytes".

If changes to binary files are mixed with changes to text files,
change counts are padded to take at least three columns. And the other
way around, if change counts require more than three columns, then
"Bin"s are padded to align with the change count. This way, the +-
part starts in the same column as "XXX -> YYY" part for binary files.
This makes the graph easier to parse visually thanks to the empty
column. This mimics the layout of diff --stat before this change.

Tests and the tutorial are updated to reflect the new --stat output.
One test for the graph alignment with a binary file change and text
file change of more than 999 lines is added.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
---
This is the small patch which causes big changes in output.
In previous version this was part of patch 1 (use the full terminal
width) and whole of patches 2 (better aligment for binary files) and 3
(update diff --stat output).

 Documentation/gitcore-tutorial.txt                 |  4 +-
 diff.c                                             | 44 ++++++++++++++---
 t/t0023-crlf-am.sh                                 |  2 +-
 t/t1200-tutorial.sh                                |  4 +-
 t/t3404-rebase-interactive.sh                      |  2 +-
 t/t3903-stash.sh                                   |  4 +-
 t/t4012-diff-binary.sh                             | 19 ++++++++
 ...ff-tree_--cc_--patch-with-stat_--summary_master |  4 +-
 ...diff-tree_--cc_--patch-with-stat_--summary_side |  6 +-
 .../diff.diff-tree_--cc_--patch-with-stat_master   |  4 +-
 .../diff.diff-tree_--cc_--stat_--summary_master    |  4 +-
 t/t4013/diff.diff-tree_--cc_--stat_--summary_side  |  6 +-
 t/t4013/diff.diff-tree_--cc_--stat_master          |  4 +-
 ...pretty=oneline_--root_--patch-with-stat_initial |  6 +-
 .../diff.diff-tree_--pretty_--patch-with-stat_side |  6 +-
 ...-tree_--pretty_--root_--patch-with-stat_initial |  6 +-
 ...f-tree_--pretty_--root_--stat_--summary_initial |  6 +-
 .../diff.diff-tree_--pretty_--root_--stat_initial  |  6 +-
 ...diff.diff-tree_--root_--patch-with-stat_initial |  6 +-
 t/t4013/diff.diff-tree_-c_--stat_--summary_master  |  4 +-
 t/t4013/diff.diff-tree_-c_--stat_--summary_side    |  6 +-
 t/t4013/diff.diff-tree_-c_--stat_master            |  4 +-
 .../diff.diff_--patch-with-stat_-r_initial..side   |  6 +-
 t/t4013/diff.diff_--patch-with-stat_initial..side  |  6 +-
 t/t4013/diff.diff_--stat_initial..side             |  6 +-
 t/t4013/diff.diff_-r_--stat_initial..side          |  6 +-
 ..._--attach_--stdout_--suffix=.diff_initial..side |  6 +-
 ....format-patch_--attach_--stdout_initial..master | 16 +++---
 ...format-patch_--attach_--stdout_initial..master^ | 10 ++--
 ...ff.format-patch_--attach_--stdout_initial..side |  6 +-
 ...nline_--stdout_--numbered-files_initial..master | 16 +++---
 ...tdout_--subject-prefix=TESTCASE_initial..master | 16 +++---
 ....format-patch_--inline_--stdout_initial..master | 16 +++---
 ...format-patch_--inline_--stdout_initial..master^ | 10 ++--
 ...ormat-patch_--inline_--stdout_initial..master^^ |  6 +-
 ...ff.format-patch_--inline_--stdout_initial..side |  6 +-
 ...tch_--stdout_--cover-letter_-n_initial..master^ | 18 ++++----
 ...at-patch_--stdout_--no-numbered_initial..master | 16 +++---
 ...ormat-patch_--stdout_--numbered_initial..master | 16 +++---
 t/t4013/diff.format-patch_--stdout_initial..master | 16 +++---
 .../diff.format-patch_--stdout_initial..master^    | 10 ++--
 t/t4013/diff.format-patch_--stdout_initial..side   |  6 +-
 ....log_--patch-with-stat_--summary_master_--_dir_ |  6 +-
 t/t4013/diff.log_--patch-with-stat_master          | 16 +++---
 t/t4013/diff.log_--patch-with-stat_master_--_dir_  |  6 +-
 ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++-----
 ...f.log_--root_--patch-with-stat_--summary_master | 22 ++++----
 t/t4013/diff.log_--root_--patch-with-stat_master   | 22 ++++----
 ...og_--root_-c_--patch-with-stat_--summary_master | 26 +++++-----
 t/t4013/diff.show_--patch-with-stat_--summary_side |  6 +-
 t/t4013/diff.show_--patch-with-stat_side           |  6 +-
 t/t4013/diff.show_--stat_--summary_side            |  6 +-
 t/t4013/diff.show_--stat_side                      |  6 +-
 ...nged_--patch-with-stat_--summary_master_--_dir_ |  6 +-
 t/t4013/diff.whatchanged_--patch-with-stat_master  | 16 +++---
 ...ff.whatchanged_--patch-with-stat_master_--_dir_ |  6 +-
 ..._--root_--cc_--patch-with-stat_--summary_master | 26 +++++-----
 ...anged_--root_--patch-with-stat_--summary_master | 22 ++++----
 ...iff.whatchanged_--root_--patch-with-stat_master | 22 ++++----
 ...ed_--root_-c_--patch-with-stat_--summary_master | 26 +++++-----
 t/t4014-format-patch.sh                            | 10 ++--
 t/t4016-diff-quote.sh                              | 14 +++---
 t/t4030-diff-textconv.sh                           |  2 +-
 t/t4043-diff-rename-binary.sh                      |  4 +-
 t/t4045-diff-relative.sh                           |  2 +-
 t/t4047-diff-dirstat.sh                            | 54 +++++++++++-----------
 t/t4049-diff-stat-count.sh                         |  4 +-
 t/t5100/patch0001                                  |  2 +-
 t/t5100/patch0002                                  |  2 +-
 t/t5100/patch0003                                  |  2 +-
 t/t5100/patch0005                                  |  4 +-
 t/t5100/patch0006                                  |  2 +-
 t/t5100/patch0010                                  |  2 +-
 t/t5100/patch0011                                  |  2 +-
 t/t5100/patch0014                                  |  2 +-
 t/t5100/patch0014--scissors                        |  2 +-
 t/t5100/sample.mbox                                | 18 ++++----
 t/t7602-merge-octopus-many.sh                      | 12 ++--
 78 files changed, 415 insertions(+), 368 deletions(-)

diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt
index c27d086..b781bbf 100644
--- a/Documentation/gitcore-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -1002,8 +1002,8 @@ would be different)
 ----------------
 Updating from ae3a2da... to a80b4aa....
 Fast-forward (no commit created; -m option ignored)
- example |    1 +
- hello   |    1 +
+ example | 1 +
+ hello   | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
 ----------------
 
diff --git a/diff.c b/diff.c
index be6d40b..dd72d35 100644
--- a/diff.c
+++ b/diff.c
@@ -1326,8 +1326,8 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 {
 	int i, len, add, del, adds = 0, dels = 0;
 	uintmax_t max_change = 0, max_len = 0;
-	int total_files = data->nr;
-	int width, name_width, graph_width, number_width = 4, count;
+	int total_files = data->nr, count;
+	int width, name_width, graph_width, number_width = 0, bin_width = 0;
 	const char *reset, *add_c, *del_c;
 	const char *line_prefix = "";
 	int extra_shown = 0;
@@ -1363,8 +1363,21 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		if (max_len < len)
 			max_len = len;
 
-		if (file->is_binary || file->is_unmerged)
+		if (file->is_unmerged) {
+			/* "Unmerged" is 8 characters */
+			bin_width = bin_width < 8 ? 8 : bin_width;
 			continue;
+		}
+		if (file->is_binary) {
+			/* "Bin XXX -> YYY bytes" */
+			int w = 14 + decimal_width(file->added)
+				+ decimal_width(file->deleted);
+			bin_width = bin_width < w ? w : bin_width;
+			/* Display change counts aligned with "Bin" */
+			number_width = 3;
+			continue;
+		}
+
 		if (max_change < change)
 			max_change = change;
 	}
@@ -1389,9 +1402,19 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	 * stat_name_width fixes the maximum width of the filename,
 	 * and is also used to divide available columns if there
 	 * aren't enough.
+	 *
+	 * Binary files are displayed with "Bin XXX -> YYY bytes"
+	 * instead of the change count and graph. This part is treated
+	 * similarly to the graph part, except that it is not
+	 * "scaled". If total width is too small to accomodate the
+	 * guaranteed minimum width of the filename part and the
+	 * separators and this message, this message will "overflow"
+	 * making the line longer than the maximum width.
 	 */
 
 	width = options->stat_width ? options->stat_width : term_columns();
+	number_width = decimal_width(max_change) > number_width ?
+		decimal_width(max_change) : number_width;
 
 	/*
 	 * Guarantee 3/8*16==6 for the graph part
@@ -1402,8 +1425,12 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 
 	/*
 	 * First assign sizes that are wanted, ignoring available width.
+	 * strlen("Bin XXX -> YYY bytes") == bin_width, and the part
+	 * starting from "XXX" should fit in graph_width.
 	 */
-	graph_width = max_change < 40 ? max_change : 40;
+	graph_width = max_change + 4 > bin_width ? max_change : bin_width - 4;
+	if (graph_width > 40)
+		graph_width = 40;
 	name_width = (options->stat_name_width > 0 &&
 		      options->stat_name_width < max_len) ?
 		options->stat_name_width : max_len;
@@ -1457,7 +1484,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		if (data->files[i]->is_binary) {
 			fprintf(options->file, "%s", line_prefix);
 			show_name(options->file, prefix, name, len);
-			fprintf(options->file, "  Bin ");
+			fprintf(options->file, " %*s ", number_width, "Bin");
 			fprintf(options->file, "%s%"PRIuMAX"%s",
 				del_c, deleted, reset);
 			fprintf(options->file, " -> ");
@@ -1470,7 +1497,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		else if (data->files[i]->is_unmerged) {
 			fprintf(options->file, "%s", line_prefix);
 			show_name(options->file, prefix, name, len);
-			fprintf(options->file, "  Unmerged\n");
+			fprintf(options->file, " Unmerged\n");
 			continue;
 		}
 
@@ -1488,8 +1515,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 		}
 		fprintf(options->file, "%s", line_prefix);
 		show_name(options->file, prefix, name, len);
-		fprintf(options->file, "%5"PRIuMAX"%s", added + deleted,
-				added + deleted ? " " : "");
+		fprintf(options->file, " %*"PRIuMAX"%s",
+			number_width, added + deleted,
+			added + deleted ? " " : "");
 		show_graph(options->file, '+', add, add_c, reset);
 		show_graph(options->file, '-', del, del_c, reset);
 		fprintf(options->file, "\n");
diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh
index aaed725..f9bbb91 100755
--- a/t/t0023-crlf-am.sh
+++ b/t/t0023-crlf-am.sh
@@ -11,7 +11,7 @@ Date: Thu, 23 Aug 2007 13:00:00 +0200
 Subject: test1
 
 ---
- foo |    1 +
+ foo | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 foo
 
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 5e29e13..77ff21c 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -154,8 +154,8 @@ test_expect_success 'git show-branch' '
 cat > resolve.expect << EOF
 Updating VARIABLE..VARIABLE
 FASTFORWARD (no commit created; -m option ignored)
- example |    1 +
- hello   |    1 +
+ example | 1 +
+ hello   | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
 EOF
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b981572..c8fe1a9 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -323,7 +323,7 @@ test_expect_success 'verbose flag is heeded, even after --continue' '
 	echo resolved > file1 &&
 	git add file1 &&
 	git rebase --continue > output &&
-	grep "^ file1 |    2 +-$" output
+	grep "^ file1 | 2 +-$" output
 '
 
 test_expect_success 'multi-squash only fires up editor once' '
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index dbe2ac1..fbf064e 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -443,7 +443,7 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	cat >expected <<-EOF &&
-	 file |    1 +
+	 file | 1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
 	git stash show ${STASH_ID} >actual &&
@@ -481,7 +481,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '
 	STASH_ID=$(git stash create) &&
 	git reset --hard &&
 	cat >expected <<-EOF &&
-	 file |    1 +
+	 file | 1 +
 	 1 files changed, 1 insertions(+), 0 deletions(-)
 	EOF
 	git stash show ${STASH_ID} >actual &&
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index 2d9f9a0..9dd48bb 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -90,4 +90,23 @@ test_expect_success 'diff --no-index with binary creation' '
 	test_cmp expected actual
 '
 
+cat >expect <<EOF
+ binfile  |   Bin 0 -> 1026 bytes
+ textfile | 10000 ++++++++++++++++++++++++++++++++++++++++
+EOF
+
+test_expect_success 'diff --stat with binary files and big change count' '
+	echo X | dd of=binfile bs=1k seek=1 &&
+	git add binfile &&
+	i=0 &&
+	while test $i -lt 10000; do
+		echo $i &&
+		i=$(($i + 1))
+	done >textfile &&
+	git add textfile &&
+	git diff --cached --stat binfile textfile >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
+
 test_done
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
index 3a9f78a..b87f758 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_master
@@ -1,7 +1,7 @@
 $ git diff-tree --cc --patch-with-stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
index a61ad8c..47665f9 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree --cc --patch-with-stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
index 49f23b9..efe6dcc 100644
--- a/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
+++ b/t/t4013/diff.diff-tree_--cc_--patch-with-stat_master
@@ -1,7 +1,7 @@
 $ git diff-tree --cc --patch-with-stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
index cc6eb3b..1b465f0 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_master
@@ -1,6 +1,6 @@
 $ git diff-tree --cc --stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
index 50362be..44fcf4e 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
+++ b/t/t4013/diff.diff-tree_--cc_--stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree --cc --stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.diff-tree_--cc_--stat_master b/t/t4013/diff.diff-tree_--cc_--stat_master
index fae7f33..6dffb7f 100644
--- a/t/t4013/diff.diff-tree_--cc_--stat_master
+++ b/t/t4013/diff.diff-tree_--cc_--stat_master
@@ -1,6 +1,6 @@
 $ git diff-tree --cc --stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
index d5c333a..a7d91c9 100644
--- a/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty=oneline_--root_--patch-with-stat_initial
@@ -1,8 +1,8 @@
 $ git diff-tree --pretty=oneline --root --patch-with-stat initial
 444ac553ac7612cc88969031b02b3767fb8a353a Initial
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
index 4d30e7e..2061f37 100644
--- a/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
+++ b/t/t4013/diff.diff-tree_--pretty_--patch-with-stat_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
index 7dfa6af..71d912e 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-stat_initial
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
index 43bfce2..b80dbcc 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
index 9154aa4..88cb5c9 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--stat_initial
@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
index 1562b62..748ba93 100644
--- a/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
+++ b/t/t4013/diff.diff-tree_--root_--patch-with-stat_initial
@@ -1,8 +1,8 @@
 $ git diff-tree --root --patch-with-stat initial
 444ac553ac7612cc88969031b02b3767fb8a353a
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_master b/t/t4013/diff.diff-tree_-c_--stat_--summary_master
index ac9f641..700c386 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_master
+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_master
@@ -1,6 +1,6 @@
 $ git diff-tree -c --stat --summary master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff-tree_-c_--stat_--summary_side b/t/t4013/diff.diff-tree_-c_--stat_--summary_side
index 2afcca1..520aa4f 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_--summary_side
+++ b/t/t4013/diff.diff-tree_-c_--stat_--summary_side
@@ -1,8 +1,8 @@
 $ git diff-tree -c --stat --summary side
 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.diff-tree_-c_--stat_master b/t/t4013/diff.diff-tree_-c_--stat_master
index c2fe6a9..cdc7c40 100644
--- a/t/t4013/diff.diff-tree_-c_--stat_master
+++ b/t/t4013/diff.diff-tree_-c_--stat_master
@@ -1,6 +1,6 @@
 $ git diff-tree -c --stat master
 59d314ad6f356dd08601a4cd5e530381da3e3c64
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
index 9ed317a..abf43a9 100644
--- a/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
+++ b/t/t4013/diff.diff_--patch-with-stat_-r_initial..side
@@ -1,7 +1,7 @@
 $ git diff --patch-with-stat -r initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff_--patch-with-stat_initial..side b/t/t4013/diff.diff_--patch-with-stat_initial..side
index 8b50629..f88262e 100644
--- a/t/t4013/diff.diff_--patch-with-stat_initial..side
+++ b/t/t4013/diff.diff_--patch-with-stat_initial..side
@@ -1,7 +1,7 @@
 $ git diff --patch-with-stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.diff_--stat_initial..side b/t/t4013/diff.diff_--stat_initial..side
index 0517b5d..17a07be 100644
--- a/t/t4013/diff.diff_--stat_initial..side
+++ b/t/t4013/diff.diff_--stat_initial..side
@@ -1,6 +1,6 @@
 $ git diff --stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.diff_-r_--stat_initial..side b/t/t4013/diff.diff_-r_--stat_initial..side
index 245220d..54507eb 100644
--- a/t/t4013/diff.diff_-r_--stat_initial..side
+++ b/t/t4013/diff.diff_-r_--stat_initial..side
@@ -1,6 +1,6 @@
 $ git diff -r --stat initial..side
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
index 52116d3..6996877 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
+++ b/t/t4013/diff.format-patch_--attach_--stdout_--suffix=.diff_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
index ce49bd6..d56a1a3 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
index 5f1b238..b76e61f 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
index 4a2364a..769cf32 100644
--- a/t/t4013/diff.format-patch_--attach_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
index 43b81eb..0ee7338 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_--numbered-files_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
index ca3f60b..fbf3bd4 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_initial..master
index 08f2301..d68e3ee 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -121,9 +121,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
index 07f1230..668e38f 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
index 29e00ab..caec553 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^
@@ -14,9 +14,9 @@ Content-Transfer-Encoding: 8bit
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..side b/t/t4013/diff.format-patch_--inline_--stdout_initial..side
index 67633d4..6b84b1b 100644
--- a/t/t4013/diff.format-patch_--inline_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..side
@@ -12,9 +12,9 @@ Content-Type: text/plain; charset=UTF-8; format=fixed
 Content-Transfer-Encoding: 8bit
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
index 3b4e113..d8cba57 100644
--- a/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_--cover-letter_-n_initial..master^
@@ -10,10 +10,10 @@ A U Thor (2):
   Second
   Third
 
- dir/sub |    4 ++++
- file0   |    3 +++
- file1   |    3 +++
- file2   |    3 ---
+ dir/sub | 4 ++++
+ file0   | 3 +++
+ file1   | 3 +++
+ file2   | 3 ---
  4 files changed, 10 insertions(+), 3 deletions(-)
  create mode 100644 file1
  delete mode 100644 file2
@@ -28,9 +28,9 @@ Subject: [DIFFERENT_PREFIX 1/2] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -73,8 +73,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [DIFFERENT_PREFIX 2/2] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
index f7752eb..a2a4726 100644
--- a/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_--no-numbered_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
index 8e67dbf..602f4b0 100644
--- a/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_--numbered_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/3] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH 3/3] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master b/t/t4013/diff.format-patch_--stdout_initial..master
index 7b89978..bcf739e 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master
+++ b/t/t4013/diff.format-patch_--stdout_initial..master
@@ -6,9 +6,9 @@ Subject: [PATCH 1/3] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/3] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -85,9 +85,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH 3/3] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..master^ b/t/t4013/diff.format-patch_--stdout_initial..master^
index b7f9725..7d5ba0f 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..master^
+++ b/t/t4013/diff.format-patch_--stdout_initial..master^
@@ -6,9 +6,9 @@ Subject: [PATCH 1/2] Second
 
 This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -51,8 +51,8 @@ Date: Mon, 26 Jun 2006 00:02:00 +0000
 Subject: [PATCH 2/2] Third
 
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
diff --git a/t/t4013/diff.format-patch_--stdout_initial..side b/t/t4013/diff.format-patch_--stdout_initial..side
index e765088..9ed0ea2 100644
--- a/t/t4013/diff.format-patch_--stdout_initial..side
+++ b/t/t4013/diff.format-patch_--stdout_initial..side
@@ -5,9 +5,9 @@ Date: Mon, 26 Jun 2006 00:03:00 +0000
 Subject: [PATCH] Side
 
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
index bd7f5c0..e2954d3 100644
--- a/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
+++ b/t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--patch-with-stat_master b/t/t4013/diff.log_--patch-with-stat_master
index 14595a6..e417873 100644
--- a/t/t4013/diff.log_--patch-with-stat_master
+++ b/t/t4013/diff.log_--patch-with-stat_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--patch-with-stat_master_--_dir_ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_
index 5a4e727..cebec52 100644
--- a/t/t4013/diff.log_--patch-with-stat_master_--_dir_
+++ b/t/t4013/diff.log_--patch-with-stat_master_--_dir_
@@ -12,7 +12,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -31,7 +31,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -53,7 +53,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
index df0aaa9..540633f 100644
--- a/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_--cc_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
index c11b5f2c..fb289d8 100644
--- a/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_--patch-with-stat_--summary_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -55,8 +55,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -88,9 +88,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -130,9 +130,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.log_--root_--patch-with-stat_master b/t/t4013/diff.log_--root_--patch-with-stat_master
index 5f0c98f..84f535d 100644
--- a/t/t4013/diff.log_--root_--patch-with-stat_master
+++ b/t/t4013/diff.log_--root_--patch-with-stat_master
@@ -12,9 +12,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -54,8 +54,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -86,9 +86,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -127,9 +127,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
index e62c368..3e89ace 100644
--- a/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.log_--root_-c_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --combined dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.show_--patch-with-stat_--summary_side b/t/t4013/diff.show_--patch-with-stat_--summary_side
index 377f2b7..38c1841 100644
--- a/t/t4013/diff.show_--patch-with-stat_--summary_side
+++ b/t/t4013/diff.show_--patch-with-stat_--summary_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
diff --git a/t/t4013/diff.show_--patch-with-stat_side b/t/t4013/diff.show_--patch-with-stat_side
index fb14c53..38f6be2 100644
--- a/t/t4013/diff.show_--patch-with-stat_side
+++ b/t/t4013/diff.show_--patch-with-stat_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.show_--stat_--summary_side b/t/t4013/diff.show_--stat_--summary_side
index 5bd5977..e6f30a4 100644
--- a/t/t4013/diff.show_--stat_--summary_side
+++ b/t/t4013/diff.show_--stat_--summary_side
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 $
diff --git a/t/t4013/diff.show_--stat_side b/t/t4013/diff.show_--stat_side
index 3b22327..58ee49a 100644
--- a/t/t4013/diff.show_--stat_side
+++ b/t/t4013/diff.show_--stat_side
@@ -5,8 +5,8 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 $
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
index 6a467cc..ee340b8 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_--summary_master_--_dir_
@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master b/t/t4013/diff.whatchanged_--patch-with-stat_master
index 1e1bbe1..4adeab7 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_master
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
index 13789f1..63a3043 100644
--- a/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
+++ b/t/t4013/diff.whatchanged_--patch-with-stat_master_--_dir_
@@ -5,7 +5,7 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -24,7 +24,7 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -46,7 +46,7 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
+ dir/sub | 2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
index e96ff1f..60f3788 100644
--- a/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_--cc_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --cc dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
index 0291153..9b7f63f 100644
--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_--summary_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -48,8 +48,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -81,9 +81,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -123,9 +123,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
index 9b0349c..cba8f3c 100644
--- a/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
+++ b/t/t4013/diff.whatchanged_--root_--patch-with-stat_master
@@ -5,9 +5,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -47,8 +47,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -79,9 +79,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/dir/sub b/dir/sub
diff --git a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
index c0aff68..8e24293 100644
--- a/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
+++ b/t/t4013/diff.whatchanged_--root_-c_--patch-with-stat_--summary_master
@@ -6,8 +6,8 @@ Date:   Mon Jun 26 00:04:00 2006 +0000
 
     Merge branch 'side'
 
- dir/sub |    2 ++
- file0   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
 
 diff --combined dir/sub
@@ -44,9 +44,9 @@ Date:   Mon Jun 26 00:03:00 2006 +0000
 
     Side
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file3   |    4 ++++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file3   | 4 ++++
  3 files changed, 9 insertions(+), 0 deletions(-)
  create mode 100644 file3
 
@@ -87,8 +87,8 @@ Date:   Mon Jun 26 00:02:00 2006 +0000
 
     Third
 ---
- dir/sub |    2 ++
- file1   |    3 +++
+ dir/sub | 2 ++
+ file1   | 3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)
  create mode 100644 file1
 
@@ -120,9 +120,9 @@ Date:   Mon Jun 26 00:01:00 2006 +0000
     
     This is the second commit.
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 ---
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 ---
  3 files changed, 5 insertions(+), 3 deletions(-)
  delete mode 100644 file2
 
@@ -162,9 +162,9 @@ Date:   Mon Jun 26 00:00:00 2006 +0000
 
     Initial
 ---
- dir/sub |    2 ++
- file0   |    3 +++
- file2   |    3 +++
+ dir/sub | 2 ++
+ file0   | 3 +++
+ file2   | 3 +++
  3 files changed, 8 insertions(+), 0 deletions(-)
  create mode 100644 dir/sub
  create mode 100644 file0
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index f6ebb51..bb430ac 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -519,7 +519,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
 
 cat > expect << EOF
 ---
- file |   16 ++++++++++++++++
+ file | 16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)
 
 diff --git a/file b/file
@@ -906,7 +906,7 @@ test_expect_success 'preparation' "
 "
 
 cat >expect <<'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
 EOF
 test_expect_success 'format patch graph width defaults to 80 columns' '
 	git format-patch --stat --stdout -1 >output &&
@@ -915,7 +915,7 @@ test_expect_success 'format patch graph width defaults to 80 columns' '
 '
 
 cat >expect <<'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 +
 EOF
 test_expect_success 'format patch --stat=width with long name' '
 	git format-patch --stat=40 --stdout -1 >output &&
@@ -930,13 +930,13 @@ test_expect_success 'format patch --stat-width=width works with long name' '
 '
 
 test_expect_success 'format patch --stat=...,name-width with long name' '
-	git format-patch --stat=60,29 --stdout -1 >output &&
+	git format-patch --stat=60,32 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
 '
 
 test_expect_success 'format patch --stat-name-width with long name' '
-	git format-patch --stat-name-width=29 --stdout -1 >output &&
+	git format-patch --stat-name-width=32 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index ab0c2f0..e451f2a 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -59,13 +59,13 @@ test_expect_success TABS_IN_FILENAMES 'git diff --summary -M HEAD' '
 
 test_expect_success TABS_IN_FILENAMES 'setup expected files' '
 cat >expect <<\EOF
- pathname.1 => "Rpathname\twith HT.0"            |    0
- pathname.3 => "Rpathname\nwith LF.0"            |    0
- "pathname\twith HT.3" => "Rpathname\nwith LF.1" |    0
- pathname.2 => Rpathname with SP.0               |    0
- "pathname\twith HT.2" => Rpathname with SP.1    |    0
- pathname.0 => Rpathname.0                       |    0
- "pathname\twith HT.0" => Rpathname.1            |    0
+ pathname.1 => "Rpathname\twith HT.0"            | 0
+ pathname.3 => "Rpathname\nwith LF.0"            | 0
+ "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0
+ pathname.2 => Rpathname with SP.0               | 0
+ "pathname\twith HT.2" => Rpathname with SP.1    | 0
+ pathname.0 => Rpathname.0                       | 0
+ "pathname\twith HT.0" => Rpathname.1            | 0
  7 files changed, 0 insertions(+), 0 deletions(-)
 EOF
 '
diff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh
index 88c5619..6a6344c 100755
--- a/t/t4030-diff-textconv.sh
+++ b/t/t4030-diff-textconv.sh
@@ -85,7 +85,7 @@ test_expect_success 'status -v produces text' '
 '
 
 cat >expect.stat <<'EOF'
- file |  Bin 2 -> 4 bytes
+ file | Bin 2 -> 4 bytes
  1 files changed, 0 insertions(+), 0 deletions(-)
 EOF
 test_expect_success 'diffstat does not run textconv' '
diff --git a/t/t4043-diff-rename-binary.sh b/t/t4043-diff-rename-binary.sh
index 0601281..ad0b2da 100755
--- a/t/t4043-diff-rename-binary.sh
+++ b/t/t4043-diff-rename-binary.sh
@@ -23,8 +23,8 @@ test_expect_success 'move the files into a "sub" directory' '
 '
 
 cat > expected <<\EOF
- bar => sub/bar |  Bin 5 -> 5 bytes
- foo => sub/foo |    0
+ bar => sub/bar | Bin 5 -> 5 bytes
+ foo => sub/foo |   0
  2 files changed, 0 insertions(+), 0 deletions(-)
 
 diff --git a/bar b/sub/bar
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 8a3c63b..336df82 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -32,7 +32,7 @@ test_expect_success "-p $*" "
 check_stat() {
 expect=$1; shift
 cat >expected <<EOF
- $expect |    1 +
+ $expect | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 EOF
 test_expect_success "--stat $*" "
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index 29e80a5..75eaf16 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -252,41 +252,41 @@ EOF
 '
 
 cat <<EOF >expect_diff_stat
- changed/text             |    2 +-
- dst/copy/changed/text    |   10 ++++++++++
- dst/copy/rearranged/text |   10 ++++++++++
- dst/copy/unchanged/text  |   10 ++++++++++
- dst/move/changed/text    |   10 ++++++++++
- dst/move/rearranged/text |   10 ++++++++++
- dst/move/unchanged/text  |   10 ++++++++++
- rearranged/text          |    2 +-
- src/move/changed/text    |   10 ----------
- src/move/rearranged/text |   10 ----------
- src/move/unchanged/text  |   10 ----------
+ changed/text             |  2 +-
+ dst/copy/changed/text    | 10 ++++++++++
+ dst/copy/rearranged/text | 10 ++++++++++
+ dst/copy/unchanged/text  | 10 ++++++++++
+ dst/move/changed/text    | 10 ++++++++++
+ dst/move/rearranged/text | 10 ++++++++++
+ dst/move/unchanged/text  | 10 ++++++++++
+ rearranged/text          |  2 +-
+ src/move/changed/text    | 10 ----------
+ src/move/rearranged/text | 10 ----------
+ src/move/unchanged/text  | 10 ----------
  11 files changed, 62 insertions(+), 32 deletions(-)
 EOF
 
 cat <<EOF >expect_diff_stat_M
- changed/text                      |    2 +-
- dst/copy/changed/text             |   10 ++++++++++
- dst/copy/rearranged/text          |   10 ++++++++++
- dst/copy/unchanged/text           |   10 ++++++++++
- {src => dst}/move/changed/text    |    2 +-
- {src => dst}/move/rearranged/text |    2 +-
- {src => dst}/move/unchanged/text  |    0
- rearranged/text                   |    2 +-
+ changed/text                      |  2 +-
+ dst/copy/changed/text             | 10 ++++++++++
+ dst/copy/rearranged/text          | 10 ++++++++++
+ dst/copy/unchanged/text           | 10 ++++++++++
+ {src => dst}/move/changed/text    |  2 +-
+ {src => dst}/move/rearranged/text |  2 +-
+ {src => dst}/move/unchanged/text  |  0
+ rearranged/text                   |  2 +-
  8 files changed, 34 insertions(+), 4 deletions(-)
 EOF
 
 cat <<EOF >expect_diff_stat_CC
- changed/text                      |    2 +-
- {src => dst}/copy/changed/text    |    2 +-
- {src => dst}/copy/rearranged/text |    2 +-
- {src => dst}/copy/unchanged/text  |    0
- {src => dst}/move/changed/text    |    2 +-
- {src => dst}/move/rearranged/text |    2 +-
- {src => dst}/move/unchanged/text  |    0
- rearranged/text                   |    2 +-
+ changed/text                      | 2 +-
+ {src => dst}/copy/changed/text    | 2 +-
+ {src => dst}/copy/rearranged/text | 2 +-
+ {src => dst}/copy/unchanged/text  | 0
+ {src => dst}/move/changed/text    | 2 +-
+ {src => dst}/move/rearranged/text | 2 +-
+ {src => dst}/move/unchanged/text  | 0
+ rearranged/text                   | 2 +-
  8 files changed, 6 insertions(+), 6 deletions(-)
 EOF
 
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index 641e70d..5edac4e 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -14,8 +14,8 @@ test_expect_success setup '
 	echo a >a &&
 	echo b >b &&
 	cat >expect <<-\EOF
-	 a |    1 +
-	 b |    1 +
+	 a | 1 +
+	 b | 1 +
 	 2 files changed, 2 insertions(+), 0 deletions(-)
 	EOF
 	git diff --stat --stat-count=2 >actual &&
diff --git a/t/t5100/patch0001 b/t/t5100/patch0001
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0001
+++ b/t/t5100/patch0001
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0002 b/t/t5100/patch0002
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0002
+++ b/t/t5100/patch0002
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0003 b/t/t5100/patch0003
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0003
+++ b/t/t5100/patch0003
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0005 b/t/t5100/patch0005
index 7d24b24..ab7a383 100644
--- a/t/t5100/patch0005
+++ b/t/t5100/patch0005
@@ -1,7 +1,7 @@
 ---
 
- Documentation/git-cvsimport-script.txt |    9 ++++++++-
- git-cvsimport-script                   |    4 ++--
+ Documentation/git-cvsimport-script.txt | 9 ++++++++-
+ git-cvsimport-script                   | 4 ++--
  2 files changed, 10 insertions(+), 3 deletions(-)
 
 50452f9c0c2df1f04d83a26266ba704b13861632
diff --git a/t/t5100/patch0006 b/t/t5100/patch0006
index 8ce1551..02c9774 100644
--- a/t/t5100/patch0006
+++ b/t/t5100/patch0006
@@ -1,5 +1,5 @@
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
diff --git a/t/t5100/patch0010 b/t/t5100/patch0010
index f055481..436821c 100644
--- a/t/t5100/patch0010
+++ b/t/t5100/patch0010
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |    2 +-
+ builtin-mailinfo.c | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/patch0011 b/t/t5100/patch0011
index 8841d3c..0988713 100644
--- a/t/t5100/patch0011
+++ b/t/t5100/patch0011
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c  |    4 ++--
+ builtin-mailinfo.c  | 4 ++--
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
 index 3e5fe51..aabfe5c 100644
diff --git a/t/t5100/patch0014 b/t/t5100/patch0014
index 124efd2..3f3825f 100644
--- a/t/t5100/patch0014
+++ b/t/t5100/patch0014
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/patch0014--scissors b/t/t5100/patch0014--scissors
index 124efd2..3f3825f 100644
--- a/t/t5100/patch0014--scissors
+++ b/t/t5100/patch0014--scissors
@@ -1,5 +1,5 @@
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox
index de10312..34a09a0 100644
--- a/t/t5100/sample.mbox
+++ b/t/t5100/sample.mbox
@@ -12,7 +12,7 @@ Subject: [PATCH] a commit.
 Here is a patch from A U Thor.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -52,7 +52,7 @@ two truly blank and another full of spaces in between.
 Hope this helps.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -83,7 +83,7 @@ Message-Id: <nitpicker.12121212@example.net>
 Hopefully this would fix the problem stated there.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -249,8 +249,8 @@ actual flags.
 Signed-off-by: David K=E5gedal <davidk@lysator.liu.se>
 ---
 
- Documentation/git-cvsimport-script.txt |    9 ++++++++-
- git-cvsimport-script                   |    4 ++--
+ Documentation/git-cvsimport-script.txt | 9 ++++++++-
+ git-cvsimport-script                   | 4 ++--
  2 files changed, 10 insertions(+), 3 deletions(-)
 
 50452f9c0c2df1f04d83a26266ba704b13861632
@@ -379,7 +379,7 @@ Subject: [PATCH] a commit.
 Here is a patch from A U Thor.
 
 ---
- foo |    2 +-
+ foo | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/foo b/foo
@@ -449,7 +449,7 @@ memcmp("Subject: ", header[i], 7) will never match.
 Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
 Signed-off-by: Junio C Hamano <gitster@pobox.com>
 ---
- builtin-mailinfo.c |    2 +-
+ builtin-mailinfo.c | 2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
@@ -482,7 +482,7 @@ Content-Transfer-Encoding: quoted-printable
 Here comes a commit log message, and
 its second line is here.
 ---
- builtin-mailinfo.c  |    4 ++--
+ builtin-mailinfo.c  | 4 ++--
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
 index 3e5fe51..aabfe5c 100644
@@ -587,7 +587,7 @@ everything before it in the message body.
 
 Signed-off-by: Junio C Hamano <gitster@pobox.com>
 ---
- builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
+ builtin-mailinfo.c | 37 ++++++++++++++++++++++++++++++++++++-
  1 files changed, 36 insertions(+), 1 deletions(-)
 
 diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 61f36ba..5a86e24 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -54,9 +54,9 @@ Trying simple merge with c2
 Trying simple merge with c3
 Trying simple merge with c4
 Merge made by the 'octopus' strategy.
- c2.c |    1 +
- c3.c |    1 +
- c4.c |    1 +
+ c2.c | 1 +
+ c3.c | 1 +
+ c4.c | 1 +
  3 files changed, 3 insertions(+), 0 deletions(-)
  create mode 100644 c2.c
  create mode 100644 c3.c
@@ -73,7 +73,7 @@ cat >expected <<\EOF
 Already up-to-date with c4
 Trying simple merge with c5
 Merge made by the 'octopus' strategy.
- c5.c |    1 +
+ c5.c | 1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 c5.c
 EOF
@@ -87,8 +87,8 @@ cat >expected <<\EOF
 Fast-forwarding to: c1
 Trying simple merge with c2
 Merge made by the 'octopus' strategy.
- c1.c |    1 +
- c2.c |    1 +
+ c1.c | 1 +
+ c2.c | 1 +
  2 files changed, 2 insertions(+), 0 deletions(-)
  create mode 100644 c1.c
  create mode 100644 c2.c
-- 
1.7.9.5.g91d5

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 3/3 v5] diff --stat: use less columns for change counts
  2012-02-15 11:03                       ` [PATCH 3/3 v5] diff --stat: use less columns for change counts Zbigniew Jędrzejewski-Szmek
@ 2012-02-15 12:12                         ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 206+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-02-15 12:12 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, gitster, Michael J Gruber

2012/2/15 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>:
> Number of columns required for change counts is computed based on the
> maximum number of changed lines. This means that usually a few more
> columns will be available for the filenames and the graph.

If the required number of columns is less than 80 (or even lower), can
we maintain current spacing strategy? I just want to avoid mass
updates in the test suite. More or less space does not make much
different for narrow diffstats anyway.
-- 
Duy

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts
  2012-02-15 11:03                     ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts Zbigniew Jędrzejewski-Szmek
  2012-02-15 11:03                       ` [PATCH 2/3 v5] diff --stat: use the full terminal width Zbigniew Jędrzejewski-Szmek
  2012-02-15 11:03                       ` [PATCH 3/3 v5] diff --stat: use less columns for change counts Zbigniew Jędrzejewski-Szmek
@ 2012-02-15 17:12                       ` Junio C Hamano
  2012-02-15 17:33                         ` Junio C Hamano
  2012-02-16  9:57                         ` Zbigniew Jędrzejewski-Szmek
  2 siblings, 2 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15 17:12 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Eleven tests for various combinations of a long filename and/or big
> change count and ways to specify widths for diff --stat.
> ---

Sign-off? 

> Tests added in previous version of 'diff --stat: use full terminal width'
> are extracted into a separate patch. The tests are usefull independently
> of that patch anyway.

Thanks.

> +# 120 character name
> +name=aaaaaaaaaa
> +name=$name$name$name$name$name$name$name$name$name$name$name$name
> +test_expect_success 'preparation' "
> +	>\"$name\" &&
> +	git add \"$name\" &&
> +	git commit -m message &&
> +	echo a >\"$name\" &&
> +	git commit -m message \"$name\"
> +"

Just for future reference.

The last parameter to test_expect_success shell function is `eval`ed by
the shell and $name is visible inside it; you do not have to use double
quote around it and then use backquote to quote the inner double quote.

> +cat >expect <<'EOF'
> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
> +EOF
> +test_expect_success 'format patch graph width defaults to 80 columns' '
> +	git format-patch --stat --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

Hrm, this does not seem to pass, making the result of applying [1/3] fail;
I see that the elided name is shown much shorter than the above expects.

Perhaps this test found a bug in a "very long name, small changes" corner
case?  If that is the case, we'd mark it as test_expect_failure, and
explain the tests that expect failure demonstrates a buggy behaviour, e.g.

	When a pathname is so long that it cannot fit on the column, the
	current code truncates it to make sure that the graph part has at
	least N columns (enough room to show a meaningful graph).  If the
	actual change is small (e.g. only one line changed), this results
	in the final output that is shorter than the width we aim for.  A
	couple of new tests marked with test_expect_failure demonstrate
	this bug.

in the log message (note that I am not sure if that is the nature of the
bug, or what the actual value of N is).

And then a later patch [2/3] that updates the allocation between name and
graph will turn test_expect_failure to test_expect_success; that will make
it clear that your update fixed the bug.

> +cat >expect <<'EOF'
> + ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
> +EOF
> +test_expect_success 'format patch --stat=width with long name' '
> +	git format-patch --stat=40 --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

Likewise.

> +test_expect_success 'format patch --stat-width=width works with long name' '
> +	git format-patch --stat-width=40 --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

Likewise.

> +test_expect_success 'format patch --stat=...,name-width with long name' '
> +	git format-patch --stat=60,29 --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'
> +
> +test_expect_success 'format patch --stat-name-width with long name' '
> +	git format-patch --stat-name-width=29 --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

Likewise.

> +test_expect_success 'preparation' '

There was another "preparation" in this script already, which originally
threw me off while chasing which part of the test is failing. Can you
reword/retitle this one?

> +cat >expect <<'EOF'
> + abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
> +EOF
> +test_expect_success 'format patch graph part width is 40 columns' '
> +	git format-patch --stat --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

This test shouldn't be added in [1/3] because "cap the graph to 40-col" is
a new feature that is introduced in the later step.

> +test_expect_success 'format patch ignores COLUMNS' '
> +	COLUMNS=200 git format-patch --stat --stdout -1 >output
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'

This is a good test to have in [1/3], but the expectation should not cap the
graph part to 40 columns.  The patch that updates diff.c to implement the
cap in [2/3] should have an update to the expectation, whose diff hunk may
look liks this:

@@ 
 cat >expect <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++ 
 EOF

That would make the effect of the patch clearer.

> +cat >expect <<'EOF'
> + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
> +EOF
> +test_expect_success 'format patch --stat=width with big change and long name' '
> +	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
> +	git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
> +	git commit -m message &&
> +	git format-patch --stat-width=60 --stdout -1 >output &&
> +	grep " | " output >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_done

The same comment as the previous one.  Because you change the allocation
to the graph part in your patch to diff.c, which hasn't happened in [1/3]
yet, this should expect the existing behaviour (narrower graph) in this
step, and then be updated to expect the output shown above in the [2/3]
patch that changes the implementation in diff.c.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts
  2012-02-15 17:12                       ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big " Junio C Hamano
@ 2012-02-15 17:33                         ` Junio C Hamano
  2012-02-16  9:57                         ` Zbigniew Jędrzejewski-Szmek
  1 sibling, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15 17:33 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Junio C Hamano <gitster@pobox.com> writes:

> Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:
>
>> Eleven tests for various combinations of a long filename and/or big
>> change count and ways to specify widths for diff --stat.
>> ---
>
> Sign-off? 
> ...
> The same comment as the previous one.  Because you change the allocation
> to the graph part in your patch to diff.c, which hasn't happened in [1/3]
> yet, this should expect the existing behaviour (narrower graph) in this
> step, and then be updated to expect the output shown above in the [2/3]
> patch that changes the implementation in diff.c.

The previous review message in a patch form that can be squashed on top of
this patch.

-- >8 --
Subject: [PATCH] (squash to the previous -- replace the log message with this)

diff --stat: tests for long filenames and big change counts

In preparation for updates to the "diff --stat" that updates the logic
to split the allotted columns into the name part and the graph part to
make the output more readable, add a handful of tests to document the
corner case behaviour in which long filenames and big changes are shown.

When a pathname is so long that it cannot fit on the column, the current
code truncates it to make sure that the graph part has enough room to show
a meaningful graph.  If the actual change is small (e.g. only one line
changed), this results in the final output that is shorter than the width
we aim for.  A couple of new tests marked with test_expect_failure
demonstrate this bug.

---
 t/t4014-format-patch.sh |   35 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index f6ebb51..0376186 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -897,18 +897,18 @@ test_expect_success 'format patch ignores color.ui' '
 # 120 character name
 name=aaaaaaaaaa
 name=$name$name$name$name$name$name$name$name$name$name$name$name
-test_expect_success 'preparation' "
-	>\"$name\" &&
-	git add \"$name\" &&
+test_expect_success 'preparation' '
+	>"$name" &&
+	git add "$name" &&
 	git commit -m message &&
-	echo a >\"$name\" &&
-	git commit -m message \"$name\"
-"
+	echo a >"$name" &&
+	git commit -m message "$name"
+'
 
 cat >expect <<'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
 EOF
-test_expect_success 'format patch graph width defaults to 80 columns' '
+test_expect_failure 'format patch graph width defaults to 80 columns' '
 	git format-patch --stat --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
@@ -917,13 +917,13 @@ test_expect_success 'format patch graph width defaults to 80 columns' '
 cat >expect <<'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
 EOF
-test_expect_success 'format patch --stat=width with long name' '
+test_expect_failure 'format patch --stat=width with long name' '
 	git format-patch --stat=40 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'format patch --stat-width=width works with long name' '
+test_expect_failure 'format patch --stat-width=width works with long name' '
 	git format-patch --stat-width=40 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
@@ -941,26 +941,21 @@ test_expect_success 'format patch --stat-name-width with long name' '
 	test_cmp expect actual
 '
 
-test_expect_success 'preparation' '
+test_expect_success 'preparation for big change tests' '
 	>abcd &&
 	git add abcd &&
 	git commit -m message &&
 	i=0 &&
-	while test $i -lt 1000; do
-		echo $i &&
-		i=$(($i + 1))
+	while test $i -lt 1000
+	do
+		echo $i && i=$(($i + 1))
 	done >abcd &&
 	git commit -m message abcd
 '
 
 cat >expect <<'EOF'
- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success 'format patch graph part width is 40 columns' '
-	git format-patch --stat --stdout -1 >output &&
-	grep " | " output >actual &&
-	test_cmp expect actual
-'
 
 test_expect_success 'format patch ignores COLUMNS' '
 	COLUMNS=200 git format-patch --stat --stdout -1 >output
@@ -984,7 +979,7 @@ test_expect_success 'format patch --stat-width=width with big change' '
 '
 
 cat >expect <<'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++
 EOF
 test_expect_success 'format patch --stat=width with big change and long name' '
 	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
-- 
1.7.9.1.237.g00b59

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 2/3 v5] diff --stat: use the full terminal width
  2012-02-15 11:03                       ` [PATCH 2/3 v5] diff --stat: use the full terminal width Zbigniew Jędrzejewski-Szmek
@ 2012-02-15 18:07                         ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-15 18:07 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> Use as many columns as necessary for the filenames and up to 40
> columns for the graph.

I started to wonder if it is a good idea to split this step further into
at least two patches:

 - using term_columns() to set the default 'stat-width' instead of
   hardcoded 80, and do nothing else.  As you discovered, this step will
   not have to touch any test expectations.

 - update the logic to split the stat-width into name part and graph
   part. I think as a side-effect this will fix the corner case bugs the
   new tests in your [1/3] seem to have discovered, and the fix will be
   visible to the part that will update t/t4014 in this step.

> ... I've taken the middle way:
> number_width=4 is hardcoded, but the fprintf is reverted to the previous
> version. I think that this way the code is most readable, independently
> if later changes.

Sensible.

> I haven't done this, because $COLUMNS and the actual terminal width is always
> ignored in tests.

As long as the tests are not affected by ioctl(1) that is OK. I am not
expecting us to be automating the test of that codepath (unless somebody
has clever ideas perhaps using pty, but I suspect that would be a separate
patch anyway).

After writing the attached patch that goes on top of this patch to be
squashed, I am starting to think that "maximum 40 columns for the graph"
may be a mild regression for a project with a shallow hierarchy, namely,
this part.

 cat >expect <<'EOF'
- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
 EOF

A bug used to waste space by allocating more than necessary as the minimum
number of columns given for the graph part, even when the change turns out
to be just one line, requiring only one '+' in the graph.  The bug was fixed
by this patch not to waste space that way.  But now with this "maximum 40"
limit, we can see that it wastes the space even when the stat-width is 80.

Perhaps the maximum for garph_width should be raised to something like
"min(80, stat_width) - name_width"?

-- >8 --
Subject: [PATCH] (squash to the previous -- replace the last line of the
 log with the following)

The effect of this change is visible in the patch to t4014 that fixes a
few tests marked with test_expect_failure, and the change to shorten the
maximum graph width to 40 columns.
---
 t/t4014-format-patch.sh |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 0376186..88ccc5a 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -908,7 +908,7 @@ test_expect_success 'preparation' '
 cat >expect <<'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
 EOF
-test_expect_failure 'format patch graph width defaults to 80 columns' '
+test_expect_success 'format patch graph width defaults to 80 columns' '
 	git format-patch --stat --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
@@ -917,13 +917,13 @@ test_expect_failure 'format patch graph width defaults to 80 columns' '
 cat >expect <<'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
 EOF
-test_expect_failure 'format patch --stat=width with long name' '
+test_expect_success 'format patch --stat=width with long name' '
 	git format-patch --stat=40 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
 '
 
-test_expect_failure 'format patch --stat-width=width works with long name' '
+test_expect_success 'format patch --stat-width=width works with long name' '
 	git format-patch --stat-width=40 --stdout -1 >output &&
 	grep " | " output >actual &&
 	test_cmp expect actual
@@ -954,8 +954,13 @@ test_expect_success 'preparation for big change tests' '
 '
 
 cat >expect <<'EOF'
- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++
 EOF
+test_expect_success 'format patch graph part width is 40 columns' '
+	git format-patch --stat --stdout -1 >output &&
+	grep " | " output >actual &&
+	test_cmp expect actual
+'
 
 test_expect_success 'format patch ignores COLUMNS' '
 	COLUMNS=200 git format-patch --stat --stdout -1 >output
@@ -979,7 +984,7 @@ test_expect_success 'format patch --stat-width=width with big change' '
 '
 
 cat >expect <<'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
 EOF
 test_expect_success 'format patch --stat=width with big change and long name' '
 	cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
-- 
1.7.9.1.237.g00b59

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts
  2012-02-15 17:12                       ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big " Junio C Hamano
  2012-02-15 17:33                         ` Junio C Hamano
@ 2012-02-16  9:57                         ` Zbigniew Jędrzejewski-Szmek
  2012-02-16 20:01                           ` Junio C Hamano
  1 sibling, 1 reply; 206+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2012-02-16  9:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Michael J Gruber, pclouds

On 02/15/2012 06:12 PM, Junio C Hamano wrote:
> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:
>
>> Eleven tests for various combinations of a long filename and/or big
>> change count and ways to specify widths for diff --stat.
>> ---
>
> Sign-off?

> Hrm, this does not seem to pass, making the result of applying [1/3] fail;
> I see that the elided name is shown much shorter than the above expects.

Hi,

I'm sorry for not properly testing the patch with tests. I somehow 
convinced myself that the tests pass. This whole series needs more work, 
even after squashing in your two patches. I'll send a new series, but 
probably not today. (I'll try to remember the sign-off too, next time).
--
Zbyszek

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts
  2012-02-16  9:57                         ` Zbigniew Jędrzejewski-Szmek
@ 2012-02-16 20:01                           ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-02-16 20:01 UTC (permalink / raw)
  To: Zbigniew Jędrzejewski-Szmek; +Cc: git, Michael J Gruber, pclouds

Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> writes:

> On 02/15/2012 06:12 PM, Junio C Hamano wrote:
>> Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:
>>
>>> Eleven tests for various combinations of a long filename and/or big
>>> change count and ways to specify widths for diff --stat.
>>> ---
>>
>> Sign-off?
>
>> Hrm, this does not seem to pass, making the result of applying [1/3] fail;
>> I see that the elided name is shown much shorter than the above expects.
>
> Hi,
>
> I'm sorry for not properly testing the patch with tests. I somehow
> convinced myself that the tests pass. This whole series needs more
> work, even after squashing in your two patches.

It is nothing to be sorry about if a series needs more polishing; that is
what the review discussions are for.

I've queued the series after restructuring it, and merged except for [3/3]
to 'pu', which conflicts too heavily with the nd/diffstat-gramnum topic
that is already in 'master'.  I'd say we should concentrate on your first
two patches without the "num-width" stuff and get them in first, and then
later consider if rerolling the [3/3] patch is worth it after the dust
settles.

Thanks.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2016-06-16  3:54 岸洋介
  0 siblings, 0 replies; 206+ messages in thread
From: 岸洋介 @ 2016-06-16  3:54 UTC (permalink / raw)
  To: git

w

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2016-06-12  9:38 Financial Service
  0 siblings, 0 replies; 206+ messages in thread
From: Financial Service @ 2016-06-12  9:38 UTC (permalink / raw)


Greetings,  Have you been looking for finance options for your new home purchase, construction, refinance, medical cash, family cash, personal or business purpose. Welcome to the future! Finance made easy with us. Contact us as we offer our finance service at a low and affordable interest rate for long and short cash term,reply to this Email for more Info

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
  2016-06-07 14:01 [PATCH v3 0/6] send-email: cleaner tests and quote email Tom Russello
@ 2016-06-08 13:01 ` Samuel GROOT
  0 siblings, 0 replies; 206+ messages in thread
From: Samuel GROOT @ 2016-06-08 13:01 UTC (permalink / raw)
  To: git
  Cc: samuel.groot, tom.russello, erwan.mathoniere, jordan.de-gea,
	matthieu.moy, gitster, aaron, e


The purpose of this series of patches is to implement a new
"quote-email" feature integrated in the current `--in-reply-to` option.


 * The first 2 patches make the tests less dependent to
   `git send-email`'s exact output.

 * Third patch makes `git send-email` a bit less verbose.

 * Fourth patch introduces our email parser subroutine.

 * Fifth patch makes the `--in-reply-to` open a email file (if it
   exists) and populates From:, To:, Cc:, In-reply-to and
   References: fields.

 * Sixth patch quotes the message body in the cover letter if
   `--compose` is set. Else, imply `--annotate` and insert quoted
   message body below triple-dash in the first patch.


Changes since v3:
 - test_cmp_noorder shell function fixed             (patch 1/6)
 - use fgrep instead of grep                         (patch 2/6)
 - typo fixed                                        (patch 3/6)
 - email parser subroutine moved to Git.pm library   (patch 4/6)
 - test if $mail->{"cc"} is defined                  (patch 5/6)

  [PATCH v4 1/6] t9001: non order-sensitive file comparison
  [PATCH v4 2/6] t9001: check email address is in Cc: field
  [PATCH v4 3/6] send-email: shorten send-email's output
  [PATCH v4 4/6] send-email: create email parser subroutine
  [PATCH v4 5/6] send-email: --in-reply-to=<file> populate header
  [PATCH v4 6/6] send-email: add option --cite to quote the message

 Documentation/git-send-email.txt |  17 +++++-
 git-send-email.perl              | 150 ++++++++++++++++++++++++++++++++++++++++++++-----
 perl/Git.pm                      |  34 ++++++++++++
 t/t9001-send-email.sh            | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++------------
 4 files changed, 339 insertions(+), 52 deletions(-)

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2016-05-16 15:58 Nathan Wendt
  0 siblings, 0 replies; 206+ messages in thread
From: Nathan Wendt @ 2016-05-16 15:58 UTC (permalink / raw)
  To: git

Recently I have run into an issue with the git-completion.tcsh script
where an error would occur upon sourcing the file on login. The error
that would occur was:

__git_tcsh_completion_version: Subscript out of range.

In taking a look at the script, I noticed that when the script parses
the tcsh version that I am running it does not put the output into an
array. Thus, when it attempts to access subscript 2 of
__git_tcsh_completion_version it throws the above error. To correct
this, I changed

set __git_tcsh_completion_version =  ` \echo ${tcsh} | \sed 's/\./ /g'`

to

set __git_tcsh_completion_version =  `( \echo ${tcsh} | \sed 's/\./ /g' )`

and the script runs correctly. I could not find others having issues
with this in the forums so I am not sure if this is unique to my
system or not. Thought I would pass it along.

For reference, I am running tcsh 6.17.00 on RHEL 6.8

Thanks.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2016-04-11 19:04 miwilliams
  0 siblings, 0 replies; 206+ messages in thread
From: miwilliams @ 2016-04-11 19:04 UTC (permalink / raw)
  To: git

 From 7201fe08ede76e502211a781250c9a0b702a78b2 Mon Sep 17 00:00:00 2001
From: Mike Williams <miwilliams@google.com>
Date: Mon, 11 Apr 2016 14:18:39 -0400
Subject: [PATCH 1/1] wt-status: Remove '!!' from  
wt_status_collect_changed_cb

The wt_status_collect_changed_cb function uses an extraneous double  
negation (!!)
when determining whether or not a submodule has new commits.

Signed-off-by: Mike Williams <miwilliams@google.com>
---
  wt-status.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wt-status.c b/wt-status.c
index ef74864..b955179 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -431,7 +431,7 @@ static void wt_status_collect_changed_cb(struct  
diff_queue_struct *q,
  			d->worktree_status = p->status;
  		d->dirty_submodule = p->two->dirty_submodule;
  		if (S_ISGITLINK(p->two->mode))
-			d->new_submodule_commits = !!hashcmp(p->one->sha1, p->two->sha1);
+			d->new_submodule_commits = hashcmp(p->one->sha1, p->two->sha1);
  	}
  }

-- 
2.8.0

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2016-04-11 16:02 Michael S. Tsirkin
  0 siblings, 0 replies; 206+ messages in thread
From: Michael S. Tsirkin @ 2016-04-11 16:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, bafain, sunshine

Cc junio
Bcc: 
Subject: Re: [PATCH 1/4] rebase -i: add ack action
Message-ID: <20160411184535-mutt-send-email-mst@redhat.com>
Reply-To: 
In-Reply-To: <alpine.DEB.2.20.1604111736060.2967@virtualbox>

On Mon, Apr 11, 2016 at 05:36:45PM +0200, Johannes Schindelin wrote:
> Hi Michael,
> 
> On Mon, 11 Apr 2016, Michael S. Tsirkin wrote:
> 
> > So far I only see examples of adding footers. If that's all we can think
> > up, why code in all this genericity?
> 
> Because as far as I can see, the only benefitor of your patches would be
> you.
> 
> Ciao,
> Johannes

This seems unlikely.  Just merging the patches won't benefit me directly
- I have maintained them in my tree for a couple of years now with very
little effort.  For sure, I could benefit if they get merged and then
someone improves them further - that was the point of posting them - but
then I'm not the only benefitor.

The workflow including getting acks for patches by email is not handled
well by upstream git right now.  It would surprise me if no one uses it
if it's upstream, as you seem to suggest.  But maybe most people moved
on and just do pull requests instead.

-- 
MST

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2016-03-28 13:38 ratheesh kannoth
  0 siblings, 0 replies; 206+ messages in thread
From: ratheesh kannoth @ 2016-03-28 13:38 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2015-12-16  8:44   ` (unknown) Patrick Steinhardt
@ 2015-12-18 17:35     ` David Greene
  0 siblings, 0 replies; 206+ messages in thread
From: David Greene @ 2015-12-18 17:35 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, john, sandals, peff, Junio C Hamano

Patrick Steinhardt <ps@pks.im> writes:

> On Tue, Dec 15, 2015 at 09:57:50PM -0800, Junio C Hamano wrote:
>> David Greene <greened@obbligato.org> writes:
>> 
>> > - If new option --keep-redundant is specified, invoke cherry-pick with
>> >   --keep-redundant-commits.
>> 
>> This came up in the past several weeks, I think; you would need to
>> disable patch-equivalence based commit filtering if you really want
>> to do a --keep-redundant that is reproducible and/or reliable.
>
> Here are the links to the previous proposal [1] and following
> discussion [2] (see 'ps/rebase-keep-empty') if you are
> interested.
>
> Patrick
>
> [1]: http://thread.gmane.org/gmane.comp.version-control.git/281515[2]: http://thread.gmane.org/gmane.comp.version-control.git/281917

Thanks.  That makes total sense.

I actually would prefer a behavior where cherry-pick would just drop
redundant commits rather than stopping and asking the user to reset.
The problem is that rebase --preserve-merges seems to force the drop to
use cherry-pick and cherry-pick doesn't behave well (from a scripting
perspective) in the presence of redundant commits.

As it is, it's difficult to rebase as part of a scripted operation due
to this issue.

Any ideas on how to teach cherry-pick to automatically drop such
commits?

                           -David

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2015-12-16  5:57 ` (unknown) Junio C Hamano
@ 2015-12-16  8:44   ` Patrick Steinhardt
  2015-12-18 17:35     ` (unknown) David Greene
  0 siblings, 1 reply; 206+ messages in thread
From: Patrick Steinhardt @ 2015-12-16  8:44 UTC (permalink / raw)
  To: David Greene; +Cc: git, john, sandals, peff, Junio C Hamano

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

On Tue, Dec 15, 2015 at 09:57:50PM -0800, Junio C Hamano wrote:
> David Greene <greened@obbligato.org> writes:
> 
> > - If new option --keep-redundant is specified, invoke cherry-pick with
> >   --keep-redundant-commits.
> 
> This came up in the past several weeks, I think; you would need to
> disable patch-equivalence based commit filtering if you really want
> to do a --keep-redundant that is reproducible and/or reliable.

Here are the links to the previous proposal [1] and following
discussion [2] (see 'ps/rebase-keep-empty') if you are
interested.

Patrick

[1]: http://thread.gmane.org/gmane.comp.version-control.git/281515
[2]: http://thread.gmane.org/gmane.comp.version-control.git/281917

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

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2015-12-16  3:02 (unknown), David Greene
@ 2015-12-16  5:57 ` Junio C Hamano
  2015-12-16  8:44   ` (unknown) Patrick Steinhardt
  0 siblings, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2015-12-16  5:57 UTC (permalink / raw)
  To: David Greene; +Cc: git, john, sandals, peff

David Greene <greened@obbligato.org> writes:

> - If new option --keep-redundant is specified, invoke cherry-pick with
>   --keep-redundant-commits.

This came up in the past several weeks, I think; you would need to
disable patch-equivalence based commit filtering if you really want
to do a --keep-redundant that is reproducible and/or reliable.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-12-16  3:02 David Greene
  2015-12-16  5:57 ` (unknown) Junio C Hamano
  0 siblings, 1 reply; 206+ messages in thread
From: David Greene @ 2015-12-16  3:02 UTC (permalink / raw)
  To: git; +Cc: john, sandals, peff, gitster


This patch isn't ready for prime-time yet but I wanted to get it out
for some discussion.

While cleaning up and enhancing git-subtree, I've come across the
need to have rebase behave nicely in the case of empty and redundant
commits.  There's a case in pick_one_preserving_merges where
git-cherry pick is used to process the rebase and if cherry-pick
fails, the rebase aborts.  This change does two things:

- If --keep-empty is specified, invoke cherry-pick with --allow-empty.

- If new option --keep-redundant is specified, invoke cherry-pick with
  --keep-redundant-commits.

This allows the rebase to go forward without intrruption in the
included tests.

I will also need a third option that has cherry-pick ignore redundant
commits and remove them from the history.  Unfortunately, I can't
make out exactly how to do that in commit.c, which is where I gather
the cherry-pick stuff happens.  I'll need some help with that if
there's general agreement that this is a useful enhancement.

During the course of developing this, I've encountered some
strange rebase behavior.  I'll send another message about that.

I'd appreciate feedback on this direction and any help with the
cherry-pick stuff.  Thanks!

                         -David

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2015-12-14 13:14 Ros Sothen
  0 siblings, 0 replies; 206+ messages in thread
From: Ros Sothen @ 2015-12-14 13:14 UTC (permalink / raw)
  To: git



Sent from my iPhone

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-11-06  3:34 David Greene
  0 siblings, 0 replies; 206+ messages in thread
From: David Greene @ 2015-11-06  3:34 UTC (permalink / raw)
  To: git
  Cc: techlivezheng, alex.crezoff, davvid, cbailey32, danny0838,
	prohaska, th.acker, sschuberth, peff, gitter.spiros, nod.helm

I'm processing some old patches I have lying around.  These clean up
git-subtree's test base and refactor the test code so that each test
is independent of the others.  This greatly aids debugging and
post-mortem analysis.

I have rebased these old patches on master, ensuring that new tests
that have been added in the interim are incorporated into the new test
code.

After using git-subtree in real projects for a couple of years and
exploring similar tools that have been developed, I'm fairly convinced
we should change some current behavor of git-subtree.  I have also run
into the need for some additional features.  I'm now in a position
where I can work on those.

This patch set is a prerequisite for that work.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-09-28 17:55 Kosta Zertsekel
  0 siblings, 0 replies; 206+ messages in thread
From: Kosta Zertsekel @ 2015-09-28 17:55 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-09-19 10:58 戸島達哉
  0 siblings, 0 replies; 206+ messages in thread
From: 戸島達哉 @ 2015-09-19 10:58 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-09-01  2:13 David Turner
  0 siblings, 0 replies; 206+ messages in thread
From: David Turner @ 2015-09-01  2:13 UTC (permalink / raw)
  To: git, mhagger, Christian Couder

This version of the patch series squashes in Junio's comment fix and
the xstrndup fix.

In addition, it removes refs/worktree, and just makes refs/bisect
per-worktree.  If we later discover that other things need to be
per-worktree, we can do refs/worktree, but for now, this is
backwards-compatible so we'll do this.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2015-08-05 12:47 Ivan Chernyavsky
  0 siblings, 0 replies; 206+ messages in thread
From: Ivan Chernyavsky @ 2015-08-05 12:47 UTC (permalink / raw)
  To: git

Dear community,

For some time I'm wondering why there's no "--grep" option to the "git branch" command, which would request to print only branches having specified string/regexp in their history.

So for example:

    $ git branch -r --grep=BUG12345

should be roughly equivalent to following expression I'm using now for the same task:

    $ for r in `git rev-list --grep=BUG12345 --remotes=origin`; do git branch -r --list --contains=$r 'origin/*'; done | sort -u

Am I missing something, is there some smarter/simpler way to do this?

Thanks a lot in advance!

-- 
  Ivan

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-05-12 12:38 Varis Van Rob
  0 siblings, 0 replies; 206+ messages in thread
From: Varis Van Rob @ 2015-05-12 12:38 UTC (permalink / raw)





Good Day!

My name is Mr Varis Van Rob, I have a business proposal that will benefit
you.contact me for more details.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-05-11 17:56 dturner
  0 siblings, 0 replies; 206+ messages in thread
From: dturner @ 2015-05-11 17:56 UTC (permalink / raw)
  To: git

This version includes style fixups suggested by Junio Hamano.  As
suggested, I moved the addition of the new object_context field to the
patch where it is used.

In addition, I moved a few variables into smaller scopes.

I also (hopefully) fixed the tests on Windows thanks to some
suggestions from Johannes Sixt

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-04-08 20:44 Mamta Upadhyay
  0 siblings, 0 replies; 206+ messages in thread
From: Mamta Upadhyay @ 2015-04-08 20:44 UTC (permalink / raw)
  To: git

Hi git team,

I tried to research everywhere on a issue I am facing and emailing you
as the last resource. This is critical for me and I needed your help.

I am trying to run the latest git 1.9.5 installer on windows. When I
run strings on libneon-25.dll it shows this:

./libneon-25.dll:            OpenSSL 1.0.1h 5 Jun 2014

But when I load this dll in dependency walker, it picks up
msys-openssl 1.0.1m and has no trace of openssl-1.0.1h. My questions
to you:

1. Is libneon-25.dll statically linked with openssl-1.0.1h?
2. If not, where is the reference to 1.0.1h coming from?

I am asked to rebuild git with libneon-25.dll linked against
openssl-1.0.1m. But I am having a feeling that this is not needed,
since libneon is already picking the latest openssl version. Can you
please confirm?

Thanks,
Mamta

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2015-03-13  1:34 cody.taylor
  0 siblings, 0 replies; 206+ messages in thread
From: cody.taylor @ 2015-03-13  1:34 UTC (permalink / raw)
  To: git; +Cc: szeder, felipe.contreras

>From 3e4e22e93bf07355b40ba0abcb3a15c4941cfee7 Mon Sep 17 00:00:00 2001
From: Cody A Taylor <codemister99@yahoo.com>
Date: Thu, 12 Mar 2015 20:36:44 -0400
Subject: [PATCH] git prompt: Use toplevel to find untracked files.

The __git_ps1() prompt function would not show an untracked
state when the current working directory was not a parent of
the untracked file.

Signed-off-by: Cody A Taylor <codemister99@yahoo.com>
---
 contrib/completion/git-prompt.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 214e859f99e7..f0d8a2669236 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -487,7 +487,8 @@ __git_ps1 ()
 
 		if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
 		   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
-		   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
+		   git ls-files --others --exclude-standard --error-unmatch -- \
+		     "$(git rev-parse --show-toplevel)/*" >/dev/null 2>/dev/null
 		then
 			u="%${ZSH_VERSION+%}"
 		fi
-- 
2.3.2

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2015-02-25  8:53 stefan leijen
  0 siblings, 0 replies; 206+ messages in thread
From: stefan leijen @ 2015-02-25  8:53 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
  2015-02-17 18:14 [PATCH] read-cache.c: free cache entry when refreshing fails Junio C Hamano
@ 2015-02-17 18:27 ` Stefan Beller
  0 siblings, 0 replies; 206+ messages in thread
From: Stefan Beller @ 2015-02-17 18:27 UTC (permalink / raw)
  To: gitster; +Cc: git, Stefan Beller


On Tue, Feb 17, 2015 at 10:14 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> This fixes a memory leak, when building the cache entries as
>> refresh_cache_entry may decide to return NULL in case of
>>
>
> in case of what?

Yeah, I got distracted when rewriting the commit message as I was 
looking at refresh_cache_ent() wondering if there is a better place to 
free the memory. Just as you said below.

Maybe we can drop that part of the sentence as it doesn't matter
why refresh_cache_ent() returns NULL. All that matters is the 
possibility of it returning NULL.

>
> I briefly wondered if refresh_cache_ent() should do the freeing but
> that does not make sense at all if done unconditionally because the
> other caller of the function does want to retain ce on error, and it
> makes little sense to invent FREE_CE_ON_ERROR bit in refresh_option,
> either, so this fix looks sensible.
>

So here is a reworded commit message:

---8<---
From 3a1f646c1dbe828b68e1b269290d2b5593f86455 Mon Sep 17 00:00:00 2001
From: Stefan Beller <sbeller@google.com>
Date: Tue, 17 Feb 2015 10:05:36 -0800
Subject: [PATCH] read-cache.c: free cache entry when refreshing fails

This fixes a memory leak when building the cache entries as
refresh_cache_entry may decide to return NULL, but it doesn't
free the cache entry structure which was passed in as an argument.

I am not sure how severe this memory leak is as it was found by
scan.coverity.com, CID 290041.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 read-cache.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index 9cff715..8d71860 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -725,7 +725,7 @@ struct cache_entry *make_cache_entry(unsigned int mode,
 		unsigned int refresh_options)
 {
 	int size, len;
-	struct cache_entry *ce;
+	struct cache_entry *ce, *ret;
 
 	if (!verify_path(path)) {
 		error("Invalid path '%s'", path);
@@ -742,7 +742,13 @@ struct cache_entry *make_cache_entry(unsigned int mode,
 	ce->ce_namelen = len;
 	ce->ce_mode = create_ce_mode(mode);
 
-	return refresh_cache_entry(ce, refresh_options);
+	ret = refresh_cache_entry(ce, refresh_options);
+	if (!ret) {
+		free(ce);
+		return NULL;
+	} else {
+		return ret;
+	}
 }
 
 int ce_same_name(const struct cache_entry *a, const struct cache_entry *b)
-- 
2.3.0.81.gc37f363

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2015-01-12 20:59 امير الاحزان
  0 siblings, 0 replies; 206+ messages in thread
From: امير الاحزان @ 2015-01-12 20:59 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-10-30 12:23 Fedor Eftimitsa
  0 siblings, 0 replies; 206+ messages in thread
From: Fedor Eftimitsa @ 2014-10-30 12:23 UTC (permalink / raw)
  To: git

Greetings!

I have very large git repository (>20Gb) and after repack the size of it increases by 1.3-2 times.
I try to understand why it is happened and how to solve this matter.

Details
I work in gamedev and we store under git all what we have: source code, textures and other binary data.
Now size of the main repository (.git) is about 23Gb right after cloning.
But if I run 'git gc' or 'git gc --aggressive' size of repository increases to more than 40Gb.
'git gc --auto' doesn't change existing packs and doesn't increase size so much.

For a long time we disabled 'gc auto' for all work PCs and repacked repository by script at night.
Script configures some options and runs 'git gc' without --auto and now the size of most repositories is more than 50Gb.
Here this options from script:
-- pack.threads 2
-- pack.windowMemory 16m
-- pack.depth 1
-- pack.window 10
-- gc.aggressiveWindow 10
-- pack.packSizeLimit 2g

I try to improve this script and find the way to decrease size of these repositories to initial (after clone) size. The size of repository is very important because it's located on SSD disk for comfort work.
I've tried different options for 'git gc' and 'git gc --aggressive' but can't achieve this - size of repository always about 40Gb and more.
Best result provides 'git gc --aggressive' with disabled pack.packSizeLimit, window and depth is 250 - it creates single pack about 36Gb.
In worst case repository size can be more than 60Gb.

Can you help me to understand what options I can try to repack repositories to initial size?

All work PCs have Windows 7 and git version >=1.8.1 installed.

All the best,
Fedor Eftimitsa
Senior Programmer

Nival
www.nival.com
www.zzima.com

Skype: d9fault

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2014-09-28 10:51 bambecapuno06
  0 siblings, 0 replies; 206+ messages in thread
From: bambecapuno06 @ 2014-09-28 10:51 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-09-08 11:36 R. Klomp
  0 siblings, 0 replies; 206+ messages in thread
From: R. Klomp @ 2014-09-08 11:36 UTC (permalink / raw)
  To: git; +Cc: p.duijst

It seems like there's a bug involving git difftool's -d flag and Beyond Compare.

When using the difftool Beyond Compare, git difftool <..> <..> -d
immidiatly shuts down once the diff tree has been created. Beyond
Compare successfully shows the files that differ.
However, since git difftool doesn't wait for Beyond Compare to shut
down, all temporary files are gone. Due to this it's impossible to
view changes made inside files using the -d flag.

I haven't tested if this issue also happens with other difftools.

I'm using the latest versions of both Beyond Compare 3 (3.3.12, Pro
Edition for Windows) and Git (1.9.4 for Windows).


Thanks in advance for your help!

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-08-26 11:16 mail
  0 siblings, 0 replies; 206+ messages in thread
From: mail @ 2014-08-26 11:16 UTC (permalink / raw)
  To: git

Hi everyone.

Normally if I am tracking a file in a Directory which satisfies one of my
.gitignore rules, I can just add them via "git add foo", and I have no
issues.

For example, let me create a new repo.  I create a directory "lib"
containing file "foo.txt", and a Directory "lib2" with a file "bar.txt". 
I add and commit both files.

Now I create a .gitignore file containing the rule "lib*/".  I modify
lib/foo.txt and lib2/bar.txt.  I do "git status" and I'm informed that
foo.txt and bar.txt are modified.  So far so good.

The following commands work as expected:
 git add lib/foo.txt
 git add lib2/bar.txt

But if I instead do:
  git add lib/foo.txt lib2/bar.txt

I get the following response:
  The following paths are ignored by one of your .gitignore files:
  lib
  lib2

I have verified this behavior in git 1.9.3 and 2.1.0.  Is this desired
behavior or is it a bug?  If it is desired behavior, could someone please
describe the utility to me?

Many thanks for your excellent work

Glen Stark

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-07-15 16:31 Woody Wu
  0 siblings, 0 replies; 206+ messages in thread
From: Woody Wu @ 2014-07-15 16:31 UTC (permalink / raw)
  To: git

Hi,

I have tried some methods introduced in the network, but always failed.  Some big files committed by me to a very old branch then the files deleted and new branches were continuously created. Now the checkout directory has grown to about 80 megabytes.  What's the right way to permenently erase those garbage big files?

Thanks in advance.

-
Woody Wu from mobile phone

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-06-17 17:13 David Turner
  0 siblings, 0 replies; 206+ messages in thread
From: David Turner @ 2014-06-17 17:13 UTC (permalink / raw)
  To: git


This version changes only the commit message; there is no longer any
configure.ac code.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-06-01 21:24 C. Benson Manica
  0 siblings, 0 replies; 206+ messages in thread
From: C. Benson Manica @ 2014-06-01 21:24 UTC (permalink / raw)
  To: git

The documentation for installing git from source here,
http://git-scm.com/book/en/Getting-Started-Installing-Git, incorrectly
fails to mention that the MakeMaker perl module is also required and
is installable via

$ yum install perl-ExtUtils-MakeMaker

Also, you might want to let people know that you've configured your
mail system for 1987 mode and do not accept HTML-formatted mail.

-- 
C. Benson Manica
cbmanica@gmail.com

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-05-22 22:35 Mrs. Jiang Ming
  0 siblings, 0 replies; 206+ messages in thread
From: Mrs. Jiang Ming @ 2014-05-22 22:35 UTC (permalink / raw)





-- 
Compliment of the day,

I am Mrs. Jiang Ming, a staff of Lloyds TSB Group Plc. here in
Hong Kong attached with Private Banking Services;I have a secured business
proposal for you. Should you be interested please reach me on my private
emailaddress (mrsjiangming1903@outlook.com) And after that I shall provide
you with
more details of my proposal.
Your earliest response to this letter will be appreciated.

Yours Sincerely,
Jiang Ming

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2014-04-19 14:27 Siegel, Suzan
  0 siblings, 0 replies; 206+ messages in thread
From: Siegel, Suzan @ 2014-04-19 14:27 UTC (permalink / raw)





T0 get your entitlement, write me via; siedmond@outlook.com

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2014-03-19  0:45 szager
  0 siblings, 0 replies; 206+ messages in thread
From: szager @ 2014-03-19  0:45 UTC (permalink / raw)
  To: git

Subject: [PATCH] Enable index-pack threading in msysgit.

This adds a Windows implementation of pread.  Note that it is NOT
safe to intersperse calls to read() and pread() on a file
descriptor.  According to the ReadFile spec, using the 'overlapped'
argument should not affect the implicit position pointer of the
descriptor.  Experiments have shown that this is, in fact, a lie.

To accomodate that fact, this change also incorporates:

http://article.gmane.org/gmane.comp.version-control.git/196042

... which gives each index-pack thread its own file descriptor.
---
 builtin/index-pack.c | 21 ++++++++++++++++-----
 compat/mingw.c       | 31 ++++++++++++++++++++++++++++++-
 compat/mingw.h       |  3 +++
 config.mak.uname     |  1 -
 4 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 2f37a38..c02dd4c 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -51,6 +51,7 @@ struct thread_local {
 #endif
 	struct base_data *base_cache;
 	size_t base_cache_used;
+	int pack_fd;
 };
 
 /*
@@ -91,7 +92,8 @@ static off_t consumed_bytes;
 static unsigned deepest_delta;
 static git_SHA_CTX input_ctx;
 static uint32_t input_crc32;
-static int input_fd, output_fd, pack_fd;
+static const char *curr_pack;
+static int input_fd, output_fd;
 
 #ifndef NO_PTHREADS
 
@@ -134,6 +136,7 @@ static inline void unlock_mutex(pthread_mutex_t *mutex)
  */
 static void init_thread(void)
 {
+	int i;
 	init_recursive_mutex(&read_mutex);
 	pthread_mutex_init(&counter_mutex, NULL);
 	pthread_mutex_init(&work_mutex, NULL);
@@ -141,11 +144,17 @@ static void init_thread(void)
 		pthread_mutex_init(&deepest_delta_mutex, NULL);
 	pthread_key_create(&key, NULL);
 	thread_data = xcalloc(nr_threads, sizeof(*thread_data));
+	for (i = 0; i < nr_threads; i++) {
+		thread_data[i].pack_fd = open(curr_pack, O_RDONLY);
+		if (thread_data[i].pack_fd == -1)
+			die_errno("unable to open %s", curr_pack);
+	}
 	threads_active = 1;
 }
 
 static void cleanup_thread(void)
 {
+	int i;
 	if (!threads_active)
 		return;
 	threads_active = 0;
@@ -155,6 +164,8 @@ static void cleanup_thread(void)
 	if (show_stat)
 		pthread_mutex_destroy(&deepest_delta_mutex);
 	pthread_key_delete(key);
+	for (i = 0; i < nr_threads; i++)
+		close(thread_data[i].pack_fd);
 	free(thread_data);
 }
 
@@ -288,13 +299,13 @@ static const char *open_pack_file(const char *pack_name)
 			output_fd = open(pack_name, O_CREAT|O_EXCL|O_RDWR, 0600);
 		if (output_fd < 0)
 			die_errno(_("unable to create '%s'"), pack_name);
-		pack_fd = output_fd;
+		nothread_data.pack_fd = output_fd;
 	} else {
 		input_fd = open(pack_name, O_RDONLY);
 		if (input_fd < 0)
 			die_errno(_("cannot open packfile '%s'"), pack_name);
 		output_fd = -1;
-		pack_fd = input_fd;
+		nothread_data.pack_fd = input_fd;
 	}
 	git_SHA1_Init(&input_ctx);
 	return pack_name;
@@ -542,7 +553,7 @@ static void *unpack_data(struct object_entry *obj,
 
 	do {
 		ssize_t n = (len < 64*1024) ? len : 64*1024;
-		n = pread(pack_fd, inbuf, n, from);
+		n = pread(get_thread_data()->pack_fd, inbuf, n, from);
 		if (n < 0)
 			die_errno(_("cannot pread pack file"));
 		if (!n)
@@ -1490,7 +1501,7 @@ static void show_pack_info(int stat_only)
 int cmd_index_pack(int argc, const char **argv, const char *prefix)
 {
 	int i, fix_thin_pack = 0, verify = 0, stat_only = 0;
-	const char *curr_pack, *curr_index;
+	const char *curr_index;
 	const char *index_name = NULL, *pack_name = NULL;
 	const char *keep_name = NULL, *keep_msg = NULL;
 	char *index_name_buf = NULL, *keep_name_buf = NULL;
diff --git a/compat/mingw.c b/compat/mingw.c
index 383cafe..6cc85d6 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -329,7 +329,36 @@ int mingw_mkdir(const char *path, int mode)
 	return ret;
 }
 
-int mingw_open (const char *filename, int oflags, ...)
+
+ssize_t mingw_pread(int fd, void *buf, size_t count, off64_t offset)
+{
+	HANDLE hand = (HANDLE)_get_osfhandle(fd);
+	if (hand == INVALID_HANDLE_VALUE) {
+		errno = EBADF;
+		return -1;
+	}
+
+	LARGE_INTEGER offset_value;
+	offset_value.QuadPart = offset;
+
+	DWORD bytes_read = 0;
+	OVERLAPPED overlapped = {0};
+	overlapped.Offset = offset_value.LowPart;
+	overlapped.OffsetHigh = offset_value.HighPart;
+	BOOL result = ReadFile(hand, buf, count, &bytes_read, &overlapped);
+
+	ssize_t ret = bytes_read;
+
+	if (!result && GetLastError() != ERROR_HANDLE_EOF)
+	{
+		errno = err_win_to_posix(GetLastError());
+		ret = -1;
+	}
+
+	return ret;
+}
+
+int mingw_open(const char *filename, int oflags, ...)
 {
 	va_list args;
 	unsigned mode;
diff --git a/compat/mingw.h b/compat/mingw.h
index 08b83fe..377ba50 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -174,6 +174,9 @@ int mingw_unlink(const char *pathname);
 int mingw_rmdir(const char *path);
 #define rmdir mingw_rmdir
 
+ssize_t mingw_pread(int fd, void *buf, size_t count, off64_t offset);
+#define pread mingw_pread
+
 int mingw_open (const char *filename, int oflags, ...);
 #define open mingw_open
 
diff --git a/config.mak.uname b/config.mak.uname
index e8acc39..b405524 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -474,7 +474,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
 endif
 ifneq (,$(findstring MINGW,$(uname_S)))
 	pathsep = ;
-	NO_PREAD = YesPlease
 	NEEDS_CRYPTO_WITH_SSL = YesPlease
 	NO_LIBGEN_H = YesPlease
 	NO_POLL = YesPlease
-- 
1.9.0.279.gdc9e3eb

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2014-03-05  8:43 Stephanie Bennett
  0 siblings, 0 replies; 206+ messages in thread
From: Stephanie Bennett @ 2014-03-05  8:43 UTC (permalink / raw)


I have a good news for you, for details contact me through
lottery_b1@yahoo.com
Sir Edmond Newton

_____________________________________________________________________________________
This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2014-02-20  0:55 Bozhidar Bozhev
  0 siblings, 0 replies; 206+ messages in thread
From: Bozhidar Bozhev @ 2014-02-20  0:55 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2013-12-18 14:09 Maxime Coste
  0 siblings, 0 replies; 206+ messages in thread
From: Maxime Coste @ 2013-12-18 14:09 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2013-08-07 12:54 a a
  0 siblings, 0 replies; 206+ messages in thread
From: a a @ 2013-08-07 12:54 UTC (permalink / raw)
  To: git

Hello.

I find 2 bug about Japanese'  Documentation .
There are Documentation -> Book 's url. ( Please see the details below).

I want to bug-fix about this misspell.

Do you have Documentation (about Japanese language) on the GitHub?

(1)
http://git-scm.com/book/ja/Git-%E3%81%AE%E5%9F%BA%E6%9C%AC-%E4%BD%9C%E6%A5%AD%E3%81%AE%E3%82%84%E3%82%8A%E7%9B%B4%E3%81%97

(2)
http://git-scm.com/book/ja/Git-%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E6%A9%9F%E8%83%BD-%E3%83%AA%E3%83%A2%E3%83%BC%E3%83%88%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2013-05-25  3:57 Kirill Berezin
  0 siblings, 0 replies; 206+ messages in thread
From: Kirill Berezin @ 2013-05-25  3:57 UTC (permalink / raw)
  To: git

git unsubscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
       [not found]     ` <CAPig+cTitT9Z+2pxeNh3dXi4b7X738qpkUnEmTi2yvQoCPtHqA@mail.g mail.com>
@ 2013-05-20 20:01       ` Marty Landman
  0 siblings, 0 replies; 206+ messages in thread
From: Marty Landman @ 2013-05-20 20:01 UTC (permalink / raw)
  To: Git List

unsubscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2013-05-17 18:02 ASHISH VERMA
  0 siblings, 0 replies; 206+ messages in thread
From: ASHISH VERMA @ 2013-05-17 18:02 UTC (permalink / raw)
  To: git

Hi,  i am using git to push my code from eclipse to heroku , but
recently iam  getting error like::

master:master rejected:non fast forward

and i am not able to resolve it .I tried a git pull but that says -
conflicts shud be resolved before git pull can be implemented.I can;t
find the solution Please help ASAP...



ASHISH

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2012-12-28 16:43 (unknown) Eric S. Raymond
@ 2012-12-28 19:33 ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2012-12-28 19:33 UTC (permalink / raw)
  To: Eric S. Raymond; +Cc: git

esr@thyrsus.com (Eric S. Raymond) writes:

> From: "Eric S. Raymond" <esr@thyrsus.com>
> Date: Fri, 28 Dec 2012 11:40:59 -0500
> Subject: [PATCH] Add checks to Python scripts for version dependencies.
>
> ---
>  contrib/ciabot/ciabot.py           | 8 +++++++-
> ...
> diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
> index 82f5ed3..b989941 100755
> --- a/contrib/fast-import/import-zips.py
> +++ b/contrib/fast-import/import-zips.py
> @@ -9,10 +9,15 @@
>  ##  git log --stat import-zips
>  
>  from os import popen, path
> -from sys import argv, exit
> +from sys import argv, exit, hexversion
>  from time import mktime
>  from zipfile import ZipFile
>  
> +if hexversion < 0x01060000:

I am assuming that you are carefully limiting what you import from
"sys" by adding only hexversion to the import above, but then can we
refer to sys.stderr below?

> +	# The limiter is the zipfile module
> +        sys.stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
> +        sys.exit(1)
> +

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2012-12-28 16:43 Eric S. Raymond
  2012-12-28 19:33 ` (unknown) Junio C Hamano
  0 siblings, 1 reply; 206+ messages in thread
From: Eric S. Raymond @ 2012-12-28 16:43 UTC (permalink / raw)
  To: git

From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Fri, 28 Dec 2012 11:40:59 -0500
Subject: [PATCH] Add checks to Python scripts for version dependencies.

---
 contrib/ciabot/ciabot.py           | 8 +++++++-
 contrib/fast-import/import-zips.py | 7 ++++++-
 contrib/hg-to-git/hg-to-git.py     | 5 +++++
 contrib/p4import/git-p4import.py   | 5 +++++
 contrib/svn-fe/svnrdump_sim.py     | 4 ++++
 git-p4.py                          | 8 +++++++-
 git-remote-testgit.py              | 5 +++++
 git_remote_helpers/git/__init__.py | 5 +++++
 8 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/contrib/ciabot/ciabot.py b/contrib/ciabot/ciabot.py
index bd24395..81c3ebd 100755
--- a/contrib/ciabot/ciabot.py
+++ b/contrib/ciabot/ciabot.py
@@ -47,7 +47,13 @@
 # we default to that.
 #
 
-import os, sys, commands, socket, urllib
+import sys
+if sys.hexversion < 0x02000000:
+	# The limiter is the xml.sax module
+        sys.stderr.write("ciabot.py: requires Python 2.0.0 or later.\n")
+        sys.exit(1)
+
+import os, commands, socket, urllib
 from xml.sax.saxutils import escape
 
 # Changeset URL prefix for your repo: when the commit ID is appended
diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index 82f5ed3..b989941 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -9,10 +9,15 @@
 ##  git log --stat import-zips
 
 from os import popen, path
-from sys import argv, exit
+from sys import argv, exit, hexversion
 from time import mktime
 from zipfile import ZipFile
 
+if hexversion < 0x01060000:
+	# The limiter is the zipfile module
+        sys.stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
+        sys.exit(1)
+
 if len(argv) < 2:
 	print 'Usage:', argv[0], '<zipfile>...'
 	exit(1)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 046cb2b..232625a 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -23,6 +23,11 @@ import os, os.path, sys
 import tempfile, pickle, getopt
 import re
 
+if sys.hexversion < 0x02030000:
+   # The behavior of the pickle module changed significantly in 2.3
+   sys.stderr.write("hg-to-git.py: requires Python 2.3 or later.\n")
+   sys.exit(1)
+
 # Maps hg version -> git version
 hgvers = {}
 # List of children for each hg revision
diff --git a/contrib/p4import/git-p4import.py b/contrib/p4import/git-p4import.py
index b6e534b..593d6a0 100644
--- a/contrib/p4import/git-p4import.py
+++ b/contrib/p4import/git-p4import.py
@@ -14,6 +14,11 @@ import sys
 import time
 import getopt
 
+if sys.hexversion < 0x02020000:
+   # The behavior of the marshal module changed significantly in 2.2
+   sys.stderr.write("git-p4import.py: requires Python 2.2 or later.\n")
+   sys.exit(1)
+
 from signal import signal, \
    SIGPIPE, SIGINT, SIG_DFL, \
    default_int_handler
diff --git a/contrib/svn-fe/svnrdump_sim.py b/contrib/svn-fe/svnrdump_sim.py
index 1cfac4a..95a80ae 100755
--- a/contrib/svn-fe/svnrdump_sim.py
+++ b/contrib/svn-fe/svnrdump_sim.py
@@ -7,6 +7,10 @@ to the highest revision that should be available.
 """
 import sys, os
 
+if sys.hexversion < 0x02040000:
+	# The limiter is the ValueError() calls. This may be too conservative
+        sys.stderr.write("svnrdump-sim.py: requires Python 2.4 or later.\n")
+        sys.exit(1)
 
 def getrevlimit():
         var = 'SVNRMAX'
diff --git a/git-p4.py b/git-p4.py
index 551aec9..69f1452 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -8,7 +8,13 @@
 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
 #
 
-import optparse, sys, os, marshal, subprocess, shelve
+import sys
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git-p4: requires Python 2.4 or later.\n")
+    sys.exit(1)
+
+import optparse, os, marshal, subprocess, shelve
 import tempfile, getopt, os.path, time, platform
 import re, shutil
 
diff --git a/git-remote-testgit.py b/git-remote-testgit.py
index 5f3ebd2..91faabd 100644
--- a/git-remote-testgit.py
+++ b/git-remote-testgit.py
@@ -31,6 +31,11 @@ from git_remote_helpers.git.exporter import GitExporter
 from git_remote_helpers.git.importer import GitImporter
 from git_remote_helpers.git.non_local import NonLocalGit
 
+if sys.hexversion < 0x01050200:
+    # os.makedirs() is the limiter
+    sys.stderr.write("git-remote-testgit: requires Python 1.5.2 or later.\n")
+    sys.exit(1)
+
 def get_repo(alias, url):
     """Returns a git repository object initialized for usage.
     """
diff --git a/git_remote_helpers/git/__init__.py b/git_remote_helpers/git/__init__.py
index e69de29..1dbb1b0 100644
--- a/git_remote_helpers/git/__init__.py
+++ b/git_remote_helpers/git/__init__.py
@@ -0,0 +1,5 @@
+import sys
+if sys.hexversion < 0x02040000:
+    # The limiter is the subprocess module
+    sys.stderr.write("git_remote_helpers: requires Python 2.4 or later.\n")
+    sys.exit(1)
-- 
1.8.1.rc2




-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

A ``decay in the social contract'' is detectable; there is a growing
feeling, particularly among middle-income taxpayers, that they are not
getting back, from society and government, their money's worth for
taxes paid. The tendency is for taxpayers to try to take more control
of their finances...	-- IRS Strategic Plan, (May 1984)

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-10-17 12:16 Marco Siegl | buerosiegl.com
  0 siblings, 0 replies; 206+ messages in thread
From: Marco Siegl | buerosiegl.com @ 2012-10-17 12:16 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-06-12 21:12 rohit sood
  0 siblings, 0 replies; 206+ messages in thread
From: rohit sood @ 2012-06-12 21:12 UTC (permalink / raw)
  To: git


Hi,
   When trying a remote install of the git client using winrm on a Windows 2003 box, I get the following error :

2012-06-12 14:59:05.476   Line 852: Creating symbolic link "E:\apps\prod\Git\libexec/git-core/git-whatchanged.exe" failed, will try a hard link.
2012-06-12 14:59:05.523   Line 852: Creating symbolic link "E:\apps\prod\Git\libexec/git-core/git-write-tree.exe" failed, will try a hard link.
2012-06-12 14:59:05.570   Line 852: Creating symbolic link "E:\apps\prod\Git\libexec/git-core/git.exe" failed, will try a hard link.
2012-06-12 14:59:05.679   Message box (OK):
                          Unable to configure the line ending conversion: core.autocrlf true

I use the Git-1.7.10-preview20120409.exe executable .
I am attempting to script an unattended silent install of the executable with the following options using Opscode Chef :

options "/DIR=\"#{node['GIT']['HOME']}\" /VERYSILENT /SUPPRESSMSGBOXES /LOG=\"#{ENV['TEMP']}\\GIT_INSTALL.LOG\""

Please advise

thanks,
Rohit

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-05-06 14:17 Bruce Zu
  0 siblings, 0 replies; 206+ messages in thread
From: Bruce Zu @ 2012-05-06 14:17 UTC (permalink / raw)
  To: git

I want subscribe this git mail list
thanks!
Bruce Zu

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-05-06 14:13 Bruce Zu
  0 siblings, 0 replies; 206+ messages in thread
From: Bruce Zu @ 2012-05-06 14:13 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-05-06 13:54 Bruce Zu
  0 siblings, 0 replies; 206+ messages in thread
From: Bruce Zu @ 2012-05-06 13:54 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-03-13 12:18 Adam Kicak
  0 siblings, 0 replies; 206+ messages in thread
From: Adam Kicak @ 2012-03-13 12:18 UTC (permalink / raw)
  To: git

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



[-- Attachment #2: CHANGELOG.txt --]
[-- Type: text/plain, Size: 617 bytes --]

DooPHP Framework Change Log
===========================

Version 1.4.1 February 22, 2011
---------------------------
- Chg: Improved DooMailer to support alternative content types ie. Plain Text + HTML in the same Email support for file attachments along with your emails content http://code.google.com/p/doophp/source/detail?r=606
- New: Added option for routes: autoroute_force_dash http://code.google.com/p/doophp/source/detail?r=605
- Bug: fixed loading wrong file when using internal reroute: return 404 or return array('/xxx', 'internal') in a module http://code.google.com/p/doophp/source/detail?r=603

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-02-15  3:12 Chris Leong
  0 siblings, 0 replies; 206+ messages in thread
From: Chris Leong @ 2012-02-15  3:12 UTC (permalink / raw)
  To: git

Apparently setting merge.conflictstyle to diff3 will display the base
when diffing an incomplete merge, instead of just ours and theirs.

Is there a way to run this command without setting the config, so that
I can switch between normal diffs and diff3s easily?

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-02-08  0:41 mstormo
  0 siblings, 0 replies; 206+ messages in thread
From: mstormo @ 2012-02-08  0:41 UTC (permalink / raw)
  To: nicedomain,
	3zrw4srakb-qiujkyozk-tuxkvremuumrk.iussyzuxsumsgor.ius, bounces,
	hotfix, 3je_lsrakb0qiujkyozk-tuxkvr4muumrk.iussyzuxsumsgor.ius,
	rapidrespond-k-f76139e66429a993, msysgit, git, lznuaa

[-- Attachment #1: HTML text --]
[-- Type: text/html, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
  2012-02-05 20:41 [PATCH] Change include order in two compat/ files to avoid compiler warning Junio C Hamano
@ 2012-02-05 22:32 ` Ben Walton
  0 siblings, 0 replies; 206+ messages in thread
From: Ben Walton @ 2012-02-05 22:32 UTC (permalink / raw)
  To: git, gitster

Hi Junio,

> > diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
> > index 60b5a1d..f1bf81c 100644
> > --- a/compat/inet_ntop.c
> > +++ b/compat/inet_ntop.c
> > @@ -15,11 +15,9 @@
> >   * SOFTWARE.
> >   */
> >
> > +#include "../git-compat-util.h"
> >  #include <errno.h>
> >  #include <sys/types.h>
> > -
> > -#include "../git-compat-util.h"
> > -
> >  #include <stdio.h>
> >  #include <string.h>
> 
> I actually have to wonder if any of these four inclusion of the
> system headers are warranted. Wouldn't they be included as part of
> git-compat-util.h anyway?

Yes, you're correct.  Dropping the system includes is correct as
opposed to rearranging the order.  Updated patch to follow.

Thanks
-Ben

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2012-01-10 23:56 Steven Line
  0 siblings, 0 replies; 206+ messages in thread
From: Steven Line @ 2012-01-10 23:56 UTC (permalink / raw)
  To: git

Hi All,

First off I am a new user to git, I'm not a git developer or power
user.  Am I in the right mailing list?  If not could somebody point me
where I could get some help from experienced git people?

Here's the problem:
I need some help getting my subversion repository cloned over to git.
Our svn repository has about 12,000 commits, when I run
git svn clone -s  -A authors.txt
svn+ssh://csvn@source.res.ourdomain.com/home/svn/sem sem
It runs for about 2h 15m then completes with no error messages. I have
also cloned starting at revision 6300, about the middle of the svn
repository, and I get the same results as below.

After cloning, I cd into the sem directory and run

$ git log
fatal: bad default revision 'HEAD'

$ git log --all  # this seems to work

$ git branch -a # shows only about half the branches that should have
been cloned

$ ls -al sem
total 6
drwxr-xr-x   3 git      other        512 Jan 10 20:58 ./
drwxr-xr-x   6 git      root         512 Jan 10 20:58 ../
drwxr-xr-x   9 git      other        512 Jan 10 23:13 .git/

I think this means the clone terminated prematurely but other than
that I'm stuck. There were no error messages from the clone.  Could
somebody give me some suggestions on what to try?  I haven't found the
answer via google yet.

Thank you for any help.

--
Steven Line
303-910-1212

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2011-11-10 22:56 Marcel Schaible
  0 siblings, 0 replies; 206+ messages in thread
From: Marcel Schaible @ 2011-11-10 22:56 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2011-11-02 16:38 Ben Walton
  0 siblings, 0 replies; 206+ messages in thread
From: Ben Walton @ 2011-11-02 16:38 UTC (permalink / raw)
  To: normalperson; +Cc: git

Hi Eric,

When running the test suite against subversion 1.7 on solaris, t9134
was failing with an assertion failure in the SVN bindings and a
subsequent core dump from perl.

The behaviour of 1.7 has seemingly changed such that even file paths
must be eascaped/canonicalized now.  The core dump behaviour is
something that still needs to be investigated with the subversion
folks.  A colleague and I will push that on their side.

See the initial discussion of this issue on the svn list here:
http://article.gmane.org/gmane.comp.version-control.subversion.devel/132227

With the following patch, the test suite once again passes.  I don't
know how it will behave against an older client though so maybe a
conditional check for the version of the bindings is still required?

Thanks
-Ben

From: Ben Walton <bwalton@artsci.utoronto.ca>
Subject: 
In-Reply-To: 

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2011-08-18  6:36 milki
  0 siblings, 0 replies; 206+ messages in thread
From: milki @ 2011-08-18  6:36 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2011-08-04 17:27 Hin-Tak Leung
  0 siblings, 0 replies; 206+ messages in thread
From: Hin-Tak Leung @ 2011-08-04 17:27 UTC (permalink / raw)
  To: Jeff King; +Cc: git, rene.scharfe

--- On Thu, 4/8/11, Jeff King <peff@peff.net> wrote:

> On Wed, Aug 03, 2011 at 11:17:59PM
> +0100, Hin-Tak Leung wrote:
> 
> > The summary of the problem is that, git-archive's
> "--format=tar"
> > option really write the pax format most of the time,
> and some
> > cross-platform archive extraction library (rather than
> the
> > all-powerful GNU tar) really does not think that's the
> tar format and
> > bail out.
> 
> Out of curiosity, what is the library? Putting pax headers
> into ustar
> format has been standardized in POSIX since 2001.

The R people wrote their own in the R language (and the person who responded to my post in that R-devel thread was possibly the one who wrote that part, I believe) - The main reason is probably cross-platform-ness and independence from other programming languages - they are gradually moving away from invoking system() (because they need to run on windows and they used to require many cygwin/mingw tools to build add-on packages).

The R code which does that, scan for certain patterns after seek() into the gunzip'ed stream after 512(?) bytes. It is in a file 
R/src/library/utils/R/tar.R under the source repository.

> That header contains useful information (the commit id from
> which the
> archive was generated). And there is a way to turn it off:
> give a tree
> id instead of a commit id. There is an example in the
> git-archive
> manpage that does exactly this already. Look for the
> example mentioning
> "pax header" here:
> 
>   http://www.kernel.org/pub/software/scm/git/docs/git-archive.html
> 
> It might be a bit more obvious to find if we actually had
> a
> --no-pax-header option, though.
> 
> -Peff
> 


I think I tried the tree example and the R code also didn't like it much... may be I'll give it another try.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2011-05-26  9:02 Nicole Hamilt
  0 siblings, 0 replies; 206+ messages in thread
From: Nicole Hamilt @ 2011-05-26  9:02 UTC (permalink / raw)
  To: git



Sent from my Verizon Wireless Phone

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2011-02-02 17:31 Kamol Siesan
  0 siblings, 0 replies; 206+ messages in thread
From: Kamol Siesan @ 2011-02-02 17:31 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-12-28 22:56 COCA COLA
  0 siblings, 0 replies; 206+ messages in thread
From: COCA COLA @ 2010-12-28 22:56 UTC (permalink / raw)


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

KINDLY DOWNLOAD ATTACHMENT AS YOUR EMAIL WAS SELECTED AND YOU HAVE WON ONE MILLION POUNDS

[-- Attachment #2: COCA COLA NOTIFICATION.doc --]
[-- Type: application/msword, Size: 42496 bytes --]

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-12-27  6:07 COCA COLA
  0 siblings, 0 replies; 206+ messages in thread
From: COCA COLA @ 2010-12-27  6:07 UTC (permalink / raw)


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

KINDLY DOWNLOAD ATTACHMENT AS YOUR EMAIL WAS SELECTED AND YOU HAVE WON ONE MILLION POUNDS

[-- Attachment #2: COCA COLA ONLINE NOTIFICATION.doc --]
[-- Type: application/msword, Size: 35328 bytes --]

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-09-20 16:37 Leonid Podolny
  0 siblings, 0 replies; 206+ messages in thread
From: Leonid Podolny @ 2010-09-20 16:37 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-09-17 18:39 Michael Scholl
  0 siblings, 0 replies; 206+ messages in thread
From: Michael Scholl @ 2010-09-17 18:39 UTC (permalink / raw)
  To: git


Gruß

Michael Scholl

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-05-07 21:46 Mr Chen Guan
  0 siblings, 0 replies; 206+ messages in thread
From: Mr Chen Guan @ 2010-05-07 21:46 UTC (permalink / raw)


Dear Friend,

I have a business proposal for you worth $17,300,000.00 usd,my suggestion
to you is that I will like you as a foreigner to stand as the next of kin
to Ali Hussein who is late as this will allow you to receive his
funds.Please reply to my private email for more Details
(chen_guan777@w.cn) Thank you for your time and

understanding.

Kind Regards,
Mr. Chen Guan.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-05-07 21:46 Mr Chen Guan
  0 siblings, 0 replies; 206+ messages in thread
From: Mr Chen Guan @ 2010-05-07 21:46 UTC (permalink / raw)


Dear Friend,

I have a business proposal for you worth $17,300,000.00 usd,my suggestion
to you is that I will like you as a foreigner to stand as the next of kin
to Ali Hussein who is late as this will allow you to receive his
funds.Please reply to my private email for more Details
(chen_guan777@w.cn) Thank you for your time and

understanding.

Kind Regards,
Mr. Chen Guan.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-05-07 21:46 Mr Chen Guan
  0 siblings, 0 replies; 206+ messages in thread
From: Mr Chen Guan @ 2010-05-07 21:46 UTC (permalink / raw)


Dear Friend,

I have a business proposal for you worth $17,300,000.00 usd,my suggestion
to you is that I will like you as a foreigner to stand as the next of kin
to Ali Hussein who is late as this will allow you to receive his
funds.Please reply to my private email for more Details
(chen_guan777@w.cn) Thank you for your time and

understanding.

Kind Regards,
Mr. Chen Guan.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2010-03-25  5:53 выгнать 
  0 siblings, 0 replies; 206+ messages in thread
From: выгнать  @ 2010-03-25  5:53 UTC (permalink / raw)
  To: git

<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
<git@vger.kernel.org>
       
Subject: =?windows-1251?B?c2VvIMPl7e3g5OjpIA==?=
Date: Thu, 25 Mar 2010 13:53:49 +0800
MIME-Version: 1.0
Content-type: multipart/related;
        boundary="----2041821469891566932053542755689759929457463"
X-Mailer: www
X-EsetId: 0039669958649988975065245497963992605779658



  ====================================================================
> Â Êèåâå, 26 èþíÿ, ïîêëîííèêè áîäèáèëäèíãà èìåþò âîçìîæíîñòü óâèäåòü, 
> ñ ãîñòåâûì ïîçèðîâàíèåì è îáó÷àþùèì êóðñîì, ñâîåãî êóìèðà, 
> âîñüìèêðàòíîãî ïîáåäèòåëÿ òóðíèðà "Ìèñòåð Îëèìïèÿ" Ðîííè Êîëåìàíà.
  ====================================================================

>                             +38 044 223 -53-45
 
  Ðîííè Êîëåìàí - ïîëèöåéñêèé Àðëèíãòîíà, ñòàë îáëàäàòåëåì ñàìîãî 
  ïðåñòèæíîãî òèòóëà â ìèðå áîäèáèëäèíãà - "Ìèñòåð Îëèìïèÿ"  
  è óäåðæèâàë ïåðâåíñòâî ñ 1998ã. äî 2005 ãîäà. Ðîííè îáñòàâèë âñåõ 
  íàñëåäíèêîâ Äîðèàíà ßòñà - îò Íàññåðà Ýëü - Ñàíáàòòè äî Ôëåêñà 
  Óèëëåðà, è ïðåäøåñòâîâàëè ýòîìó äîëãèå äâàäöàòü ëåò òÿæåëîãî êóðñà.

  Ñ óâåðåííîñòüþ ìîæíî ñêàçàòü îäíî: ñ óõîäîì âåëèêîãî ßòñà "Îëèìïèÿ" 
  ïðèîáðåëà âåëèêîëåïíîãî ëèäåðà - Ðîííè Êîëåìàíà .Âû ìîæåòå óâèäåòü è 
  óñëûøàòü  æèâóþ ëåãåíäó ìèðîâîãî áîäèáèëäèíãà ,çàäàòü åìó èíòåðåñóþùèé 
  Âàñ âîïðîñ , ñôîòîãðàôèðîâàòüñÿ, óçíàòü âñå î ïîñòðîåíèè òðåíèðîâî÷íûõ
  ïðîãðàìì è äèåò.

> Ïðîãðàììà

  1. Ïîêàçàòåëüíîå âûñòóïëåíèå Ðîííè Êîëåìàíà.

  1.1 Âûñòóïëåíèå ñèëîâûõ àðòèñòîâ Óêðàèíû

  2. Áèîãðàôèÿ.

  2.1. Çíàêîìñòâî ñ òðåíàæåðíûì çàëîì.

  2.2. Ñîðåâíîâàòåëüíûé áîäèáèëäèíã.

  2.3. Ðàáîòà è ëè÷íàÿ æèçíü.

  3. Kypc.

  3.1. Òðåíèðîâî÷íûå  öèêëû àìåðèêàíñêèõ  ïðîôåññèîíàëîâ.

  3.2. Ïðàâèëüíàÿ òåõíèêà âûïîëíåíèÿ  óïðàæíåíèé.

  3.3. Ñåêðåòû àìåðèêàíñêèõ ïðîôåññèîíàëîâ ðàáîòû íà ìàññó.

  3.4. Ìåòîäèêà âîñüìèêðàòíîãî Ìèñòåðà Îëèìïèÿ ïðè ðàáîòå íà ðåëüåô.

  3.5. Ïðàâèëüíîñòü êàðäèî òðåíèðîâîê â íåäåëüíîì öèêëå.

  3.6. Ïðàâèëüíîñòü âûïîëíåíèå óïðàæíåíèé íà áëîêàõ. Áëîêè. Çà÷åì îíè íóæíû?

  3.7. Çíà÷åíèå ñèëû â òðåíèðîâî÷íîì ïðîöåññå. Êàê ïîäíÿòü ñèëîâûå ïîêàçàòåëè, ïî ñîâåòó Ìð.Îëèìïèÿ?

  3.8. Ñàìûå ýôôåêòèâíûå áàçîâûå óïðàæíåíèÿ.

  3.9. Ðåâîëþöèîííûé ìåòîä ïî ïîäõîäó ê òðåíèíãó ãðóäè è ðóê, ïî ìåòîäèêå Ðîííè Êîëåìàíà.

  3.10. Ïðåîäîëåíèå çàñòîÿ â òðåíèíãå.

  4. Ïèòàíèå.

  1.1 Ïèòàíèå íà ìàññó.

  1.2. Ïðàâèëüíûé ïîäñ÷åò êàëîðèé äëÿ íàáîðà ìàññû áåç æèðà( ñåêðåòû àìåðèêàíñêèõ ïðîôåññèîíàëîâ).

  1.3. Ñåêðåòíîå ñîîòíîøåíèå áåëêîâ, æèðîâ è óãëåâîäîâ äëÿ âñåõ òèïîâ òåëîñëîæåíèé.

  1.4. Ñîâåòû ïî âûáîðó íóæíûõ ïðîäóêòîâ è ïðàâèëüíîñòü èõ ïðèãîòîâëåíèÿ.

  1.5. Íóæíûå ñïîðòèâíûå äîáàâêè ïðè ðàáîòå íà ìàññó.

  2.1 Ïèòàíèå íà ðåëüåô.

  2.2. Óçíàé ñåêðåòû ïðàâèëüíîé äèåòû ïðè òðåíèðîâêàõ íà ðåëüåô. (×òîáû íå òåðÿòü ìûøå÷íóþ ìàññó).

  2.3. Ïðàâèëüíûé âûáîð ñïîðòèâíûõ äîáàâîê ïðè ðàáîòå íà ðåëüåô.

  2.4. Ìèôû è ïðàâäà î äèåòàõ.(ïðè ðàáîòå íà ìàññó è íà ðåëüåô).

  2.5. Ðîëü âîäû â äèåòå.

  5. Ïðèäè è ñôîòîãðàôèðóéñÿ ñ âîñüìèêðàòíûì Ìèñòåðîì Îëèìïèÿ, Ðîííè Êîëåìàíîì.

  6. Ìèôû ïðî áîäèáèëäèíã.

  7. Ñåêðåòû çàêóëèñíîãî áîäèáèëäèíãà. (äðóçüÿ ,ñïëåòíè, èíòåðåñíûå èñòîðèè èç æèçíè àìåðèêàíñêèõ ïðîôåññèîíàëîâ).

  8. Êàê áîäèáèëäèíã ïîìîãàåò â îáû÷íîé æèçíè?

  9. Ïðèäè è óçíàé, ïî÷åìó àìåðèêàíñêèå êóëüòóðèñòû áîëåå ìàññèâíûå è ðåëüåôíûå ÷åì îòå÷åñòâåííûå? Ñåêðåòû.

  10. Âíèìàíèå. Äëÿ èíñòðóêòîðîâ òðåíàæåðíûõ çàëîâ .

  10.1. Îáó÷àþùàÿ ïðîãðàììà äëÿ èíñòðóêòîðîâ  òðåíàæåðíûõ çàëîâ.

  10.2. Ïîñëå ïîñåùåíèå îáó÷àþùåãî  êóðñà, èíñòðóêòîðîì  òðåíàæåðíîãî çàëà, êîëè÷åñòâî êëèåíòîâ Âàøåãî çàëà  óâåëè÷èòñÿ, ïîòîìó ÷òî òðåíåð óçíàåò âñå ñåêðåòû âîñüìèêðàòíîãî Ìèñòåðà Îëèìïèÿ è ïðîôåññèîíàëîâ ÑØÀ. Èíôîðìàöèþ êîòîðóþ ïîëó÷èò òðåíåð ,áóäåò î÷åíü èíòåðåñíà è ïîëåçíà âñåì êëèåíòàì òðåíàæåðíûõ çàëîâ. À òàêæå èíñòðóêòîð  ïîëó÷èòü äèïëîì  è ôîòîãðàôèþ ñ Ðîííè Êîëåìàíîì,  êîòîðûìè  òðåíåð ìîæåò óêðàñèò  ïî÷åòíóþ ñòåíó  ñâîåãî òðåíàæåðíîãî çàëà.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-03-19 21:12 Michael Cox
  0 siblings, 0 replies; 206+ messages in thread
From: Michael Cox @ 2010-03-19 21:12 UTC (permalink / raw)
  To: git

unsubscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2010-03-08 21:56 Timur Aydin
  0 siblings, 0 replies; 206+ messages in thread
From: Timur Aydin @ 2010-03-08 21:56 UTC (permalink / raw)
  To: git

unsubscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-02-25  5:55 yingshou guo
  0 siblings, 0 replies; 206+ messages in thread
From: yingshou guo @ 2010-02-25  5:55 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2010-01-22  2:14 Horst H. von Brand
  0 siblings, 0 replies; 206+ messages in thread
From: Horst H. von Brand @ 2010-01-22  2:14 UTC (permalink / raw)
  To: git; +Cc: gitster

A bunch of random spelling (and similar) fixes to Documentation/*

Stuff like trying to use SHA-1, UTF-8, ASCII (case and spelling) more
consistently

Use HTTP and HTTPS, etc (uppercase) where it refers to the protocol

A few real spelling fixes
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile 2340000       Fax:  +56 32 2797513

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-09-12 13:00 Tito
  0 siblings, 0 replies; 206+ messages in thread
From: Tito @ 2009-09-12 13:00 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
  2009-07-24 23:39       ` Junio C Hamano
@ 2009-07-25  0:28         ` Nanako Shiraishi
  0 siblings, 0 replies; 206+ messages in thread
From: Nanako Shiraishi @ 2009-07-25  0:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Alex Vandiver, git, Johannes Schindelin

Subject: [PATCH] Documentation/config.txt: a variable can be defined on the section header line

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---

 Quoting Junio C Hamano <gitster@pobox.com>:

 > Nanako Shiraishi <nanako3@lavabit.com> writes:
 >
 >> Isn't this a syntax error?
 >>
 >> Documentation/config.txt says this.
 >
 > Even if it were, I think it would be nice to allow it.  I'll have to
 > re-read Alex's patch, but I thought it was sane.  Perhaps we can update
 > the documentation, mildly hinting that it is allowed without encouraging
 > it too strongly, as I think it is a good style to have these on separate
 > lines.
 
 How about this small update to the documentation, then?

 Documentation/config.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 6857d2f..c6f09f8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -49,7 +49,8 @@ There is also a case insensitive alternative `[section.subsection]` syntax.
 In this syntax, subsection names follow the same restrictions as for section
 names.
 
-All the other lines are recognized as setting variables, in the form
+All the other lines (and the remainder of the line after the section
+header) are recognized as setting variables, in the form
 'name = value'.  If there is no equal sign on the line, the entire line
 is taken as 'name' and the variable is recognized as boolean "true".
 The variable names are case-insensitive and only alphanumeric

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-07-16 19:22 Henrik Austad
  0 siblings, 0 replies; 206+ messages in thread
From: Henrik Austad @ 2009-07-16 19:22 UTC (permalink / raw)
  To: git

subscibe git
-- 
     henrik

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-06-23  1:07 Larry D'Anna
  0 siblings, 0 replies; 206+ messages in thread
From: Larry D'Anna @ 2009-06-23  1:07 UTC (permalink / raw)
  To: git

>From 1efb13a16b86b0e7d4735b583cf8d90bd74728fb Mon Sep 17 00:00:00 2001
In-Reply-To: <20090622214032.GC19364@coredump.intra.peff.net>
References: <20090622214032.GC19364@coredump.intra.peff.net>
From: Larry D'Anna <larry@elder-gods.org>
Date: Mon, 22 Jun 2009 21:02:55 -0400
Subject: [PATCH] add --porcelain option to git-push

If --porcelain is used git-push will produce machine-readable output.  The
output status line for each ref will be tab-separated and sent to stdout instead
of stderr.  The full symbolic names of the refs will be given.  For example

$ git push --dry-run --porcelain master :foobar 2>/dev/null \
  | perl -pe 's/\t/ TAB /g'

= TAB refs/heads/master:refs/heads/master TAB [up to date]
- TAB :refs/heads/foobar TAB [deleted]
---
 Documentation/git-push.txt |   11 ++++++
 builtin-push.c             |    3 +-
 transport.c                |   75 +++++++++++++++++++++++++------------------
 transport.h                |    1 +
 4 files changed, 58 insertions(+), 32 deletions(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index fd53c49..2653388 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -85,6 +85,11 @@ nor in any Push line of the corresponding remotes file---see below).
 --dry-run::
 	Do everything except actually send the updates.
 
+--porcelain::
+	Produce machine-readable output.  The output status line for each ref
+	will be tab-separated and sent to stdout instead of stderr.  The full
+	symbolic names of the refs will be given.
+
 --tags::
 	All refs under `$GIT_DIR/refs/tags` are pushed, in
 	addition to refspecs explicitly listed on the command
@@ -148,6 +153,12 @@ representing the status of a single ref. Each line is of the form:
  <flag> <summary> <from> -> <to> (<reason>)
 -------------------------------
 
+If --porcelain is used, then each line of the output is of the form:
+
+-------------------------------
+ <flag> \t <from>:<to> \t <summary> (<reason>)
+-------------------------------
+
 flag::
 	A single character indicating the status of the ref. This is
 	blank for a successfully pushed ref, `!` for a ref that was
diff --git a/builtin-push.c b/builtin-push.c
index 7be1239..0a0297f 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -10,7 +10,7 @@
 #include "parse-options.h"
 
 static const char * const push_usage[] = {
-	"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
+	"git push [--all | --mirror] [--dry-run] [--porcelain] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
 	NULL,
 };
 
@@ -200,6 +200,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 			    (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
 		OPT_BOOLEAN( 0 , "tags", &tags, "push tags"),
 		OPT_BIT( 0 , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
+		OPT_BIT( 0,  "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN),
 		OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE),
 		OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),
 		OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", "receive pack program"),
diff --git a/transport.c b/transport.c
index 501a77b..b074067 100644
--- a/transport.c
+++ b/transport.c
@@ -719,19 +719,30 @@ static void update_tracking_ref(struct remote *remote, struct ref *ref, int verb
 
 #define SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
 
-static void print_ref_status(char flag, const char *summary, struct ref *to, struct ref *from, const char *msg)
+static void print_ref_status(char flag, const char *summary, struct ref *to, struct ref *from, const char *msg, int porcelain)
 {
-	fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
-	if (from)
-		fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
-	else
-		fputs(prettify_refname(to->name), stderr);
-	if (msg) {
-		fputs(" (", stderr);
-		fputs(msg, stderr);
-		fputc(')', stderr);
+	if (porcelain) {
+		if (from)
+			fprintf(stdout, "%c\t%s:%s\t", flag, from->name, to->name);
+		else
+			fprintf(stdout, "%c\t:%s\t", flag, to->name);
+		if (msg)
+			fprintf(stdout, "%s (%s)\n", summary, msg);
+		else
+			fprintf(stdout, "%s\n", summary);
+	} else {
+		fprintf(stderr, " %c %-*s ", flag, SUMMARY_WIDTH, summary);
+		if (from)
+			fprintf(stderr, "%s -> %s", prettify_refname(from->name), prettify_refname(to->name));
+		else
+			fputs(prettify_refname(to->name), stderr);
+		if (msg) {
+			fputs(" (", stderr);
+			fputs(msg, stderr);
+			fputc(')', stderr);
+		}
+		fputc('\n', stderr);
 	}
-	fputc('\n', stderr);
 }
 
 static const char *status_abbrev(unsigned char sha1[20])
@@ -739,15 +750,15 @@ static const char *status_abbrev(unsigned char sha1[20])
 	return find_unique_abbrev(sha1, DEFAULT_ABBREV);
 }
 
-static void print_ok_ref_status(struct ref *ref)
+static void print_ok_ref_status(struct ref *ref, int porcelain)
 {
 	if (ref->deletion)
-		print_ref_status('-', "[deleted]", ref, NULL, NULL);
+		print_ref_status('-', "[deleted]", ref, NULL, NULL, porcelain);
 	else if (is_null_sha1(ref->old_sha1))
 		print_ref_status('*',
 			(!prefixcmp(ref->name, "refs/tags/") ? "[new tag]" :
-			  "[new branch]"),
-			ref, ref->peer_ref, NULL);
+			"[new branch]"),
+			ref, ref->peer_ref, NULL, porcelain);
 	else {
 		char quickref[84];
 		char type;
@@ -765,50 +776,51 @@ static void print_ok_ref_status(struct ref *ref)
 		}
 		strcat(quickref, status_abbrev(ref->new_sha1));
 
-		print_ref_status(type, quickref, ref, ref->peer_ref, msg);
+		print_ref_status(type, quickref, ref, ref->peer_ref, msg, porcelain);
 	}
 }
 
-static int print_one_push_status(struct ref *ref, const char *dest, int count)
+static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)
 {
 	if (!count)
 		fprintf(stderr, "To %s\n", dest);
 
 	switch(ref->status) {
 	case REF_STATUS_NONE:
-		print_ref_status('X', "[no match]", ref, NULL, NULL);
+		print_ref_status('X', "[no match]", ref, NULL, NULL, porcelain);
 		break;
 	case REF_STATUS_REJECT_NODELETE:
 		print_ref_status('!', "[rejected]", ref, NULL,
-				"remote does not support deleting refs");
+						 "remote does not support deleting refs", porcelain);
 		break;
 	case REF_STATUS_UPTODATE:
 		print_ref_status('=', "[up to date]", ref,
-				ref->peer_ref, NULL);
+						 ref->peer_ref, NULL, porcelain);
 		break;
 	case REF_STATUS_REJECT_NONFASTFORWARD:
 		print_ref_status('!', "[rejected]", ref, ref->peer_ref,
-				"non-fast forward");
+						 "non-fast forward", porcelain);
 		break;
 	case REF_STATUS_REMOTE_REJECT:
 		print_ref_status('!', "[remote rejected]", ref,
-				ref->deletion ? NULL : ref->peer_ref,
-				ref->remote_status);
+						 ref->deletion ? NULL : ref->peer_ref,
+						 ref->remote_status, porcelain);
 		break;
 	case REF_STATUS_EXPECTING_REPORT:
 		print_ref_status('!', "[remote failure]", ref,
-				ref->deletion ? NULL : ref->peer_ref,
-				"remote failed to report status");
+						 ref->deletion ? NULL : ref->peer_ref,
+						 "remote failed to report status", porcelain);
 		break;
 	case REF_STATUS_OK:
-		print_ok_ref_status(ref);
+		print_ok_ref_status(ref, porcelain);
 		break;
 	}
 
 	return 1;
 }
 
-static void print_push_status(const char *dest, struct ref *refs, int verbose)
+static void print_push_status(const char *dest, struct ref *refs,
+							  int verbose, int porcelain)
 {
 	struct ref *ref;
 	int n = 0;
@@ -816,18 +828,18 @@ static void print_push_status(const char *dest, struct ref *refs, int verbose)
 	if (verbose) {
 		for (ref = refs; ref; ref = ref->next)
 			if (ref->status == REF_STATUS_UPTODATE)
-				n += print_one_push_status(ref, dest, n);
+				n += print_one_push_status(ref, dest, n, porcelain);
 	}
 
 	for (ref = refs; ref; ref = ref->next)
 		if (ref->status == REF_STATUS_OK)
-			n += print_one_push_status(ref, dest, n);
+			n += print_one_push_status(ref, dest, n, porcelain);
 
 	for (ref = refs; ref; ref = ref->next) {
 		if (ref->status != REF_STATUS_NONE &&
 		    ref->status != REF_STATUS_UPTODATE &&
 		    ref->status != REF_STATUS_OK)
-			n += print_one_push_status(ref, dest, n);
+			n += print_one_push_status(ref, dest, n, porcelain);
 	}
 }
 
@@ -997,6 +1009,7 @@ int transport_push(struct transport *transport,
 		struct ref *local_refs = get_local_heads();
 		int match_flags = MATCH_REFS_NONE;
 		int verbose = flags & TRANSPORT_PUSH_VERBOSE;
+		int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
 		int ret;
 
 		if (flags & TRANSPORT_PUSH_ALL)
@@ -1011,7 +1024,7 @@ int transport_push(struct transport *transport,
 
 		ret = transport->push_refs(transport, remote_refs, flags);
 
-		print_push_status(transport->url, remote_refs, verbose);
+		print_push_status(transport->url, remote_refs, verbose | porcelain, porcelain);
 
 		if (!(flags & TRANSPORT_PUSH_DRY_RUN)) {
 			struct ref *ref;
diff --git a/transport.h b/transport.h
index 27bfc52..51b5397 100644
--- a/transport.h
+++ b/transport.h
@@ -35,6 +35,7 @@ struct transport {
 #define TRANSPORT_PUSH_DRY_RUN 4
 #define TRANSPORT_PUSH_MIRROR 8
 #define TRANSPORT_PUSH_VERBOSE 16
+#define TRANSPORT_PUSH_PORCELAIN 32
 
 /* Returns a transport suitable for the url */
 struct transport *transport_get(struct remote *, const char *);
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-05-27 13:28 David Forman
  0 siblings, 0 replies; 206+ messages in thread
From: David Forman @ 2009-05-27 13:28 UTC (permalink / raw)
  To: git

I've encountered the following whenever I access Git and try to compress the
database due to loose objects.

error: cannot lock ref 'HEAD~'
error: cannot lock ref 'refs/heads/collections~'
error: cannot lock ref 'refs/heads/master~'

I'm on a Windows box (no comments please!), I've tried gc from the command
line, as well as the GUI option, with the same results. Any help would be
greatly appreciated, last count was over 2000 loose objects.

Thanks,

David Forman
Systems Manager
dairyfood USA, Inc.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-05-13  5:11 Tom H
  0 siblings, 0 replies; 206+ messages in thread
From: Tom H @ 2009-05-13  5:11 UTC (permalink / raw)
  To: git



^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Fri, 1 May 2009 15:32:18 -0400
Subject: [PATCH 0/6] Add core.autocrlf=true on cygwin by default during tests

This is a patch set to do the work from mail message:

http://kerneltrap.org/mailarchive/git/2007/8/7/254415

It is split into 6 parts.  This is because the tests do not work on
Linux if autocrlf=true.

1) The change to autocrlf=true by default for cygwin

2) Changes to t/test-lib.sh

3) The simple changes to tests to use the new functions.

4) Force core.autocrlf=false tests

5) The changes that switch from using cmp to using test_cmp.

6) Add 'make test-text' to use these changes

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From d60f6f2fdfcdc5cbbd468992ccbc56438fe0e149 Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Mon, 11 May 2009 12:16:55 -0400
Subject: [PATCH 4/6] Fix tests to work with core.autocrlf=true

Force core.autocrlf=false for these tests.  Most of these tests are checking
for whitespace differences and so are not simple to fix.  The rest are not
clear how to fix.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t1002-read-tree-m-u-2way.sh |    3 ++-
 t/t4015-diff-whitespace.sh    |    2 ++
 t/t4019-diff-wserror.sh       |    1 +
 t/t4116-apply-reverse.sh      |    1 +
 t/t4200-rerere.sh             |    2 ++
 5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index 5e40cec..acc9474 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -37,7 +37,8 @@ check_cache_at () {
 
 test_expect_success \
     setup \
-    'echo frotz >frotz &&
+    'git config core.autocrlf false &&
+     echo frotz >frotz &&
      echo nitfol >nitfol &&
      echo bozbar >bozbar &&
      echo rezrov >rezrov &&
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 6d13da3..122557e 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -9,6 +9,8 @@ test_description='Test special whitespace in diff engine.
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/diff-lib.sh
 
+test_expect_success "setup" 'git config core.autocrlf false'
+
 # Ray Lehtiniemi's example
 
 cat << EOF > x
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 84a1fe3..a580403 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -6,6 +6,7 @@ test_description='diff whitespace error detection'
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	git config diff.color.whitespace "blue reverse" &&
 	>F &&
 	git add F &&
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index 2298ece..a846be6 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -11,6 +11,7 @@ test_description='git apply in reverse
 
 test_expect_success setup '
 
+	git config core.autocrlf false &&
 	for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
 	perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 &&
 
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index a6bc028..5e6cc82 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -8,6 +8,8 @@ test_description='git rerere
 
 . ./test-lib.sh
 
+git config core.autocrlf false
+
 cat > a1 << EOF
 Some title
 ==========
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From 96f9b68bba7ad2ec2c9623709b417f27c2831790 Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Fri, 1 May 2009 15:32:18 -0400
Subject: [PATCH 1/6] Add core.autocrlf=true on cygwin by default during tests

It can be disabled or enabled by using the GIT_TEST_AUTO_CRLF environment
variable.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index dad1437..218bd82 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -119,6 +119,17 @@ do
 	esac
 done
 
+# Switch to core.autolf = true on cygwin but only by default
+case $(uname -s) in
+*CYGWIN*)
+	GIT_TEST_AUTO_CRLF=${GIT_TEST_AUTO_CRLF:-true}
+	test "$debug" = "" ||
+	echo "Test in mode" $(cygpath --mode . | cut -d: -f2-) "mount"
+	;;
+*)
+	;;
+esac
+
 if test -n "$color"; then
 	say_color () {
 		(
@@ -493,6 +504,11 @@ test_create_repo () {
 	cd "$repo" || error "Cannot setup test environment"
 	"$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
+	test ! -z "$GIT_TEST_AUTO_CRLF" &&
+	test_debug "echo Switching to autocrlf=$GIT_TEST_AUTO_CRLF" && {
+		git config core.autocrlf $GIT_TEST_AUTO_CRLF ||
+		error "Failed to switch to autocrlf=$GIT_TEST_AUTO_CRLF"
+	}
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
 }
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From 3f0280a44185d1c7f6b653988bc0b46d239cdd17 Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Mon, 11 May 2009 11:48:54 -0400
Subject: [PATCH 2/6] Fix tests to work with core.autocrlf=true

test-lib changes.

Run the tests via:

  GIT_TEST_AUTO_CRLF=true make test

Change the default value of GIT_TEST_CMP to ignore whitespace changes
when core.autocrlf=true

Add support functions: test_external_with_only_warning, test_eq_cat,
test_cat_eq, and test_ne_cat all of which will ignore CR if it is in
the file.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/test-lib.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 218bd82..84846cd 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -59,7 +59,6 @@ export GIT_MERGE_VERBOSITY
 export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
 export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
 export EDITOR VISUAL
-GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
 
 # Protect ourselves from common misconfiguration to export
 # CDPATH into the environment
@@ -129,6 +128,11 @@ case $(uname -s) in
 *)
 	;;
 esac
+if test ! -z $GIT_TEST_AUTO_CRLF && test $GIT_TEST_AUTO_CRLF = true; then
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -uw}
+else
+	GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+fi
 
 if test -n "$color"; then
 	say_color () {
@@ -459,6 +463,35 @@ test_external_without_stderr () {
 	fi
 }
 
+# Like test_external, but in addition tests that the command generated
+# only "warning: LF will be replaced by CRLF" output on stderr.
+test_external_with_only_warning () {
+	# The temporary file has no (and must have no) security
+	# implications.
+	tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
+	stderr="$tmp/git-external-stderr.$$.tmp"
+	test_external "$@" 4> "$stderr"
+	[ -f "$stderr" ] || error "Internal error: $stderr disappeared."
+	descr="only warning: $1"
+	shift
+	say >&3 "expecting only warnings from previous command"
+	output=$(grep -v "warning: LF will be replaced by CRLF in" $stderr)
+	test_debug "echo non-warning: $output"
+	if [ -z "$output" ]; then
+		rm "$stderr"
+		test_ok_ "$descr"
+	else
+		if [ "$verbose" = t ]; then
+			output=`echo; echo Stderr is:; cat "$stderr"`
+		else
+			output=
+		fi
+		# rm first in case test_failure exits.
+		rm "$stderr"
+		test_failure_ "$descr" "$@" "$output"
+	fi
+}
+
 # This is not among top-level (test_expect_success | test_expect_failure)
 # but is a prefix that can be used in the test script, like:
 #
@@ -493,6 +526,30 @@ test_cmp() {
 	$GIT_TEST_CMP "$@"
 }
 
+# test_eq_cat is a helper function to compare a 1 word file
+# with a string.
+# It almost the same as: test foo = $(cat bar)
+# for: test_eq_cat foo bar
+#
+# However it works when core.autocrlf = true.
+
+test_eq_cat() {
+	test "$1" = "$(tr '\015' '\012' < "$2")"
+}
+
+# the but not-equal -- may not catch all cases
+
+test_ne_cat() {
+	test "$1" != "$(tr '\015' '\012' < "$2")"
+}
+
+# the same as test_eq_cat, but file is 1st.
+
+test_cat_eq() {
+	test "$(tr '\015' '\012' < "$1")" = "$2"
+}
+
+
 # Most tests can use the created repository, but some may need to create more.
 # Usage: test_create_repo <directory>
 test_create_repo () {
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From 49878211a2f7f907a59b2b0289685e9e68585be9 Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Mon, 11 May 2009 12:29:00 -0400
Subject: [PATCH 6/6] Add 'make test-text'

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 Makefile |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 6e21643..03176a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1482,6 +1482,16 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
+test-text: all
+ifeq ($(uname_O),Cygwin)
+	@echo Test text mode mount
+	mount -f -u -t $(shell sh -c 'cygpath -m -a t') $(shell sh -c 'cygpath -u -a t')
+	$(MAKE) -C t/ all
+	umount -u $(shell sh -c 'cygpath -u -a t')
+else
+	GIT_TEST_AUTO_CRLF=$${GIT_TEST_AUTO_CRLF:-true} $(MAKE) -C t/ all
+endif
+
 test-ctype$X: ctype.o
 
 test-date$X: date.o ctype.o
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From c03250cd23864b53986708070cf6d03f4334475d Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Mon, 11 May 2009 12:19:37 -0400
Subject: [PATCH 5/6] Fix tests to work with core.autocrlf=true

Switch from using cmp to using test_cmp in these tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0021-conversion.sh        |   12 ++++++------
 t/t1020-subdirectory.sh      |   12 ++++++------
 t/t4127-apply-same-fn.sh     |    2 +-
 t/t6021-merge-criss-cross.sh |    2 +-
 t/t6026-merge-attr.sh        |   10 +++++-----
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 8fc39d7..7a6d8c7 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -33,17 +33,17 @@ test_expect_success setup '
 	git checkout -- test test.t test.i
 '
 
-script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
-
 test_expect_success check '
 
-	cmp test.o test &&
-	cmp test.o test.t &&
+	test_cmp test.o test &&
+	test_cmp test.o test.t &&
 
 	# ident should be stripped in the repository
 	git diff --raw --exit-code :test :test.i &&
 	id=$(git rev-parse --verify :test) &&
-	embedded=$(sed -ne "$script" test.i) &&
+	test_debug "echo id=$id"
+	embedded=$(grep Id: test.i | cut -d\  -f2) &&
+	test_debug "echo embedded=$embedded"
 	test "z$id" = "z$embedded" &&
 
 	git cat-file blob :test.t > test.r &&
@@ -85,7 +85,7 @@ test_expect_success expanded_in_repo '
 	rm -f expanded-keywords &&
 	git checkout -- expanded-keywords &&
 	cat expanded-keywords &&
-	cmp expanded-keywords expected-output
+	test_cmp expanded-keywords expected-output
 '
 
 test_done
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 210e594..ce67e6c 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -86,10 +86,10 @@ test_expect_success 'write-tree' '
 test_expect_success 'checkout-index' '
 	cd "$HERE" &&
 	git checkout-index -f -u one &&
-	cmp one original.one &&
+	test_cmp one original.one &&
 	cd dir &&
 	git checkout-index -f -u two &&
-	cmp two ../original.two
+	test_cmp two ../original.two
 '
 
 test_expect_success 'read-tree' '
@@ -97,13 +97,13 @@ test_expect_success 'read-tree' '
 	rm -f one dir/two &&
 	tree=`git write-tree` &&
 	git read-tree --reset -u "$tree" &&
-	cmp one original.one &&
-	cmp dir/two original.two &&
+	test_cmp one original.one &&
+	test_cmp dir/two original.two &&
 	cd dir &&
 	rm -f two &&
 	git read-tree --reset -u "$tree" &&
-	cmp two ../original.two &&
-	cmp ../one ../original.one
+	test_cmp two ../original.two &&
+	test_cmp ../one ../original.one
 '
 
 test_expect_success 'no file/rev ambiguity check inside .git' '
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index 3a8202e..66b774f 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
 	cp same_fn same_fn2 &&
 	git reset --hard &&
 	git apply patch0 &&
-	diff same_fn same_fn2
+	test_cmp same_fn same_fn2
 '
 
 test_expect_success 'apply same filename with overlapping changes' '
diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh
index 331b9b0..53fdfd8 100755
--- a/t/t6021-merge-criss-cross.sh
+++ b/t/t6021-merge-criss-cross.sh
@@ -87,7 +87,7 @@ cat > file-expect <<EOF
 9
 EOF
 
-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
+test_expect_success 'Criss-cross merge result' 'test_cmp file file-expect'
 
 test_expect_success 'Criss-cross merge fails (-s resolve)' \
 'git reset --hard A^ &&
diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
index 1ba0a25..0b57c68 100755
--- a/t/t6026-merge-attr.sh
+++ b/t/t6026-merge-attr.sh
@@ -63,7 +63,7 @@ test_expect_success 'check merge result in working tree' '
 
 	git cat-file -p HEAD:binary >binary-orig &&
 	grep "<<<<<<<" text &&
-	cmp binary-orig binary &&
+	test_cmp binary-orig binary &&
 	! grep "<<<<<<<" union &&
 	grep Master union &&
 	grep Side union
@@ -104,14 +104,14 @@ test_expect_success 'custom merge backend' '
 
 	git merge master &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file side^:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
@@ -131,14 +131,14 @@ test_expect_success 'custom merge backend' '
 		echo "Ok, conflicted"
 	fi &&
 
-	cmp binary union &&
+	test_cmp binary union &&
 	sed -e 1,3d text >check-1 &&
 	o=$(git unpack-file master^:text) &&
 	a=$(git unpack-file anchor:text) &&
 	b=$(git unpack-file master:text) &&
 	sh -c "./custom-merge $o $a $b 0" &&
 	sed -e 1,3d $a >check-2 &&
-	cmp check-1 check-2 &&
+	test_cmp check-1 check-2 &&
 	rm -f $o $a $b
 '
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-05-11 18:57 Don Slutz
  0 siblings, 0 replies; 206+ messages in thread
From: Don Slutz @ 2009-05-11 18:57 UTC (permalink / raw)
  To: git

>From 96607bf6ffca78c88278e206ed40dce3abc1d4d9 Mon Sep 17 00:00:00 2001
From: Don Slutz <Don.Slutz@SierraAtlantic.com>
Date: Mon, 11 May 2009 11:58:32 -0400
Subject: [PATCH 3/6] Fix tests to work with core.autocrlf=true

Use the new functions to fix tests.

Signed-off-by: Don Slutz <Don.Slutz@SierraAtlantic.com>
---
 t/t0002-gitfile.sh                        |    3 +-
 t/t2004-checkout-cache-temp.sh            |   42 ++++++++++++++--------------
 t/t2008-checkout-subdir.sh                |   14 +++++-----
 t/t3404-rebase-interactive.sh             |    2 +-
 t/t3410-rebase-preserve-dropped-merges.sh |   12 ++++----
 t/t3413-rebase-hook.sh                    |   32 +++++++++++-----------
 t/t3503-cherry-pick-root.sh               |    2 +-
 t/t3903-stash.sh                          |   12 ++++----
 t/t4102-apply-rename.sh                   |    5 ++-
 t/t4124-apply-ws-rule.sh                  |   23 ++++++++++++---
 t/t4125-apply-ws-fuzz.sh                  |    9 +++++-
 t/t4128-apply-root.sh                     |    8 +++---
 t/t4150-am.sh                             |    4 +-
 t/t4252-am-options.sh                     |   16 ++++++++---
 t/t5000-tar-tree.sh                       |   12 +++++---
 t/t5001-archive-attr.sh                   |    3 ++
 t/t5520-pull.sh                           |   12 ++++----
 t/t7003-filter-branch.sh                  |    4 +-
 t/t7201-co.sh                             |    2 +-
 t/t7402-submodule-rebase.sh               |    4 +-
 t/t7610-mergetool.sh                      |    6 ++--
 t/t7800-difftool.sh                       |   13 +++++----
 t/t9700-perl-git.sh                       |    2 +-
 23 files changed, 139 insertions(+), 103 deletions(-)

diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index cb14425..3762714 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -60,7 +60,8 @@ test_expect_success 'final setup + check rev-parse --git-dir' '
 
 test_expect_success 'check hash-object' '
 	echo "foo" >bar &&
-	SHA=$(cat bar | git hash-object -w --stdin) &&
+	SHA=$(cat bar | git hash-object -w --stdin --path=bar) &&
+	test_debug "echo SHA=$SHA" &&
 	objck $SHA
 '
 
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index 36cca14..ce4c584 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -44,7 +44,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree1path1'
+test_cat_eq $p tree1path1'
 
 test_expect_success \
 'checkout all stage 0 to temporary files' '
@@ -57,7 +57,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree1$f
+	test_cat_eq $p tree1$f
 done'
 
 test_expect_success \
@@ -73,7 +73,7 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = path1 &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = tree2path1'
+test_cat_eq $p tree2path1'
 
 test_expect_success \
 'checkout all stage 2 to temporary files' '
@@ -85,7 +85,7 @@ do
 	test $(grep $f out | cut "-d	" -f2) = $f &&
 	p=$(grep $f out | cut "-d	" -f1) &&
 	test -f $p &&
-	test $(cat $p) = tree2$f
+	test_cat_eq $p tree2$f
 done'
 
 test_expect_success \
@@ -104,9 +104,9 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 'checkout some stages/one file to temporary files' '
@@ -118,8 +118,8 @@ cut "-d	" -f1 out | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 'checkout all stages/all files to temporary files' '
@@ -138,9 +138,9 @@ grep path1 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s1) = tree1path1 &&
-test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1)'
+test_cat_eq $s1 tree1path1 &&
+test_cat_eq $s2 tree2path1 &&
+test_cat_eq $s3 tree3path1)'
 
 test_expect_success \
 '-- path2: no stage 1, have stage 2 and 3' '
@@ -149,8 +149,8 @@ grep path2 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test $s1 = . &&
 test -f $s2 &&
 test -f $s3 &&
-test $(cat $s2) = tree2path2 &&
-test $(cat $s3) = tree3path2)'
+test_cat_eq $s2 tree2path2 &&
+test_cat_eq $s3 tree3path2)'
 
 test_expect_success \
 '-- path3: no stage 2, have stage 1 and 3' '
@@ -159,8 +159,8 @@ grep path3 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test -f $s3 &&
-test $(cat $s1) = tree1path3 &&
-test $(cat $s3) = tree3path3)'
+test_cat_eq $s1 tree1path3 &&
+test_cat_eq $s3 tree3path3)'
 
 test_expect_success \
 '-- path4: no stage 3, have stage 1 and 3' '
@@ -169,8 +169,8 @@ grep path4 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test -f $s2 &&
 test $s3 = . &&
-test $(cat $s1) = tree1path4 &&
-test $(cat $s2) = tree2path4)'
+test_cat_eq $s1 tree1path4 &&
+test_cat_eq $s2 tree2path4)'
 
 test_expect_success \
 '-- asubdir/path5: no stage 2 and 3 have stage 1' '
@@ -179,7 +179,7 @@ grep asubdir/path5 out | cut "-d	" -f1 | (read s1 s2 s3 &&
 test -f $s1 &&
 test $s2 = . &&
 test $s3 = . &&
-test $(cat $s1) = tree1asubdir/path5)'
+test_cat_eq $s1 tree1asubdir/path5)'
 
 test_expect_success \
 'checkout --temp within subdir' '
@@ -191,7 +191,7 @@ test_expect_success \
  test -f ../$s1 &&
  test $s2 = . &&
  test $s3 = . &&
- test $(cat ../$s1) = tree1asubdir/path5)
+ test_cat_eq ../$s1 tree1asubdir/path5)
 )'
 
 test_expect_success SYMLINKS \
@@ -207,6 +207,6 @@ test $(wc -l <out) = 1 &&
 test $(cut "-d	" -f2 out) = a &&
 p=$(cut "-d	" -f1 out) &&
 test -f $p &&
-test $(cat $p) = b'
+test_cat_eq $p b'
 
 test_done
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index 3e098ab..7933197 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -27,14 +27,14 @@ test_expect_success 'remove and restore with relative path' '
 		cd dir1 &&
 		rm ../file0 &&
 		git checkout HEAD -- ../file0 &&
-		test "base" = "$(cat ../file0)" &&
+		test_eq_cat base ../file0 &&
 		rm ../dir2/file2 &&
 		git checkout HEAD -- ../dir2/file2 &&
-		test "bonjour" = "$(cat ../dir2/file2)" &&
+		test_eq_cat bonjour ../dir2/file2 &&
 		rm ../file0 ./file1 &&
 		git checkout HEAD -- .. &&
-		test "base" = "$(cat ../file0)" &&
-		test "hello" = "$(cat file1)"
+		test_eq_cat base ../file0 &&
+		test_eq_cat hello file1
 	)
 
 '
@@ -43,7 +43,7 @@ test_expect_success 'checkout with empty prefix' '
 
 	rm file0 &&
 	git checkout HEAD -- file0 &&
-	test "base" = "$(cat file0)"
+	test_eq_cat base file0
 
 '
 
@@ -51,10 +51,10 @@ test_expect_success 'checkout with simple prefix' '
 
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1 &&
-	test "hello" = "$(cat dir1/file1)" &&
+	test_eq_cat hello dir1/file1 &&
 	rm dir1/file1 &&
 	git checkout HEAD -- dir1/file1 &&
-	test "hello" = "$(cat dir1/file1)"
+	test_eq_cat hello dir1/file1
 
 '
 
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index c32ff66..6990c77 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -162,7 +162,7 @@ test_expect_success 'squash' '
 	GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 &&
 	echo "******************************" &&
 	FAKE_LINES="1 squash 2" git rebase -i --onto master HEAD~2 &&
-	test B = $(cat file7) &&
+	test_eq_cat B file7 &&
 	test $(git rev-parse HEAD^) = $(git rev-parse master)
 '
 
diff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh
index c49143a..a044962 100755
--- a/t/t3410-rebase-preserve-dropped-merges.sh
+++ b/t/t3410-rebase-preserve-dropped-merges.sh
@@ -52,9 +52,9 @@ test_expect_success 'skip same-resolution merges with -p' '
 	test_commit K file7 file7 &&
 	git rebase -i -p L &&
 	test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
-	test "23" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 23 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 # A - B - C - D - E
@@ -77,9 +77,9 @@ test_expect_success 'keep different-resolution merges with -p' '
 	git add file1 &&
 	git rebase --continue &&
 	test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
-	test "234" = "$(cat file1)" &&
-	test "I" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)"
+	test_eq_cat 234 file1 &&
+	test_eq_cat I file6 &&
+	test_eq_cat file7 file7
 '
 
 test_done
diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh
index 098b755..ac9ad05 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -27,14 +27,14 @@ test_expect_success 'rebase' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase -i' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'setup pre-rebase hook' '
@@ -50,8 +50,8 @@ test_expect_success 'pre-rebase hook gets correct input (1)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -59,8 +59,8 @@ test_expect_success 'pre-rebase hook gets correct input (2)' '
 	git checkout test &&
 	git reset --hard side &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (3)' '
@@ -68,16 +68,16 @@ test_expect_success 'pre-rebase hook gets correct input (3)' '
 	git reset --hard side &&
 	git checkout master &&
 	git rebase master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (4)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,
 
 '
 
@@ -85,8 +85,8 @@ test_expect_success 'pre-rebase hook gets correct input (5)' '
 	git checkout test &&
 	git reset --hard side &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'pre-rebase hook gets correct input (6)' '
@@ -94,8 +94,8 @@ test_expect_success 'pre-rebase hook gets correct input (6)' '
 	git reset --hard side &&
 	git checkout master &&
 	EDITOR=true git rebase -i master test &&
-	test "z$(cat git)" = zworld &&
-	test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test
+	test_cat_eq git world &&
+	test_cat_eq .git/PRE-REBASE-INPUT master,test
 '
 
 test_expect_success 'setup pre-rebase hook that fails' '
@@ -132,7 +132,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (1)' '
 	git reset --hard side &&
 	git rebase --no-verify master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
@@ -140,7 +140,7 @@ test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
 	git reset --hard side &&
 	EDITOR=true git rebase --no-verify -i master &&
 	test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
-	test "z$(cat git)" = zworld
+	test_cat_eq git world
 '
 
 test_done
diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh
index b0faa29..dfcd72a 100755
--- a/t/t3503-cherry-pick-root.sh
+++ b/t/t3503-cherry-pick-root.sh
@@ -23,7 +23,7 @@ test_expect_success setup '
 test_expect_success 'cherry-pick a root commit' '
 
 	git cherry-pick master &&
-	test first = $(cat file1)
+	test_eq_cat first file1
 
 '
 
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 7484cbe..7c1e169 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -49,7 +49,7 @@ test_expect_success 'apply stashed changes' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -61,7 +61,7 @@ test_expect_success 'apply stashed changes (including index)' '
 	test_tick &&
 	git commit -m other-file &&
 	git stash apply --index &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 2 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -83,7 +83,7 @@ test_expect_success 'drop top stash' '
 	git stash list > stashlist2 &&
 	diff stashlist1 stashlist2 &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -97,13 +97,13 @@ test_expect_success 'drop middle stash' '
 	git stash drop stash@{1} &&
 	test 2 = $(git stash list | wc -l) &&
 	git stash apply &&
-	test 9 = $(cat file) &&
+	test_eq_cat 9 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	git reset --hard &&
 	git stash drop &&
 	git stash apply &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file)
 '
@@ -111,7 +111,7 @@ test_expect_success 'drop middle stash' '
 test_expect_success 'stash pop' '
 	git reset --hard &&
 	git stash pop &&
-	test 3 = $(cat file) &&
+	test_eq_cat 3 file &&
 	test 1 = $(git show :file) &&
 	test 1 = $(git show HEAD:file) &&
 	test 0 = $(git stash list | wc -l)
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index 1597965..5c7300d 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -43,7 +43,7 @@ test_expect_success FILEMODE validate \
 
 test_expect_success 'apply reverse' \
     'git apply -R --index --stat --summary --apply test-patch &&
-     test "$(cat foo)" = "This is foo"'
+     test_cat_eq foo "This is foo"'
 
 cat >test-patch <<\EOF
 diff --git a/foo b/bar
@@ -59,6 +59,7 @@ EOF
 
 test_expect_success 'apply copy' \
     'git apply --index --stat --summary --apply test-patch &&
-     test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"'
+     test_cat_eq bar "This is bar" &&
+     test_cat_eq foo "This is foo"'
 
 test_done
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index f83322e..3933dd9 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -38,13 +38,19 @@ apply_patch () {
 	git apply "$@"
 }
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_fix () {
 
 	# fix should not barf
 	apply_patch --whitespace=fix || return 1
 
+	test_debug "echo patch applied: [$1]"
 	# find touched lines
-	diff file target | sed -n -e "s/^> //p" >fixed
+	remove_cr target >target1
+	diff file target1 | sed -n -e "s/^> //p" >fixed
 
 	# the changed lines are all expeced to change
 	fixed_cnt=$(wc -l <fixed)
@@ -52,6 +58,7 @@ test_fix () {
 	'') expect_cnt=$fixed_cnt ;;
 	?*) expect_cnt=$(grep "[$1]" <fixed | wc -l) ;;
 	esac
+	test_debug "echo fixed: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# and we are not missing anything
@@ -59,12 +66,14 @@ test_fix () {
 	'') expect_cnt=0 ;;
 	?*) expect_cnt=$(grep "[$1]" <file | wc -l) ;;
 	esac
+	test_debug "echo missing: $fixed_cnt vs $expect_cnt"
 	test $fixed_cnt -eq $expect_cnt || return 1
 
 	# Get the patch actually applied
 	git diff-files -p target >fixed-patch
 	test -s fixed-patch && return 0
 
+	test_debug "echo failed to apply, try and fix"
 	# Make sure it is complaint-free
 	>target
 	git apply --whitespace=error-all <fixed-patch
@@ -85,14 +94,16 @@ test_expect_success setup '
 test_expect_success 'whitespace=nowarn, default rule' '
 
 	apply_patch --whitespace=nowarn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
 test_expect_success 'whitespace=warn, default rule' '
 
 	apply_patch --whitespace=warn &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -108,7 +119,8 @@ test_expect_success 'whitespace=error-all, no rule' '
 
 	git config core.whitespace -trailing,-space-before,-indent &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
@@ -117,7 +129,8 @@ test_expect_success 'whitespace=error-all, no rule (attribute)' '
 	git config --unset core.whitespace &&
 	echo "target -whitespace" >.gitattributes &&
 	apply_patch --whitespace=error-all &&
-	diff file target
+	remove_cr target >target1 &&
+	diff file target1
 
 '
 
diff --git a/t/t4125-apply-ws-fuzz.sh b/t/t4125-apply-ws-fuzz.sh
index 3b471b6..c02fe08 100755
--- a/t/t4125-apply-ws-fuzz.sh
+++ b/t/t4125-apply-ws-fuzz.sh
@@ -4,6 +4,10 @@ test_description='applying patch that has broken whitespaces in context'
 
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 test_expect_success setup '
 
 	>file &&
@@ -91,12 +95,13 @@ test_expect_success 'withfix (backward)' '
 
 	sed -e /h/d file-fixed >fixed-head &&
 	sed -e /h/d file >file-head &&
-	test_cmp fixed-head file-head &&
+	remove_cr file-head >file-head1
+	diff fixed-head file-head1 &&
 
 	sed -n -e /h/p file-fixed >fixed-tail &&
 	sed -n -e /h/p file >file-tail &&
 
-	! test_cmp fixed-tail file-tail
+	! diff fixed-tail file-tail
 
 '
 
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index 8f6aea4..a03a9c8 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -27,7 +27,7 @@ test_expect_success 'apply --directory -p (1)' '
 
 	git apply --directory=some/sub -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -36,7 +36,7 @@ test_expect_success 'apply --directory -p (2) ' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/ -p3 --index patch &&
 	test Bello = $(git show :some/sub/dir/file) &&
-	test Bello = $(cat some/sub/dir/file)
+	test_eq_cat Bello some/sub/dir/file
 
 '
 
@@ -54,7 +54,7 @@ test_expect_success 'apply --directory (new file)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/newfile) &&
-	test content = $(cat some/sub/dir/newfile)
+	test_eq_cat content some/sub/dir/newfile
 '
 
 cat > patch << EOF
@@ -89,7 +89,7 @@ test_expect_success 'apply --directory (quoted filename)' '
 	git reset --hard initial &&
 	git apply --directory=some/sub/dir/ --index patch &&
 	test content = $(git show :some/sub/dir/quotefile) &&
-	test content = $(cat some/sub/dir/quotefile)
+	test_eq_cat content some/sub/dir/quotefile
 '
 
 test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index d6ebbae..27570b7 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -190,7 +190,7 @@ test_expect_success 'am --skip works' '
 	git am --skip &&
 	! test -d .git/rebase-apply &&
 	test -z "$(git diff lorem2^^ -- file)" &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am --resolved works' '
@@ -201,7 +201,7 @@ test_expect_success 'am --resolved works' '
 	git add file &&
 	git am --resolved &&
 	! test -d .git/rebase-apply &&
-	test goodbye = "$(cat another)"
+	test_eq_cat goodbye another
 '
 
 test_expect_success 'am takes patches from a Pine mailbox' '
diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh
index f603c1b..342fc1a 100755
--- a/t/t4252-am-options.sh
+++ b/t/t4252-am-options.sh
@@ -3,6 +3,10 @@
 test_description='git am with options and not losing them'
 . ./test-lib.sh
 
+remove_cr () {
+	tr '\015' Q <"$1" | sed -e 's/Q$//'
+}
+
 tm="$TEST_DIRECTORY/t4252"
 
 test_expect_success setup '
@@ -20,7 +24,8 @@ test_expect_success 'interrupted am --whitespace=fix' '
 	test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Six$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Six$" file-2a
 '
 
 test_expect_success 'interrupted am -C1' '
@@ -29,7 +34,8 @@ test_expect_success 'interrupted am -C1' '
 	test_must_fail git am -C1 "$tm"/am-test-2-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -p2' '
@@ -38,7 +44,8 @@ test_expect_success 'interrupted am -p2' '
 	test_must_fail git am -p2 "$tm"/am-test-3-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am -C1 -p2' '
@@ -47,7 +54,8 @@ test_expect_success 'interrupted am -C1 -p2' '
 	test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
 	git am --skip &&
 	grep 3 file-1 &&
-	grep "^Three$" file-2
+	remove_cr file-2 >file-2a &&
+	grep "^Three$" file-2a
 '
 
 test_expect_success 'interrupted am --directory="frotz nitfol"' '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index abb41b0..28d6291 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -25,6 +25,8 @@ commit id embedding:
 '
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
+
 UNZIP=${UNZIP:-unzip}
 
 SUBSTFORMAT=%H%n
@@ -66,6 +68,8 @@ test_expect_success \
     'git clone --bare . bare.git &&
      cp .git/info/attributes bare.git/info/attributes'
 
+test ! -z "$autocrlf" && (cd bare.git; git config core.autocrlf $autocrlf)
+
 test_expect_success \
     'remove ignored file' \
     'rm a/ignored'
@@ -118,7 +122,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents' \
-    'diff -r a b/a'
+    'diff -rb a b/a'
 
 test_expect_success \
     'git tar-tree with prefix' \
@@ -135,7 +139,7 @@ test_expect_success \
 
 test_expect_success \
     'validate file contents with prefix' \
-    'diff -r a c/prefix/a'
+    'diff -rb a c/prefix/a'
 
 test_expect_success \
     'create archives with substfiles' \
@@ -203,7 +207,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents' \
-    'diff -r a d/a'
+    'diff -rb a d/a'
 
 test_expect_success \
     'git archive --format=zip with prefix' \
@@ -220,7 +224,7 @@ test_expect_success UNZIP \
 
 test_expect_success UNZIP \
     'validate file contents with prefix' \
-    'diff -r a e/prefix/a'
+    'diff -rb a e/prefix/a'
 
 test_expect_success \
     'git archive --list outside of a git repo' \
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 426b319..2efa018 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -3,6 +3,7 @@
 test_description='git archive attribute tests'
 
 . ./test-lib.sh
+autocrlf=$(git config core.autocrlf)
 
 SUBSTFORMAT=%H%n
 
@@ -39,6 +40,8 @@ test_expect_success 'setup' '
 	cp .git/info/attributes bare/info/attributes
 '
 
+test ! -z "$autocrlf" && (cd bare; git config core.autocrlf $autocrlf)
+
 test_expect_success 'git archive' '
 	git archive HEAD >archive.tar &&
 	(mkdir archive && cd archive && "$TAR" xf -) <archive.tar
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 725771f..4d4e7ac 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -49,9 +49,9 @@ test_expect_success 'test . as a remote' '
 	echo updated >file &&
 	git commit -a -m updated &&
 	git checkout copy &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull &&
-	test `cat file` = updated
+	test_cat_eq file updated
 '
 
 test_expect_success 'the default remote . should not break explicit pull' '
@@ -60,9 +60,9 @@ test_expect_success 'the default remote . should not break explicit pull' '
 	git commit -a -m modified &&
 	git checkout copy &&
 	git reset --hard HEAD^ &&
-	test `cat file` = file &&
+	test_cat_eq file file &&
 	git pull . second &&
-	test `cat file` = modified
+	test_cat_eq file modified
 '
 
 test_expect_success '--rebase' '
@@ -99,8 +99,8 @@ test_expect_success '--rebase with rebased upstream' '
 	echo file > file2 &&
 	git commit -m to-rebase file2 &&
 	git pull --rebase me copy &&
-	test "conflicting modification" = "$(cat file)" &&
-	test file = $(cat file2)
+	test_eq_cat "conflicting modification" file &&
+	test_eq_cat file file2
 
 '
 
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 329c851..c6e9fb5 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -72,7 +72,7 @@ test_expect_success 'test that the file was renamed' '
 	test d = "$(git show HEAD:doh --)" &&
 	! test -f d &&
 	test -f doh &&
-	test d = "$(cat doh)"
+	test_eq_cat d doh
 '
 
 test_expect_success 'rewrite, renaming a specific directory' '
@@ -85,7 +85,7 @@ test_expect_success 'test that the directory was renamed' '
 	test -d diroh &&
 	! test -d diroh/dir &&
 	test -f diroh/d &&
-	test dir/d = "$(cat diroh/d)"
+	test_eq_cat dir/d diroh/d
 '
 
 git tag oldD HEAD~4
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index bdb808a..62f58eb 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -434,7 +434,7 @@ test_expect_success 'checkout unmerged stage' '
 	test_cmp expect filf &&
 	test_cmp expect file &&
 	git checkout --theirs file &&
-	test ztheirside = "z$(cat file)"
+	test_eq_cat theirside file
 '
 
 test_expect_success 'checkout with --merge' '
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index f919c8d..8e5d747 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -80,11 +80,11 @@ test_expect_success 'stash with a dirty submodule' '
 	echo new > file &&
 	CURRENT=$(cd submodule && git rev-parse HEAD) &&
 	git stash &&
-	test new != $(cat file) &&
+	test_ne_cat new file &&
 	test submodule = $(git diff --name-only) &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD) &&
 	git stash apply &&
-	test new = $(cat file) &&
+	test_eq_cat new file &&
 	test $CURRENT = $(cd submodule && git rev-parse HEAD)
 
 '
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index e768c3e..bf39e45 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -45,9 +45,9 @@ test_expect_success 'custom mergetool' '
     ( yes "" | git mergetool file1 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool file2 >/dev/null 2>&1 ) &&
     ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) &&
-    test "$(cat file1)" = "master updated" &&
-    test "$(cat file2)" = "master new" &&
-    test "$(cat subdir/file3)" = "master new sub" &&
+    test_cat_eq file1 "master updated" &&
+    test_cat_eq file2 "master new" &&
+    test_cat_eq subdir/file3 "master new sub" &&
     git commit -m "branch1 resolved with mergetool"
 '
 
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ebdccf9..b95069a 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -35,11 +35,12 @@ restore_test_defaults()
 	unset GIT_DIFFTOOL_PROMPT
 	unset GIT_DIFFTOOL_NO_PROMPT
 	git config diff.tool test-tool &&
-	git config difftool.test-tool.cmd 'cat $LOCAL'
+	git config difftool.test-tool.cmd "tr '\015' '\012' <\$LOCAL"
 }
 
 prompt_given()
 {
+	test_debug "echo prompt_given:$1"
 	prompt="$1"
 	test "$prompt" = "Hit return to launch 'test-tool': branch"
 }
@@ -59,7 +60,7 @@ test_expect_success 'setup' '
 # Configure a custom difftool.<tool>.cmd and use it
 test_expect_success 'custom commands' '
 	restore_test_defaults &&
-	git config difftool.test-tool.cmd "cat \$REMOTE" &&
+	git config difftool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$REMOTE" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "master" &&
@@ -136,7 +137,7 @@ test_expect_success 'GIT_DIFFTOOL_PROMPT variable' '
 	GIT_DIFFTOOL_PROMPT=true &&
 	export GIT_DIFFTOOL_PROMPT &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -166,7 +167,7 @@ test_expect_success 'difftool.prompt can overridden with -y' '
 test_expect_success 'difftool.prompt can overridden with --prompt' '
 	git config difftool.prompt false &&
 
-	prompt=$(echo | git difftool --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -179,7 +180,7 @@ test_expect_success 'difftool last flag wins' '
 
 	restore_test_defaults &&
 
-	prompt=$(echo | git difftool --no-prompt --prompt branch | tail -1) &&
+	prompt=$(echo | git difftool --no-prompt --prompt branch | head -3 | tail -1) &&
 	prompt_given "$prompt" &&
 
 	restore_test_defaults
@@ -190,7 +191,7 @@ test_expect_success 'difftool last flag wins' '
 test_expect_success 'difftool + mergetool config variables' '
 	remove_config_vars
 	git config merge.tool test-tool &&
-	git config mergetool.test-tool.cmd "cat \$LOCAL" &&
+	git config mergetool.test-tool.cmd "tr '\''\015'\'' '\''\012'\'' <\$LOCAL" &&
 
 	diff=$(git difftool --no-prompt branch) &&
 	test "$diff" = "branch" &&
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b4ca244..76f741f 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -42,7 +42,7 @@ test_expect_success \
      git config --add test.int 2k
      '
 
-test_external_without_stderr \
+test_external_with_only_warning \
     'Perl API' \
     perl "$TEST_DIRECTORY"/t9700/test.pl
 
-- 
1.6.3.15.g49878

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
  2009-05-11 14:10         ` Shawn O. Pearce
@ 2009-05-11 14:23           ` Carl Mercier
  0 siblings, 0 replies; 206+ messages in thread
From: Carl Mercier @ 2009-05-11 14:23 UTC (permalink / raw)
  To: git

unsubscribe git


 Protected by Websense Hosted Email Security -- www.websense.com 

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-05-07 17:01 Bevan Watkiss
  0 siblings, 0 replies; 206+ messages in thread
From: Bevan Watkiss @ 2009-05-07 17:01 UTC (permalink / raw)
  To: git

I am trying to create a working tree for people to read from and have it
update from a bare repository regularly.  Right now I am using git-pull to
fetch the changes, but it’s running slow due to the size of my repo and the
speed of the hardware as it seems to be checking the working tree for any
changes.  

Is there a way to make the pull ignore the local working tree and only look
at files that are changed in the change sets being pulled?

Bevan

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-04-16 23:17 Fawad Hassan Ismail
  0 siblings, 0 replies; 206+ messages in thread
From: Fawad Hassan Ismail @ 2009-04-16 23:17 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-03-30  5:03 David Aguilar
  0 siblings, 0 replies; 206+ messages in thread
From: David Aguilar @ 2009-03-30  5:03 UTC (permalink / raw)
  To: gitster; +Cc: git

As promised, here is the patch series that removes the duplicate
code between git-difftool and git-mergetool.

This is based on top of Junio's "pu" branch and is a
continuation of the recent difftool series.

I created a new git-sh-tools shell lib for holding the
common functions.  If anyone thinks I should have placed the
functions in git-sh-setup instead then just let me know.

Here's a total diffstat.  If it wasn't for the documentation
and replacing the mixed spaces/tabs with all-tabs in
git-mergetool then we would have seen a lot more
happy removals.

 .gitignore                     |    1 +
 Documentation/git-sh-tools.txt |   52 ++++
 Makefile                       |    1 +
 command-list.txt               |    1 +
 git-difftool-helper.sh         |  112 +-------
 git-mergetool.sh               |  639 ++++++++++++++++------------------------
 git-sh-tools.sh                |  181 ++++++++++++
 7 files changed, 506 insertions(+), 481 deletions(-)

GIT:
From: David Aguilar <davvid@gmail.com>
Subject: Refactor git-{diff,merge}tool to remove duplicate code
In-Reply-To: 

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-03-27 20:39 Lachlan Deck
  0 siblings, 0 replies; 206+ messages in thread
From: Lachlan Deck @ 2009-03-27 20:39 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
  2009-03-16 19:48   ` John Dlugosz
@ 2009-03-16 21:45     ` Nanako Shiraishi
  0 siblings, 0 replies; 206+ messages in thread
From: Nanako Shiraishi @ 2009-03-16 21:45 UTC (permalink / raw)
  To: John Dlugosz; +Cc: Junio C Hamano, git

Quoting John Dlugosz <JDlugosz@TradeStation.com>:

> === Re: ===
>  (2) if you are not, you can obviously check out topic and do the above,
>      or "git branch -f topic topic^".
> === end ===
>
> As documented, this destroys the existing branch and makes a new one.
> That would, by design, blow away the reflog for that branch.

Does it?  If so I think you have an incorrect documentation.

$ rm -fr /tmp/gomi && mkdir /tmp/gomi
$ cd /tmp/gomi
$ git init
$ echo hello >world
$ git add world
$ git commit -m initial
$ seq 1 100 | while read num; do echo $num >world; git commit -a -m $num; done
$ git checkout -b side master~60
$ git branch -f master master@{20}
$ git log --oneline -g master | head -n 10
0acf8c1 master@{0}: branch: Reset from master@{20}
945c3ee master@{1}: commit: 100
54fcb36 master@{2}: commit: 99
b314a1e master@{3}: commit: 98
e91d999 master@{4}: commit: 97
0d88853 master@{5}: commit: 96
0124315 master@{6}: commit: 95
5df2cc5 master@{7}: commit: 94
14bb58e master@{8}: commit: 93
0813a46 master@{9}: commit: 92

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-03-13  8:21 Werner Riener
  0 siblings, 0 replies; 206+ messages in thread
From: Werner Riener @ 2009-03-13  8:21 UTC (permalink / raw)
  To: git

subscribe

-- 
Werner Riener
Generalsekretär des
Aikikai Verband Österreichischer Aikido-Schulen
Tel: +43-0699-101 32 940
Email: riener_w@gmx.net
URI: http://www.aikikai.at
http://home.pages.at/werrie/

Nur bis 16.03.! DSL-Komplettanschluss inkl. WLAN-Modem für nur 
17,95 ¿/mtl. + 1 Monat gratis!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-02-06  9:45 info
  0 siblings, 0 replies; 206+ messages in thread
From: info @ 2009-02-06  9:45 UTC (permalink / raw)



Your Email Emerge a winner of 250,000.00 Euros dr.simonperez1@hotmail.co.uk






----------------------------------------------------------------
This message was sent using http://webmail.coqui.net

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2009-02-06  9:43 info
  0 siblings, 0 replies; 206+ messages in thread
From: info @ 2009-02-06  9:43 UTC (permalink / raw)



Your Email Emerge a winner of 250,000.00 Euros dr.simonperez1@hotmail.co.uk






----------------------------------------------------------------
This message was sent using http://webmail.coqui.net

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2009-01-09 19:02 nathan.panike
  0 siblings, 0 replies; 206+ messages in thread
From: nathan.panike @ 2009-01-09 19:02 UTC (permalink / raw)


>From 65c4fed27fe9752ffd0e3b7cb6807561a4dd4601 Mon Sep 17 00: 00:00 2001
From: Nathan W. Panike <nathan.panike@gmail.com>
Date: Fri, 9 Jan 2009 11:53:43 -0600
Subject: [PATCH] Get format-patch to show first commit after root commit

Currently, the command

git format-patch -1 e83c5163316f89bfbde

in the git repository creates an empty file.  Instead, one is
forced to do

git format-patch -1 --root e83c5163316f89bfbde

This seems arbitrary.  This patch fixes this case, so that

git format-patch -1 e83c5163316f89bfbde

will produce an actual patch.
---
 builtin-log.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 4a02ee9..5e7b61f 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -977,6 +977,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		list[nr - 1] = commit;
 	}
 	total = nr;
+	if (total == 1 && !list[0]->parents)
+		rev.show_root_diff=1;
 	if (!keep_subject && auto_number && total > 1)
 		numbered = 1;
 	if (numbered)
-- 
1.6.1.76.gc123b.dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2008-10-05 23:36 Robin Rosenberg
  0 siblings, 0 replies; 206+ messages in thread
From: Robin Rosenberg @ 2008-10-05 23:36 UTC (permalink / raw)
  To: git; +Cc: spearce

This series decorates the graphical and text (jgit log) history listings
with tags. For the text command it is optional.

Reviewers may want to pay special attention to the changes in the Ref class.

-- robin

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2008-08-21 19:15 bpeeluk
  0 siblings, 0 replies; 206+ messages in thread
From: bpeeluk @ 2008-08-21 19:15 UTC (permalink / raw)


>From e2b0f6749bca6f6bc7a5397fe2bd28de25db07c1 Mon Sep 17 00:00:00 2001
From: Neil Roberts <bpeeluk@yahoo.co.uk>
Date: Thu, 21 Aug 2008 19:49:58 +0100
Subject: [PATCH] config.mak.in: Pass on LDFLAGS from configure

The configure script allows you to specify flags to pass to the linker
step in the LDFLAGS environment variable but this was being ignored in
the Makefile. Now a make variable gets set to the value passed down
from the configure script.

Signed-off-by: Neil Roberts <bpeeluk@yahoo.co.uk>
---
 config.mak.in |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index b776149..f67d673 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -3,6 +3,7 @@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
 AR = @AR@
 TAR = @TAR@
 #INSTALL = @INSTALL@		# needs install-sh or install.sh in sources
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2008-08-13 14:54 aneesh.kumar
  0 siblings, 0 replies; 206+ messages in thread
From: aneesh.kumar @ 2008-08-13 14:54 UTC (permalink / raw)
  To: pasky; +Cc: git, Aneesh Kumar K.V

From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

topgit: Implement tg-import

This can be used to import a set of commits
between range specified by range1..range2
This should help us to convert an already
existing quilt, stgit branches to topgit
managed one

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>

---
 Makefile     |    2 +-
 README       |    7 ++++++
 tg-create.sh |   22 ++++++++----------
 tg-export.sh |    2 +-
 tg-import.sh |   68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 87 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 6eade1e..95624ac 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ sharedir = $(PREFIX)/share/topgit
 hooksdir = $(cmddir)/hooks
 
 
-commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh
+commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh tg-import.sh
 hooks_in = hooks/pre-commit.sh
 
 commands_out = $(patsubst %.sh,%,$(commands_in))
diff --git a/README b/README
index b58a1b4..8b8f4d7 100644
--- a/README
+++ b/README
@@ -330,6 +330,13 @@ tg export
 	TODO: Make stripping of [PATCH] and other prefixes configurable
 	TODO: --mbox option for other mode of operation
 
+tg import
+~~~~~~~~
+	Import the commits between the given revision range into
+	a topgit managed branch
+
+	Usage: tg import rev1..rev2
+
 tg update
 ~~~~~~~~~
 	Update the current topic branch wrt. changes in the branches
diff --git a/tg-create.sh b/tg-create.sh
index 939af33..6cce7ed 100644
--- a/tg-create.sh
+++ b/tg-create.sh
@@ -31,17 +31,18 @@ done
 
 deps="${deps# }"
 if [ -z "$deps" ]; then
-	if [ -z "$name" -a -s "$git_dir/top-name" -a -s "$git_dir/top-deps" -a -s "$git_dir/top-merge" ]; then
-		# We are setting up the base branch now; resume merge!
-		name="$(cat "$git_dir/top-name")"
+	head="$(git symbolic-ref HEAD)"
+	bname="${head#refs/top-bases/}"
+	if [ "$bname" != "$head" -a -s "$git_dir/top-deps" -a -s "$git_dir/top-merge" ]; then
+		# We are on a base branch now; resume merge!
 		deps="$(cat "$git_dir/top-deps")"
 		merge="$(cat "$git_dir/top-merge")"
+		name="$bname"
 		restarted=1
 		info "Resuming $name setup..."
 	else
 		# The common case
 		[ -z "$name" ] && die "no branch name given"
-		head="$(git symbolic-ref HEAD)"
 		deps="${head#refs/heads/}"
 		[ "$deps" != "$head" ] || die "refusing to auto-depend on non-head ref ($head)"
 		info "Automatically marking dependency on $deps"
@@ -58,7 +59,7 @@ done
 	die "branch '$name' already exists"
 
 # Clean up any stale stuff
-rm -f "$git_dir/top-name" "$git_dir/top-deps" "$git_dir/top-merge"
+rm -f "$git_dir/top-deps" "$git_dir/top-merge"
 
 
 ## Create base
@@ -68,8 +69,7 @@ if [ -n "$merge" ]; then
 	branch="${merge%% *}"
 	merge="${merge#* }"
 	info "Creating $name base from $branch..."
-	# We create a detached head so that we can abort this operation
-	git checkout -q "$(git rev-parse "$branch")"
+	switch_to_base "$name" "$branch"
 fi
 
 
@@ -83,10 +83,9 @@ while [ -n "$merge" ]; do
 
 	if ! git merge "$branch"; then
 		info "Please commit merge resolution and call: tg create"
-		info "It is also safe to abort this operation using:"
-		info "git reset --hard some_branch"
-		info "(You are on a detached HEAD now.)"
-		echo "$name" >"$git_dir/top-name"
+		info "It is also safe to abort this operation using \`git reset --hard\`"
+		info "but please remember you are on the base branch now;"
+		info "you will want to switch to a different branch."
 		echo "$deps" >"$git_dir/top-deps"
 		echo "$merge" >"$git_dir/top-merge"
 		exit 2
@@ -96,7 +95,6 @@ done
 
 ## Set up the topic branch
 
-git update-ref "refs/top-bases/$name" "HEAD" ""
 git checkout -b "$name"
 
 echo "$deps" | sed 's/ /\n/g' >"$root_dir/.topdeps"
diff --git a/tg-export.sh b/tg-export.sh
index 62361dd..73ad2ef 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -190,7 +190,7 @@ recurse_deps driver "$name"
 
 
 if [ "$driver" = "collapse" ]; then
-	git update-ref "refs/heads/$output" "$(cat "$playground/$name")" ""
+	git update-ref "refs/heads/$output" "$(cat "$playground/$name")"
 
 	depcount="$(cat "$playground/^ticker" | wc -l)"
 	echo "Exported topic branch $name (total $depcount topics) to branch $output"
diff --git a/tg-import.sh b/tg-import.sh
new file mode 100644
index 0000000..6c991c5
--- /dev/null
+++ b/tg-import.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# GPLv2
+
+
+tg_get_commit_msg()
+{
+	commit="$1"
+	git log -1 --pretty=format:"From: %an <%ae>%n%n%s%n%n%b" "$commit"
+}
+
+tg_get_branch_name()
+{
+	# nice sed script from git-format-patch.sh
+	commit="$1"
+	titleScript='
+	s/[^-a-z.A-Z_0-9]/-/g
+        s/\.\.\.*/\./g
+	s/\.*$//
+	s/--*/-/g
+	s/^-//
+	s/-$//
+	q
+'
+	git log -1 --pretty=format:"%s" "$commit" | sed -e "$titleScript"
+}
+
+tg_process_commit()
+{
+	commit="$1"
+	branch_name=$(tg_get_branch_name "$commit")
+	echo "Importing $commit to $branch_name"
+	tg create tp/"$branch_name"
+	git read-tree "$commit"
+	tg_get_commit_msg "$commit" > .topmsg
+	git add -f .topmsg .topdeps
+	git commit -C "$commit"
+}
+
+# nice arg verification stolen from git-format-patch.sh
+for revpair
+do
+	case "$revpair" in
+	?*..?*)
+		rev1=`expr "z$revpair" : 'z\(.*\)\.\.'`
+		rev2=`expr "z$revpair" : 'z.*\.\.\(.*\)'`
+		;;
+	*)
+		die "Unknow range spec $revpair"
+		;;
+	esac
+	git rev-parse --verify "$rev1^0" >/dev/null 2>&1 ||
+		die "Not a valid rev $rev1 ($revpair)"
+	git rev-parse --verify "$rev2^0" >/dev/null 2>&1 ||
+		die "Not a valid rev $rev2 ($revpair)"
+	git cherry -v "$rev1" "$rev2" |
+	while read sign rev comment
+	do
+		case "$sign" in
+		'-')
+			info "Merged already: $comment"
+			;;
+		*)
+			tg_process_commit "$rev"
+			;;
+		esac
+	done
+done
-- 
tg: (f27e693..) tp/topgit-Implement-tg-import (depends on: master)

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2008-06-23 20:54 VIP Casino Club
  0 siblings, 0 replies; 206+ messages in thread
From: VIP Casino Club @ 2008-06-23 20:54 UTC (permalink / raw)
  To: git

Enjoy all the action of Las Vegas with 24 hour customer services, great
offers and promotions 
and reliable payments from your armchair with ClubVIP: 

***Download and install our free software 
***Register your account 
***Purchase chips and get playing! 

See you at the tables! 

http://www.webtopjackpot.net







hewruhxycu lyyj bdihiabda

mauugema bu

siaocwenrvumip bfyxuu mueglofaeu
oereqyxlebjier k koopwanusohuc
znhiqs x
tivequwexe sju jeozenov

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2008-06-16 20:02 amery
  0 siblings, 0 replies; 206+ messages in thread
From: amery @ 2008-06-16 20:02 UTC (permalink / raw)


>From 25cb047690dd6101527cdfa6198dd6a6f93bf095 Mon Sep 17 00:00:00 2001
From: Alejandro Mery <amery@geeks.cl>
Date: Mon, 16 Jun 2008 20:27:14 +0200
Subject: [PATCH] git-am: head -1 is obsolete and doesn't work on some new systems

http://www.opengroup.org/onlinepubs/009695399/utilities/head.html
---
 git-am.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index b48096e..797988f 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -421,7 +421,7 @@ do
 	else
 	    action=yes
 	fi
-	FIRSTLINE=$(head -1 "$dotest/final-commit")
+	FIRSTLINE=$(head -n1 "$dotest/final-commit")
 
 	if test $action = skip
 	then
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2008-06-16 19:42 amery
  0 siblings, 0 replies; 206+ messages in thread
From: amery @ 2008-06-16 19:42 UTC (permalink / raw)


>From 25cb047690dd6101527cdfa6198dd6a6f93bf095 Mon Sep 17 00:00:00 2001
From: Alejandro Mery <amery@geeks.cl>
Date: Mon, 16 Jun 2008 20:27:14 +0200
Subject: [PATCH] git-am: head -1 is obsolete and doesn't work on some new systems

http://www.opengroup.org/onlinepubs/009695399/utilities/head.html
---
 git-am.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index b48096e..797988f 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -421,7 +421,7 @@ do
 	else
 	    action=yes
 	fi
-	FIRSTLINE=$(head -1 "$dotest/final-commit")
+	FIRSTLINE=$(head -n1 "$dotest/final-commit")
 
 	if test $action = skip
 	then
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2008-05-10 22:32 Krzysztof Kowalczyk
  0 siblings, 0 replies; 206+ messages in thread
From: Krzysztof Kowalczyk @ 2008-05-10 22:32 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2008-01-20 21:59 Marc-André Lureau
  0 siblings, 0 replies; 206+ messages in thread
From: Marc-André Lureau @ 2008-01-20 21:59 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
  2007-12-05 19:00 [PATCH 0/6] builtin-remote Johannes Schindelin
@ 2007-12-05 19:00 ` Johannes Schindelin
  0 siblings, 0 replies; 206+ messages in thread
From: Johannes Schindelin @ 2007-12-05 19:00 UTC (permalink / raw)
  To: git, gitster

[PATCH 1/6] path-list: add functions to work with unsorted lists

Up to now, path-lists were sorted at all times.  But sometimes it
is much more convenient to build the list and sort it at the end,
or sort it not at all.

Add path_list_append() and sort_path_list() to allow that.

Also, add the unsorted_path_list_has_path() function, to do a linear
search.

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

	I should have done this much earlier...

 path-list.c |   30 ++++++++++++++++++++++++++++++
 path-list.h |    8 +++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/path-list.c b/path-list.c
index 3d83b7b..92e5cf2 100644
--- a/path-list.c
+++ b/path-list.c
@@ -102,3 +102,33 @@ void print_path_list(const char *text, const struct path_list *p)
 	for (i = 0; i < p->nr; i++)
 		printf("%s:%p\n", p->items[i].path, p->items[i].util);
 }
+
+struct path_list_item *path_list_append(const char *path, struct path_list *list)
+{
+	ALLOC_GROW(list->items, list->nr + 1, list->alloc);
+	list->items[list->nr].path =
+		list->strdup_paths ? xstrdup(path) : (char *)path;
+	return list->items + list->nr++;
+}
+
+static int cmp_items(const void *a, const void *b)
+{
+	const struct path_list_item *one = a;
+	const struct path_list_item *two = b;
+	return strcmp(one->path, two->path);
+}
+
+void sort_path_list(struct path_list *list)
+{
+	qsort(list->items, list->nr, sizeof(*list->items), cmp_items);
+}
+
+int unsorted_path_list_has_path(struct path_list *list, const char *path)
+{
+	int i;
+	for (i = 0; i < list->nr; i++)
+		if (!strcmp(path, list->items[i].path))
+			return 1;
+	return 0;
+}
+
diff --git a/path-list.h b/path-list.h
index 5931e2c..ca2cbba 100644
--- a/path-list.h
+++ b/path-list.h
@@ -13,10 +13,16 @@ struct path_list
 };
 
 void print_path_list(const char *text, const struct path_list *p);
+void path_list_clear(struct path_list *list, int free_util);
 
+/* Use these functions only on sorted lists: */
 int path_list_has_path(const struct path_list *list, const char *path);
-void path_list_clear(struct path_list *list, int free_util);
 struct path_list_item *path_list_insert(const char *path, struct path_list *list);
 struct path_list_item *path_list_lookup(const char *path, struct path_list *list);
 
+/* Use these functions only on unsorted lists: */
+struct path_list_item *path_list_append(const char *path, struct path_list *list);
+void sort_path_list(struct path_list *list);
+int unsorted_path_list_has_path(struct path_list *list, const char *path);
+
 #endif /* PATH_LIST_H */
-- 
1.5.3.7.2157.g9598e

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-11-26 20:00 Michael Dressel
  0 siblings, 0 replies; 206+ messages in thread
From: Michael Dressel @ 2007-11-26 20:00 UTC (permalink / raw)
  To: bulb; +Cc: git



>On Mon, Nov 26, 2007 at 20:12:37 +0100, David Kastrup wrote:
>> Jan Hudec <bulb@ucw.cz> writes:
>> 
>> > On Mon, Nov 26, 2007 at 18:10:10 +0100, Benoit Sigoure wrote:
>> >> On Nov 26, 2007, at 5:46 PM, Andy Parkins wrote:
>> >> While we're discussing bad names, as someone already pointed out, I 
agree 
>> >> it's sad that "git push" is almost always understood as being the 
opposite 
>> >> of "git pull".
>> >
>> > Well, it is an oposite of pull. Compared to it, it is limited in that 
it will
>> > not do a merge and on the other hand extended to *also* be an oposite 
of
>> > fetch, but still oposite of pull is push.
>> 
>> With the same reasoning the opposite of a duck is a lobster, since a
>> lobster has not only fewer wings, but also more legs.
>
>No.
>
>The basic pull/push actions are:
>
>git pull: Bring the remote ref value here.
>git push: Put the local ref value there.
>
>Are those not oposites?
>
>Than each command has it's different features on top of this -- pull 
>merges
>and push can push multiple refs -- but in the basic operation they are
>oposites.


In the case remote branches are used push and pull are not exactly 
opposite. Pull uses the remote branch and push does not.

                                 .
               LOCAL REPO        .       REMOTE REPO
    .............................................................
    a_local_branch ------------ push ------------->a_local_branch 
         ^                       .                       |
         |                       .                       |
         |                       .                       |
       merge                     .                       |
         |                       .                       |
         |                       .                       |
    a_remote_branch <----------fetch ---------------------
                                 .

Cheers,
Michael

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-11-11 13:08 Michael Dressel
  0 siblings, 0 replies; 206+ messages in thread
From: Michael Dressel @ 2007-11-11 13:08 UTC (permalink / raw)
  To: git


>Michael Dressel wrote:
>Ok nice. Another thing is that git-push will push all the tracking 
>branches in refs/remotes/origin. 

I learned that I only have to edit the .git/config file to avoid that 
git-push pushes everything. 

I modified the remotes names and added push lines explicitly.

Is that the recommended way?

In my example (git-branch -a -v):
* exp                 aa854c6 shtest 4
  master              34924b9 mastertest 1
  origin/exp          aa854c6 shtest 4
  origin/master       b68e7a9 brt master 1

I used the following .git/config:
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin1"]
        url = /home/repo/src
        fetch = +refs/heads/master:refs/remotes/origin/master
        push = +refs/heads/master:refs/heads/master
[remote "origin2"]
        url = /home/repo/src
        fetch = +refs/heads/exp:refs/remotes/origin/exp
        push = +refs/heads/exp:refs/heads/exp
[branch "master"]
        remote = origin1
        merge = refs/heads/master
[branch "exp"]
        remote = origin2
        merge = refs/heads/exp

Cheers,
Michael

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2007-11-01 20:44 Francesco Pretto
  0 siblings, 0 replies; 206+ messages in thread
From: Francesco Pretto @ 2007-11-01 20:44 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-11-01 14:23 Heikki Orsila
  0 siblings, 0 replies; 206+ messages in thread
From: Heikki Orsila @ 2007-11-01 14:23 UTC (permalink / raw)
  To: git

>From bd2d661c565062eacc80dda90f3978303308f9bb Mon Sep 17 00:00:00 2001
From: Heikki Orsila <heikki.orsila@iki.fi>
Date: Thu, 1 Nov 2007 16:21:39 +0200
Subject: [PATCH] Make git-clone obey "--" (end argument parsing)

---
 Documentation/git-clone.txt |    2 +-
 git-clone.sh                |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 253f4f0..7fdcd42 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 'git-clone' [--template=<template_directory>]
 	  [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare]
 	  [-o <name>] [-u <upload-pack>] [--reference <repository>]
-	  [--depth <depth>] <repository> [<directory>]
+	  [--depth <depth>] [--] <repository> [<directory>]
 
 DESCRIPTION
 -----------
diff --git a/git-clone.sh b/git-clone.sh
index 0ea3c24..3f00693 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -14,7 +14,7 @@ die() {
 }
 
 usage() {
-	die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] <repo> [<dir>]"
+	die "Usage: $0 [--template=<template_directory>] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [--depth <n>] [-n] [--] <repo> [<dir>]"
 }
 
 get_repo_base() {
@@ -160,6 +160,9 @@ while
 	*,--depth)
 		shift
 		depth="--depth=$1";;
+	*,--)
+		shift
+		break ;;
 	*,-*) usage ;;
 	*) break ;;
 	esac
-- 
1.5.3.4.498.g9c514-dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-10-22 18:16 racin
  0 siblings, 0 replies; 206+ messages in thread
From: racin @ 2007-10-22 18:16 UTC (permalink / raw)
  To: git


Hello,

I found the following on the development version of git.el: saving
non-git-managed files in Emacs threw an error.

It is due to a simple error in the call to condition-case in a
recently added function, git-update-save-file.

I attached the patch for your convenience.

Regards,
Matthieu Lemerre

PS: Please Cc me when you ackwowledge; I'm not subscribed to the list.
As a matter of fact, I found the bug only because I didn't find git.el
for my distribution (debian) so I got directly from the development
version on the website.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2007-10-13  4:01 Michael Witten
  0 siblings, 0 replies; 206+ messages in thread
From: Michael Witten @ 2007-10-13  4:01 UTC (permalink / raw)
  To: git; +Cc: Jeff King

I apologize if this is received twice.
I did add some comments, though!



On 12 Oct 2007, at 10:49:10 PM, Jeff King wrote:
> You are presumably doing a 'git-pull' on the cvsimport-ed commits. Try
> doing a git-rebase, which will filter out commits which make the same
> changes. Yes, it means throwing away your original commits, but the  
> new
> ones should be morally equivalent (and are now the "official" upstream
> of the CVS repository).

Now that you mention it, I think the best approach would be to:
	
	(1) cvsexportcommit
	(2) git reset --hard LAST_CVS_IMPORT_AND_MERGE
	(3) git cvsimport ..... # and merge

I think this is what you mean; it seems to me that rebasing isn't  
quite that.

However, this will not preserve more complicated history such as merges
from another git repository.

Basically, I want to treat my git repository as the official  
repository; the CVS
repo is just their for the old farts to get the latest stuff ;-P

Thanks!

Michael

PS
Please send me other opinions.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-09-04 13:59 Russ Brown
  0 siblings, 0 replies; 206+ messages in thread
From: Russ Brown @ 2007-09-04 13:59 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-08-19 22:04 Luciano Rocha
  0 siblings, 0 replies; 206+ messages in thread
From: Luciano Rocha @ 2007-08-19 22:04 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-07-01 18:25 Sean D'Epagnier
  0 siblings, 0 replies; 206+ messages in thread
From: Sean D'Epagnier @ 2007-07-01 18:25 UTC (permalink / raw)
  To: git

unsubscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
  2007-06-13  4:52 ` Junio C Hamano
@ 2007-06-13 11:17   ` Johannes Schindelin
  0 siblings, 0 replies; 206+ messages in thread
From: Johannes Schindelin @ 2007-06-13 11:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[PATCH] Interpret :/<pattern> as a regular expression

Earlier, Git interpreted the pattern as a strict prefix, which made
the operator unsuited in many cases.

Now, the pattern is interpreted as a regular expression, on the whole
message, so that you can say

	git diff :/.*^Signed-off-by:.Zack.Brown

to see the diff against the most recent reachable commit which was
signed off by Zack, whose Kernel Cousin I miss very much.

If you want to match just the oneline, but with a regular expression,
say something like

	git diff ':/[^
]*intelligent'

Since it makes more sense to match the beginning of a message (otherwise,
a pattern like ':/git-gui: Improve' would match the _merge_ commit, 
pulling in the commit you are likely to want), the implementation uses the 
regmatch parameter of regexec() to anchor the pattern there.

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

	Anyone who can teach me how to match / not-match a newline
	using a more elegant syntax, please do so, by all means.

 Documentation/git-rev-parse.txt |    6 +++---
 sha1_name.c                     |   31 +++++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 6380676..56e1561 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -194,9 +194,9 @@ blobs contained in a commit.
   found.
 
 * A colon, followed by a slash, followed by a text: this names
-  a commit whose commit message starts with the specified text.
-  This name returns the youngest matching commit which is
-  reachable from any ref.  If the commit message starts with a
+  a commit whose commit message starts with the specified regular
+  expression.  This name returns the youngest matching commit which
+  is reachable from any ref.  If the commit message starts with a
   '!', you have to repeat that;  the special sequence ':/!',
   followed by something else than '!' is reserved for now.
 
diff --git a/sha1_name.c b/sha1_name.c
index d9188ed..988d599 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -599,8 +599,8 @@ static int handle_one_ref(const char *path,
 
 /*
  * This interprets names like ':/Initial revision of "git"' by searching
- * through history and returning the first commit whose message starts
- * with the given string.
+ * through history and returning the first commit whose message matches
+ * the given regular expression.
  *
  * For future extension, ':/!' is reserved. If you want to match a message
  * beginning with a '!', you have to repeat the exclamation mark.
@@ -611,34 +611,53 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1)
 {
 	struct commit_list *list = NULL, *backup = NULL, *l;
 	int retval = -1;
+	regex_t regexp;
+	regmatch_t regmatch[1];
+	char *temp_commit_buffer = NULL;
 
 	if (prefix[0] == '!') {
 		if (prefix[1] != '!')
 			die ("Invalid search pattern: %s", prefix);
 		prefix++;
 	}
-	if (!save_commit_buffer)
-		return error("Could not expand oneline-name.");
 	for_each_ref(handle_one_ref, &list);
 	for (l = list; l; l = l->next)
 		commit_list_insert(l->item, &backup);
+	if (regcomp(&regexp, prefix, 0))
+		return error("invalid regexp: %s", prefix);
 	while (list) {
 		char *p;
 		struct commit *commit;
+		enum object_type type;
+		unsigned long size;
 
 		commit = pop_most_recent_commit(&list, ONELINE_SEEN);
 		parse_object(commit->object.sha1);
-		if (!commit->buffer || !(p = strstr(commit->buffer, "\n\n")))
+		if (temp_commit_buffer)
+			free(temp_commit_buffer);
+		if (commit->buffer)
+			p = commit->buffer;
+		else {
+			p = read_sha1_file(commit->object.sha1, &type, &size);
+			if (!p)
+				continue;
+			temp_commit_buffer = p;
+		}
+		if (!(p = strstr(p, "\n\n")))
 			continue;
-		if (!prefixcmp(p + 2, prefix)) {
+		if (!regexec(&regexp, p + 2, 1, regmatch, 0) &&
+				regmatch[0].rm_so == 0) {
 			hashcpy(sha1, commit->object.sha1);
 			retval = 0;
 			break;
 		}
 	}
+	if (temp_commit_buffer)
+		free(temp_commit_buffer);
 	free_commit_list(list);
 	for (l = backup; l; l = l->next)
 		clear_commit_marks(l->item, ONELINE_SEEN);
+	regfree(&regexp);
 	return retval;
 }
 
-- 
1.5.2.1.2827.gba84a8-dirty

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-06-03 15:30 Randal L. Schwartz
  0 siblings, 0 replies; 206+ messages in thread
From: Randal L. Schwartz @ 2007-06-03 15:30 UTC (permalink / raw)
  To: git

>From 8948e5c81bf39ca7a8118746e4ca60b3b1566efa Mon Sep 17 00:00:00 2001
From: Randal L. Schwartz <merlyn@stonehenge.com>
Date: Sun, 3 Jun 2007 08:27:52 -0700
Subject: [PATCH] Add test-sha1 to .gitignore.

---
 .gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 15aed70..8e75c99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -151,6 +151,7 @@ test-delta
 test-dump-cache-tree
 test-genrandom
 test-match-trees
+test-sha1
 common-cmds.h
 *.tar.gz
 *.dsc
-- 
1.5.2.1.111.gc94b

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2007-05-06  3:51 Aaron Gray
  0 siblings, 0 replies; 206+ messages in thread
From: Aaron Gray @ 2007-05-06  3:51 UTC (permalink / raw)
  To: Git Mailing List

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2007-04-04 16:59 Geert Bosch
  0 siblings, 0 replies; 206+ messages in thread
From: Geert Bosch @ 2007-04-04 16:59 UTC (permalink / raw)
  To: git

From: Geert Bosch <bosch@gnat.com>
Date: Mon, 2 Apr 2007 11:24:46 +0200
Subject: [PATCH] find_pack_entry_one: Use interpolation search for finding objects in the pack index.

Also be careful about avoiding overflow in signed integer arithmetic.

Signed-off-by: Geert Bosch <bosch@gnat.com>
---
This patch is what I used in my experiments before proposing an
alternative file format for the index.  This gives about a 2.5%
speed-up for git-rev-list --all on the Linux repository,
while not changing anything at all for small repositories.
These tests were done on a Core 2 Duo MacBook Pro with Mac OS X.

While this passes the test suite, I'm not sure it should be applied,
because it doesn't really address the issues for very large repositories
with large numbers of pack files.

  -Geert

 sha1_file.c |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index 9c26038..e463710 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1547,14 +1547,39 @@ off_t find_pack_entry_one(const unsigned char *sha1,
 				  struct packed_git *p)
 {
 	const uint32_t *level1_ofs = p->index_data;
-	int hi = ntohl(level1_ofs[*sha1]);
-	int lo = ((*sha1 == 0x0) ? 0 : ntohl(level1_ofs[*sha1 - 1]));
+	const unsigned char level1_key = sha1[0];
+	const unsigned int level2_key =  (sha1[1] << 16) + (sha1[2] << 8)
+	    + sha1[3];
+	uint32_t hi = ntohl(level1_ofs[level1_key]);
+	uint32_t lo = !level1_key ? 0 : ntohl(level1_ofs[level1_key - 1]);
+	uint32_t mi = ((hi - lo) * (level2_key >> 13) >> 11)  + lo;
 	const unsigned char *index = p->index_data;
+	const int ents = hi - lo;
+
+        uint32_t try;
 
 	index += 4 * 256;
 
-	do {
-		int mi = (lo + hi) / 2;
+        if (ents < 0xffffff)
+        do {
+		int ofs = 24 * mi + 4;
+
+		try = ntohl(*((uint32_t *) (index + ofs))) & 0xffffff;
+
+		if (try < level2_key) {
+			lo = mi + 1;
+			mi = lo + (((level2_key - try) >> 16) * ents >> 8);
+			if (mi >= hi || mi < lo) mi = hi - 1;
+		}
+		else if (try > level2_key)
+		{
+			hi = mi;
+			mi = hi - 1 - (((try - level2_key) >> 16) * ents >> 8);
+			if (mi < lo || mi >= hi) mi = lo;
+		}
+	} while (try != level2_key && lo + (ents >> 8) < hi);
+
+        while (lo < hi) {
 		int cmp = hashcmp(index + 24 * mi + 4, sha1);
 		if (!cmp)
 			return ntohl(*((uint32_t *)((char *)index + (24 * mi))));
@@ -1562,7 +1587,9 @@ off_t find_pack_entry_one(const unsigned char *sha1,
 			hi = mi;
 		else
 			lo = mi+1;
-	} while (lo < hi);
+		mi = lo + (hi - lo) / 2;
+	};
+
 	return 0;
 }
 
-- 
1.4.5-rc0.GIT

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
  2007-03-19  6:40           ` Junio C Hamano
@ 2007-03-19 23:37             ` Sam Vilain
  0 siblings, 0 replies; 206+ messages in thread
From: Sam Vilain @ 2007-03-19 23:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> If you want to see if A is an ancestor of
> any of B C D..., the standard and most efficient way to do so is
> with rev-list.
>
> 	git rev-list A --not B C D...
>
> will show _nothing_ only when A is an ancestor of one (or more)
> of B C D..., so you invoke it and upon getting the first line of
> output you declare A cannot be removed without reading the
> remainder of the output.

Sure.  I figured the commands I put would only use about 30MB for a
300,000 commit repository, so it wouldn't be too bad.  But I didn't
think of that.

Here we go, also based upon 'next' rather than the result of my
previous patches of the day.

Subject: [PATCH] git-remote: implement prune -c

It would be nice to be able to prune local refs which just point to
some place in the remote; add an option to git-remote prune, with
documentation.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
 Documentation/git-remote.txt |    5 +++++
 git-remote.perl              |   25 +++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index f96b304..6a28e6c 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -54,6 +54,11 @@ Gives some information about the remote <name>.
 Deletes all stale tracking branches under <name>.
 These stale branches have already been removed from the remote repository
 referenced by <name>, but are still locally available in "remotes/<name>".
++
+With `-c` option, all *local* branches that exist in the history of
+any of the mirrored heads from the remote are removed.  This is useful
+for discarding temporary local branches that you did not make any
+commits to.
 
 
 DISCUSSION
diff --git a/git-remote.perl b/git-remote.perl
index 670bafb..84ac534 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -210,7 +210,7 @@ sub show_mapping {
 }
 
 sub prune_remote {
-	my ($name, $ls_remote) = @_;
+	my ($name, $ls_remote, $clean_local) = @_;
 	if (!exists $remote->{$name}) {
 		print STDERR "No such remote $name\n";
 		return;
@@ -224,6 +224,24 @@ sub prune_remote {
 		my @v = $git->command(qw(rev-parse --verify), "$prefix/$to_prune");
 		$git->command(qw(update-ref -d), "$prefix/$to_prune", $v[0]);
 	}
+	if ( $clean_local ) {
+		my @remote = map { (split " ")[0] }
+			$git->command(qw(for-each-ref), $prefix);
+		my %local = map { (split " ")[2,0] }
+			$git->command(qw(for-each-ref refs/heads));
+		my %not_remote = map { ($_ => undef) }
+			$git->command("rev-list", keys %local, "--not", @remote);
+		# don't delete the current branch
+		my ($checked_out) = $git->command(qw(symbolic-ref HEAD));
+
+		while ( my ($ref, $rev) = each %local ) {
+			next if $checked_out and $ref eq $checked_out;
+			if ( not exists $not_remote{$rev} ) {
+				print "$ref is obsolete\n";
+				$git->command(qw(update-ref -d), $ref, $rev);
+			}
+		}
+	}
 }
 
 sub show_remote {
@@ -310,6 +328,9 @@ elsif ($ARGV[0] eq 'prune') {
 		if ($ARGV[$i] eq '-n') {
 			$ls_remote = 0;
 		}
+		elsif ($ARGV[$i] eq '-c') {
+			$clean_local = 1;
+		}
 		else {
 			last;
 		}
@@ -319,7 +340,7 @@ elsif ($ARGV[0] eq 'prune') {
 		exit(1);
 	}
 	for (; $i < @ARGV; $i++) {
-		prune_remote($ARGV[$i], $ls_remote);
+		prune_remote($ARGV[$i], $ls_remote, $clean_local);
 	}
 }
 elsif ($ARGV[0] eq 'add') {
-- 
1.5.0.2.214.gb318

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-11-21 22:24 Johannes Schindelin
  0 siblings, 0 replies; 206+ messages in thread
From: Johannes Schindelin @ 2006-11-21 22:24 UTC (permalink / raw)
  To: Davide Libenzi, git

[PATCH] xdiff: add xdl_merge()

This new function implements the functionality of RCS merge, but
in-memory. It returns < 0 on error, otherwise the number of conflicts.

Finding the conflicting lines can be a very expensive task. You can
control the eagerness of this algorithm:

- a level value of 0 means that all overlapping changes are treated
  as conflicts,
- a value of 1 means that if the overlapping changes are identical,
  it is not treated as a conflict.
- If you set level to 2, overlapping changes will be analyzed, so that
  almost identical changes will not result in huge conflicts. Rather,
  only the conflicting lines will be shown inside conflict markers.

With each increasing level, the algorithm gets slower, but more accurate.
Note that the code for level 2 depends on the simple definition of
mmfile_t specific to git, and therefore it will be harder to port that
to LibXDiff.

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

---

	This code is only lightly tested, but I am tired and hungry.

	My hopes are that when I wake up in the morning, all bugs are
	fixed, git-merge-one-file is rewritten as a builtin,
	git-merge-index defaults to calling xdl_merge() directly when
	no program is passed with "-o", and git-merge-recursive also
	avoids fork()ing RCS' merge.

	A funny side effect is that you can merge with white space
	corruption by setting the xpparam flags to ignore whitespace.
	The file passed as mf1 wins over mf2 in that case.

	Oh, and maybe I did not need to use xdl_change_compact() (and
	thus could have left that static to xdiffi.c)? Davide, if you 
	could enlighten me, I will take the time next weekend to port this 
	to LibXDiff ;-)

	BTW if anybody wonders why these diffstats do not look correct:
	"git apply --stat" does not yet have our new scaling...

 Makefile       |    3 
 xdiff/xdiff.h  |    7 +
 xdiff/xdiffi.c |    3 
 xdiff/xdiffi.h |    1 
 xdiff/xmerge.c |  433 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 444 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 4c3f87f..b10d65e 100644
--- a/Makefile
+++ b/Makefile
@@ -769,7 +769,8 @@ $(DIFF_OBJS): diffcore.h
 $(LIB_FILE): $(LIB_OBJS)
 	rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
 
-XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o
+XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
+	xdiff/xmerge.o
 $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
 
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index c9f8178..fa409d5 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -49,6 +49,9 @@ extern "C" {
 #define XDL_BDOP_CPY 2
 #define XDL_BDOP_INSB 3
 
+#define XDL_MERGE_MINIMAL 0
+#define XDL_MERGE_EAGER 1
+#define XDL_MERGE_ZEALOUS 2
 
 typedef struct s_mmfile {
 	char *ptr;
@@ -90,6 +93,10 @@ long xdl_mmfile_size(mmfile_t *mmf);
 int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
 	     xdemitconf_t const *xecfg, xdemitcb_t *ecb);
 
+int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
+		mmfile_t *mf2, const char *name2,
+		xpparam_t const *xpp, int level, mmbuffer_t *result);
+
 #ifdef __cplusplus
 }
 #endif /* #ifdef __cplusplus */
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index d76e76a..9aeebc4 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -45,7 +45,6 @@ static long xdl_split(unsigned long cons
 		      long *kvdf, long *kvdb, int need_min, xdpsplit_t *spl,
 		      xdalgoenv_t *xenv);
 static xdchange_t *xdl_add_change(xdchange_t *xscr, long i1, long i2, long chg1, long chg2);
-static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags);
 
 
 
@@ -397,7 +396,7 @@ static xdchange_t *xdl_add_change(xdchan
 }
 
 
-static int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
+int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 	long ix, ixo, ixs, ixref, grpsiz, nrec = xdf->nrec;
 	char *rchg = xdf->rchg, *rchgo = xdfo->rchg;
 	xrecord_t **recs = xdf->recs;
diff --git a/xdiff/xdiffi.h b/xdiff/xdiffi.h
index d3b7271..472aeae 100644
--- a/xdiff/xdiffi.h
+++ b/xdiff/xdiffi.h
@@ -50,6 +50,7 @@ int xdl_recs_cmp(diffdata_t *dd1, long o
 		 long *kvdf, long *kvdb, int need_min, xdalgoenv_t *xenv);
 int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
 		xdfenv_t *xe);
+int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags);
 int xdl_build_script(xdfenv_t *xe, xdchange_t **xscr);
 void xdl_free_script(xdchange_t *xscr);
 int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
new file mode 100644
index 0000000..7b85aa5
--- /dev/null
+++ b/xdiff/xmerge.c
@@ -0,0 +1,433 @@
+/*
+ *  LibXDiff by Davide Libenzi ( File Differential Library )
+ *  Copyright (C) 2003-2006 Davide Libenzi, Johannes E. Schindelin
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Davide Libenzi <davidel@xmailserver.org>
+ *
+ */
+
+#include "xinclude.h"
+
+typedef struct s_xdmerge {
+	struct s_xdmerge *next;
+	/*
+	 * 0 = conflict,
+	 * 1 = no conflict, take first,
+	 * 2 = no conflict, take second.
+	 */
+	int mode;
+	long i1, i2;
+	long chg1, chg2;
+} xdmerge_t;
+
+static int xdl_append_merge(xdmerge_t **merge, int mode,
+		long i1, long chg1, long i2, long chg2)
+{
+	xdmerge_t *m = *merge;
+	if (m && mode == m->mode &&
+			(i1 == m->i1 + m->chg1 || i2 == m->i2 + m->chg2)) {
+		m->chg1 = i1 + chg1 - m->i1;
+		m->chg2 = i2 + chg2 - m->i2;
+	} else {
+		m = xdl_malloc(sizeof(xdmerge_t));
+		if (!m)
+			return -1;
+		m->next = NULL;
+		m->mode = mode;
+		m->i1 = i1;
+		m->chg1 = chg1;
+		m->i2 = i2;
+		m->chg2 = chg2;
+		if (*merge)
+			(*merge)->next = m;
+		*merge = m;
+	}
+	return 0;
+}
+
+static int xdl_cleanup_merge(xdmerge_t *c)
+{
+	int count = 0;
+	xdmerge_t *next_c;
+
+	/* were there conflicts? */
+	for (; c; c = next_c) {
+		if (c->mode == 0)
+			count++;
+		next_c = c->next;
+		free(c);
+	}
+	return count;
+}
+
+static int xdl_merge_cmp_lines(xdfenv_t *xe1, int i1, xdfenv_t *xe2, int i2,
+		int line_count, long flags)
+{
+	int i;
+	xrecord_t **rec1 = xe1->xdf2.recs + i1;
+	xrecord_t **rec2 = xe2->xdf2.recs + i2;
+
+	for (i = 0; i < line_count; i++) {
+		int result = xdl_recmatch(rec1[i]->ptr, rec1[i]->size,
+			rec2[i]->ptr, rec2[i]->size, flags);
+		if (!result)
+			return -1;
+	}
+	return 0;
+}
+
+static int xdl_recs_copy(xdfenv_t *xe, int i, int count, int add_nl, char *dest)
+{
+	xrecord_t **recs = xe->xdf2.recs + i;
+	int size = 0;
+
+	if (count < 1)
+		return 0;
+
+	for (i = 0; i < count; size += recs[i++]->size)
+		if (dest)
+			memcpy(dest + size, recs[i]->ptr, recs[i]->size);
+	if (add_nl) {
+		i = recs[count - 1]->size;
+		if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
+			if (dest)
+				dest[size] = '\n';
+			size++;
+		}
+	}
+	return size;
+}
+
+static int xdl_fill_merge_buffer(xdfenv_t *xe1, const char *name1,
+		xdfenv_t *xe2, const char *name2, xdmerge_t *m, char *dest)
+{
+	const int marker_size = 7;
+	int marker1_size = (name1 ? strlen(name1) + 1 : 0);
+	int marker2_size = (name2 ? strlen(name2) + 1 : 0);
+	int conflict_marker_size = 3 * (marker_size + 1)
+		+ marker1_size + marker2_size;
+	int size, i1, j;
+
+	for (size = i1 = 0; m; m = m->next) {
+		if (m->mode == 0) {
+			size += xdl_recs_copy(xe1, i1, m->i1 - i1, 0,
+					dest ? dest + size : NULL);
+			if (dest) {
+				for (j = 0; j < marker_size; j++)
+					dest[size++] = '<';
+				if (marker1_size) {
+					dest[size] = ' ';
+					memcpy(dest + size + 1, name1,
+							marker1_size - 1);
+					size += marker1_size;
+				}
+				dest[size++] = '\n';
+			} else
+				size += conflict_marker_size;
+			size += xdl_recs_copy(xe1, m->i1, m->chg1, 1,
+					dest ? dest + size : NULL);
+			if (dest) {
+				for (j = 0; j < marker_size; j++)
+					dest[size++] = '=';
+				dest[size++] = '\n';
+			}
+			size += xdl_recs_copy(xe2, m->i2, m->chg2, 1,
+					dest ? dest + size : NULL);
+			if (dest) {
+				for (j = 0; j < marker_size; j++)
+					dest[size++] = '>';
+				if (marker2_size) {
+					dest[size] = ' ';
+					memcpy(dest + size + 1, name2,
+							marker2_size - 1);
+					size += marker2_size;
+				}
+				dest[size++] = '\n';
+			}
+		} else if (m->mode == 1)
+			size += xdl_recs_copy(xe1, i1, m->i1 + m->chg1 - i1, 0,
+					dest ? dest + size : NULL);
+		else if (m->mode == 2)
+			size += xdl_recs_copy(xe2, m->i2 - m->i1 + i1,
+					m->i1 + m->chg2 - i1, 0,
+					dest ? dest + size : NULL);
+		i1 = m->i1 + m->chg1;
+	}
+	size += xdl_recs_copy(xe1, i1, xe1->xdf2.nrec - i1, 0,
+			dest ? dest + size : NULL);
+	return size;
+}
+
+/*
+ * Sometimes, changes are not quite identical, but differ in only a few
+ * lines. Try hard to show only these few lines as conflicting.
+ */
+static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m,
+		xpparam_t const *xpp)
+{
+	for (; m; m = m->next) {
+		mmfile_t t1, t2;
+		xdfenv_t xe;
+		xdchange_t *xscr, *x;
+		int i1 = m->i1, i2 = m->i2;
+
+		/* let's handle just the conflicts */
+		if (m->mode)
+			continue;
+
+		/*
+		 * This probably does not work outside git, since
+		 * we have a very simple mmfile structure.
+		 */
+		t1.ptr = (char *)xe1->xdf2.recs[m->i1]->ptr;
+		t1.size = xe1->xdf2.recs[m->i1 + m->chg1]->ptr
+			+ xe1->xdf2.recs[m->i1 + m->chg1]->size - t1.ptr;
+		t2.ptr = (char *)xe2->xdf2.recs[m->i1]->ptr;
+		t2.size = xe2->xdf2.recs[m->i1 + m->chg1]->ptr
+			+ xe2->xdf2.recs[m->i1 + m->chg1]->size - t2.ptr;
+		if (xdl_do_diff(&t1, &t2, xpp, &xe) < 0)
+			return -1;
+		if (xdl_change_compact(&xe.xdf1, &xe.xdf2, xpp->flags) < 0 ||
+		    xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
+		    xdl_build_script(&xe, &xscr) < 0) {
+			xdl_free_env(&xe);
+			return -1;
+		}
+		if (!xscr) {
+			/* If this happens, it's a bug. */
+			xdl_free_env(&xe);
+			return -2;
+		}
+		x = xscr;
+		m->i1 = xscr->i1 + i1;
+		m->chg1 = xscr->chg1;
+		m->i2 = xscr->i2 + i2;
+		m->chg2 = xscr->chg2;
+		while (xscr->next) {
+			xdmerge_t *m2 = xdl_malloc(sizeof(xdmerge_t));
+			if (!m2) {
+				xdl_free_env(&xe);
+				xdl_free_script(x);
+				return -1;
+			}
+			xscr = xscr->next;
+			m2->next = m->next;
+			m->next = m2;
+			m = m2;
+			m->mode = 0;
+			m->i1 = xscr->i1 + i1;
+			m->chg1 = xscr->chg1;
+			m->i2 = xscr->i2 + i2;
+			m->chg2 = xscr->chg2;
+		}
+		xdl_free_env(&xe);
+		xdl_free_script(x);
+	}
+	return 0;
+}
+
+/*
+ * level == 0: mark all overlapping changes as conflict
+ * level == 1: mark overlapping changes as conflict only if not identical
+ * level == 2: analyze non-identical changes for minimal conflict set
+ *
+ * returns < 0 on error, == 0 for no conflicts, else number of conflicts
+ */
+static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
+		xdfenv_t *xe2, xdchange_t *xscr2, const char *name2,
+		int level, xpparam_t const *xpp, mmbuffer_t *result) {
+	xdmerge_t *changes, *c;
+	int i1, i2, chg1, chg2;
+
+	c = changes = NULL;
+
+	while (xscr1 && xscr2) {
+		if (!changes)
+			changes = c;
+		if (xscr1->i1 + xscr1->chg1 < xscr2->i1) {
+			i1 = xscr1->i2;
+			i2 = xscr2->i2 - xscr2->i1 + xscr1->i1;
+			chg1 = xscr1->chg2;
+			chg2 = xscr1->chg1;
+			if (xdl_append_merge(&c, 1, i1, chg1, i2, chg2)) {
+				xdl_cleanup_merge(changes);
+				return -1;
+			}
+			xscr1 = xscr1->next;
+			continue;
+		}
+		if (xscr2->i1 + xscr2->chg1 < xscr1->i1) {
+			i1 = xscr1->i2 - xscr1->i1 + xscr2->i1;
+			i2 = xscr2->i2;
+			chg1 = xscr2->chg1;
+			chg2 = xscr2->chg2;
+			if (xdl_append_merge(&c, 2, i1, chg1, i2, chg2)) {
+				xdl_cleanup_merge(changes);
+				return -1;
+			}
+			xscr2 = xscr2->next;
+			continue;
+		}
+		if (level < 1 || xscr1->i1 != xscr2->i1 ||
+				xscr1->chg1 != xscr2->chg1 ||
+				xscr1->chg2 != xscr2->chg2 ||
+				xdl_merge_cmp_lines(xe1, xscr1->i2,
+					xe2, xscr2->i2,
+					xscr1->chg2, xpp->flags)) {
+			/* conflict */
+			int off = xscr1->i1 - xscr2->i1;
+			int ffo = off + xscr1->chg1 - xscr2->chg1;
+
+			i1 = xscr1->i2;
+			i2 = xscr2->i2;
+			if (off > 0)
+				i1 -= off;
+			else
+				i2 += off;
+			chg1 = xscr1->i2 + xscr1->chg2 - i1;
+			chg2 = xscr2->i2 + xscr2->chg2 - i2;
+			if (ffo > 0)
+				chg2 += ffo;
+			else
+				chg1 -= ffo;
+			if (xdl_append_merge(&c, 0, i1, chg1, i2, chg2)) {
+				xdl_cleanup_merge(changes);
+				return -1;
+			}
+		}
+
+		i1 = xscr1->i1 + xscr1->chg1;
+		i2 = xscr2->i1 + xscr2->chg1;
+
+		if (i1 > i2) {
+			xscr1->chg1 -= i1 - i2;
+			xscr1->i1 = i2;
+			xscr1->i2 += xscr1->chg2;
+			xscr1->chg2 = 0;
+			xscr1 = xscr1->next;
+		} else if (i2 > i1) {
+			xscr2->chg1 -= i2 - i1;
+			xscr2->i1 = i1;
+			xscr2->i2 += xscr2->chg2;
+			xscr2->chg2 = 0;
+			xscr2 = xscr2->next;
+		} else {
+			xscr1 = xscr1->next;
+			xscr2 = xscr2->next;
+		}
+	}
+	while (xscr1) {
+		if (!changes)
+			changes = c;
+		i1 = xscr1->i2;
+		i2 = xscr1->i1 + xe2->xdf2.nrec - xe2->xdf1.nrec;
+		chg1 = xscr1->chg2;
+		chg2 = xscr1->chg1;
+		if (xdl_append_merge(&c, 1, i1, chg1, i2, chg2)) {
+			xdl_cleanup_merge(changes);
+			return -1;
+		}
+		xscr1 = xscr1->next;
+	}
+	while (xscr2) {
+		if (!changes)
+			changes = c;
+		i1 = xscr2->i1 + xe1->xdf2.nrec - xe1->xdf1.nrec;
+		i2 = xscr2->i2;
+		chg1 = xscr2->chg1;
+		chg2 = xscr2->chg2;
+		if (xdl_append_merge(&c, 2, i1, chg1, i2, chg2)) {
+			xdl_cleanup_merge(changes);
+			return -1;
+		}
+		xscr2 = xscr2->next;
+	}
+	if (!changes)
+		changes = c;
+	/* refine conflicts */
+	if (level > 1 && xdl_refine_conflicts(xe1, xe2, changes, xpp) < 0) {
+		xdl_cleanup_merge(changes);
+		return -1;
+	}
+	/* output */
+	if (result) {
+		int size = xdl_fill_merge_buffer(xe1, name1, xe2, name2,
+			changes, NULL);
+		result->ptr = xdl_malloc(size);
+		if (!result->ptr) {
+			xdl_cleanup_merge(changes);
+			return -1;
+		}
+		result->size = size;
+		xdl_fill_merge_buffer(xe1, name1, xe2, name2, changes,
+				result->ptr);
+	}
+	return xdl_cleanup_merge(changes);
+}
+
+int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
+		mmfile_t *mf2, const char *name2,
+		xpparam_t const *xpp, int level, mmbuffer_t *result) {
+	xdchange_t *xscr1, *xscr2;
+	xdfenv_t xe1, xe2;
+
+	result->ptr = NULL;
+	result->size = 0;
+
+	if (xdl_do_diff(orig, mf1, xpp, &xe1) < 0 ||
+			xdl_do_diff(orig, mf2, xpp, &xe2) < 0) {
+		return -1;
+	}
+	if (xdl_change_compact(&xe1.xdf1, &xe1.xdf2, xpp->flags) < 0 ||
+	    xdl_change_compact(&xe1.xdf2, &xe1.xdf1, xpp->flags) < 0 ||
+	    xdl_build_script(&xe1, &xscr1) < 0) {
+		xdl_free_env(&xe1);
+		return -1;
+	}
+	if (xdl_change_compact(&xe2.xdf1, &xe2.xdf2, xpp->flags) < 0 ||
+	    xdl_change_compact(&xe2.xdf2, &xe2.xdf1, xpp->flags) < 0 ||
+	    xdl_build_script(&xe2, &xscr2) < 0) {
+		xdl_free_env(&xe2);
+		return -1;
+	}
+	if (xscr1 || xscr2) {
+		if (!xscr1) {
+			result->ptr = xdl_malloc(mf2->size);
+			memcpy(result->ptr, mf2->ptr, mf2->size);
+			result->size = mf2->size;
+		} else if (!xscr2) {
+			result->ptr = xdl_malloc(mf1->size);
+			memcpy(result->ptr, mf1->ptr, mf1->size);
+			result->size = mf1->size;
+		} else if (xdl_do_merge(&xe1, xscr1, name1,
+					&xe2, xscr2, name2,
+					level, xpp, result) < 0) {
+			xdl_free_script(xscr1);
+			xdl_free_script(xscr2);
+			xdl_free_env(&xe1);
+			xdl_free_env(&xe2);
+			return -1;
+		}
+		xdl_free_script(xscr1);
+		xdl_free_script(xscr2);
+	}
+	xdl_free_env(&xe1);
+	xdl_free_env(&xe2);
+
+	return 0;
+}

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-26 13:22             ` (unknown) Josef Weidendorfer
@ 2006-10-26 15:35               ` Linus Torvalds
  0 siblings, 0 replies; 206+ messages in thread
From: Linus Torvalds @ 2006-10-26 15:35 UTC (permalink / raw)
  To: Josef Weidendorfer; +Cc: Junio C Hamano, Andy Parkins, git



On Thu, 26 Oct 2006, Josef Weidendorfer wrote:

> On Thursday 26 October 2006 00:20, Junio C Hamano wrote:
> > Heh, I spoke too fast.
> > 
> > 	"git log origin..master"
> > 
> > If you do not have none of .git/origin
> 
> Really? I thought refs are always looked up in ".git/refs" only?

Yes and no.

The "iterate over all refs" code only ever looks in the "refs" 
subdirectory, so when you _list_ refs, they won't ever be shown unless 
they are there. That affects a lot of programs (like "git ls-remote").

Also, a symlink-ref has to point into "refs/" or it is considered invalid.

But, there are two extra rules:

 - ".git/HEAD" is obviously special, and will show up separately even for 
   things like "git ls-remote", so even processes that _list_ things will 
   show it.

 - when you do a named lookup, stuff directly in ".git" will take 
   precedence over EVERYTHING, even if it is never listed. So for example, 
   if you have a branch named HEAD in .git/refs/heads/HEAD, it doesn't 
   matter. Your ".git/HEAD" will still be looked up first.

   Similarly, other "special heads", like ORIG_HEAD or MERGE_HEAD will be 
   looked up in .git, even though they will never be listed by anything.

So the "refs/" requirement is a real requirement for a "true ref", but it 
is still overruled by the rule that we have special refs in $GIT_DIR that 
always take precedence.

This also means, for example, that you can always give the "full" refname 
for lookup, ie

	git-rev-parse refs/heads/master

works, because that's the "full path" from the ".git" subdirectory. If we 
only ever looked things up inside "refs", you'd have to use 
"heads/master".


^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 22:20           ` (unknown) Junio C Hamano
  2006-10-26  7:14             ` (unknown) Andy Parkins
@ 2006-10-26 13:22             ` Josef Weidendorfer
  2006-10-26 15:35               ` (unknown) Linus Torvalds
  1 sibling, 1 reply; 206+ messages in thread
From: Josef Weidendorfer @ 2006-10-26 13:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Andy Parkins, git

On Thursday 26 October 2006 00:20, Junio C Hamano wrote:
> Heh, I spoke too fast.
> 
> 	"git log origin..master"
> 
> If you do not have none of .git/origin

Really? I thought refs are always looked up in ".git/refs" only?

> , .git/refs/origin, 
> .git/refs/tags/origin, .git/refs/heads/origin, nor
> .git/refs/remotes/origin, then .git/refs/remotes/origin/HEAD is
> what "origin" means (see get_sha1_basic() in sha1_name.c).

Yes.

However, IMHO it really should be a alias to "remotes/origin/<branch>",
depending on current "<branch>" you are on. AFAI can remember,
when implementing it, HEAD was choosen as sha1_name.c should not
cope with porcelain issues (e.g. getting current branch name).
It was the intention to change remotes/origin/HEAD in the porcelain
command before actual use.

Is this still sensible?


^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 22:20           ` (unknown) Junio C Hamano
@ 2006-10-26  7:14             ` Andy Parkins
  2006-10-26 13:22             ` (unknown) Josef Weidendorfer
  1 sibling, 0 replies; 206+ messages in thread
From: Andy Parkins @ 2006-10-26  7:14 UTC (permalink / raw)
  To: git


> > "git log remotes/origin..master" perhaps?
> >
> > The point being, remotes/origin when origin is a directory that
> > has HEAD that points at something, it stands for
> > remotes/origin/HEAD.
>
> Heh, I spoke too fast.
>
> 	"git log origin..master"
>
> If you do not have none of .git/origin, .git/refs/origin,
> .git/refs/tags/origin, .git/refs/heads/origin, nor
> .git/refs/remotes/origin, then .git/refs/remotes/origin/HEAD is
> what "origin" means (see get_sha1_basic() in sha1_name.c).

Again: you guys have thought of everything.

I believe then, that my problem is that I didn't find this written anywhere - 
would it be useful if I were to write a Documentation/ file about 
commit-ish/tree-ish that covered these issues?  Have I overlooked the 
existence of such a file already?



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 22:16         ` (unknown) Junio C Hamano
@ 2006-10-25 22:20           ` Junio C Hamano
  2006-10-26  7:14             ` (unknown) Andy Parkins
  2006-10-26 13:22             ` (unknown) Josef Weidendorfer
  0 siblings, 2 replies; 206+ messages in thread
From: Junio C Hamano @ 2006-10-25 22:20 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git

Junio C Hamano <junkio@cox.net> writes:

> Andy Parkins <andyparkins@gmail.com> writes:
>
>> On Wednesday 2006, October 25 19:38, Junio C Hamano wrote:
>>
>>> > I did try that, but then the branches don't appear in git branch.  I
>>> > still like that they exist.
>>>
>>> "git branch -r" perhaps.
>>
>> That's pretty good.  It makes things like
>>
>>   git-log remotes/origin/master..master
>>
>> A bit long winded, but it's certainly what I asked for.
>
> "git log remotes/origin..master" perhaps?
>
> The point being, remotes/origin when origin is a directory that
> has HEAD that points at something, it stands for
> remotes/origin/HEAD.

Heh, I spoke too fast.

	"git log origin..master"

If you do not have none of .git/origin, .git/refs/origin,
.git/refs/tags/origin, .git/refs/heads/origin, nor
.git/refs/remotes/origin, then .git/refs/remotes/origin/HEAD is
what "origin" means (see get_sha1_basic() in sha1_name.c).



^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 22:03       ` (unknown) Andy Parkins
  2006-10-25 22:16         ` (unknown) Junio C Hamano
@ 2006-10-25 22:16         ` Shawn Pearce
  1 sibling, 0 replies; 206+ messages in thread
From: Shawn Pearce @ 2006-10-25 22:16 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git

Andy Parkins <andyparkins@gmail.com> wrote:
> On Wednesday 2006, October 25 19:38, Junio C Hamano wrote:
> 
> > > I did try that, but then the branches don't appear in git branch.  I
> > > still like that they exist.
> >
> > "git branch -r" perhaps.
> 
> That's pretty good.  It makes things like
> 
>   git-log remotes/origin/master..master
> 
> A bit long winded, but it's certainly what I asked for.
> 
> You guys really have thought of everything.

Try the bash completion support in contrib/completion.  If you
are using the bash shell it does branch name completions for most
commands, including both sides of the '..' in log there.  At this
point I can't use Git without it.

-- 

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 22:03       ` (unknown) Andy Parkins
@ 2006-10-25 22:16         ` Junio C Hamano
  2006-10-25 22:20           ` (unknown) Junio C Hamano
  2006-10-25 22:16         ` (unknown) Shawn Pearce
  1 sibling, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2006-10-25 22:16 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git

Andy Parkins <andyparkins@gmail.com> writes:

> On Wednesday 2006, October 25 19:38, Junio C Hamano wrote:
>
>> > I did try that, but then the branches don't appear in git branch.  I
>> > still like that they exist.
>>
>> "git branch -r" perhaps.
>
> That's pretty good.  It makes things like
>
>   git-log remotes/origin/master..master
>
> A bit long winded, but it's certainly what I asked for.

"git log remotes/origin..master" perhaps?

The point being, remotes/origin when origin is a directory that
has HEAD that points at something, it stands for
remotes/origin/HEAD.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 18:38     ` (unknown) Junio C Hamano
@ 2006-10-25 22:03       ` Andy Parkins
  2006-10-25 22:16         ` (unknown) Junio C Hamano
  2006-10-25 22:16         ` (unknown) Shawn Pearce
  0 siblings, 2 replies; 206+ messages in thread
From: Andy Parkins @ 2006-10-25 22:03 UTC (permalink / raw)
  To: git

On Wednesday 2006, October 25 19:38, Junio C Hamano wrote:

> > I did try that, but then the branches don't appear in git branch.  I
> > still like that they exist.
>
> "git branch -r" perhaps.

That's pretty good.  It makes things like

  git-log remotes/origin/master..master

A bit long winded, but it's certainly what I asked for.

You guys really have thought of everything.


Andy
-- 
Dr Andrew Parkins, M Eng (Hons), AMIEE

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 14:49 (unknown) andyparkins
@ 2006-10-25 18:41 ` Junio C Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio C Hamano @ 2006-10-25 18:41 UTC (permalink / raw)
  To: andyparkins; +Cc: git

andyparkins@gmail.com writes:

> From b149c0fca7399030225750958bf5c962c3796b44 Mon Sep 17 00:00:00 2001
> From: Andy Parkins <andyparkins@gmail.com>
> Date: Wed, 25 Oct 2006 15:49:50 +0100
> Subject: [PATCH] Make new builtin cherry match documentation for "+" and "-"
> To: git@vger.kernel.org
> X-TUID: 218b478df3f8d847
> X-UID: 128
> X-Length: 1090
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> Message-Id: <200610251549.51121.andyparkins@gmail.com>

I'd be commenting on your patch but won't be able to take any of
them until these "Subject: (unknown)" are corrected.

> "+" and "-" don't match the documentation, where "+" means the patch /is/ in
> upstream, "-" means it isn't

The documentation was utterly wrong.  The comment at the
beginning of git-cherry.sh was better but slightly wrong.

I have a few fixes queued but I was busy for the last couple of
nights and haven't pushed them out.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 15:10   ` (unknown) Andy Parkins
  2006-10-25 15:31     ` (unknown) Karl Hasselström
@ 2006-10-25 18:38     ` Junio C Hamano
  2006-10-25 22:03       ` (unknown) Andy Parkins
  1 sibling, 1 reply; 206+ messages in thread
From: Junio C Hamano @ 2006-10-25 18:38 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git

Andy Parkins <andyparkins@gmail.com> writes:

> On Wednesday 2006 October 25 15:53, Jakub Narebski wrote:
>
>> Check if "git clone --use-separate-remote" isn't what you want.
>
> I did try that, but then the branches don't appear in git branch.  I still 
> like that they exist.

"git branch -r" perhaps.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 15:10   ` (unknown) Andy Parkins
@ 2006-10-25 15:31     ` Karl Hasselström
  2006-10-25 18:38     ` (unknown) Junio C Hamano
  1 sibling, 0 replies; 206+ messages in thread
From: Karl Hasselström @ 2006-10-25 15:31 UTC (permalink / raw)
  To: Andy Parkins; +Cc: git

On 2006-10-25 16:10:02 +0100, Andy Parkins wrote:

> My apologies to everyone for the constant noise I keep dumping on
> the list. I promise I'm trying really hard to be good.

I always try sending the patch to myself first, since something almost
always goes wrong on the first try. This helps against most problems,
but certainly not all. :-)

-- 
Karl Hasselström, kha@treskal.com

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 14:53 ` (unknown) Jakub Narebski
@ 2006-10-25 15:10   ` Andy Parkins
  2006-10-25 15:31     ` (unknown) Karl Hasselström
  2006-10-25 18:38     ` (unknown) Junio C Hamano
  0 siblings, 2 replies; 206+ messages in thread
From: Andy Parkins @ 2006-10-25 15:10 UTC (permalink / raw)
  To: git

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

On Wednesday 2006 October 25 15:53, Jakub Narebski wrote:

> Check if "git clone --use-separate-remote" isn't what you want.

I did try that, but then the branches don't appear in git branch.  I still 
like that they exist.

> And please correct mail sending.

AHHHH!!! I thought I had.  Dagnamit; I think an upgrade in Debian overwrote my 
manual git-imap-send compile.  The git-imap-send bug was fixed in 
e0b0830726286287744cc9e1a629a534bbe75452, but doesn't seem to have made it 
into debian yet.

I'm getting so sick of looking like an idiot.

My apologies to everyone for the constant noise I keep dumping on the list.  I 
promise I'm trying really hard to be good.


Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com

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

^ permalink raw reply	[flat|nested] 206+ messages in thread

* Re: (unknown)
  2006-10-25 14:47 (unknown) andyparkins
@ 2006-10-25 14:53 ` Jakub Narebski
  2006-10-25 15:10   ` (unknown) Andy Parkins
  0 siblings, 1 reply; 206+ messages in thread
From: Jakub Narebski @ 2006-10-25 14:53 UTC (permalink / raw)
  To: git

andyparkins@gmail.com wrote:

> To easily differentiate the read-only upstream branches, from normal branches,
> default to cloning them with the prefix "up/" added to their branch names.
> This also abandons the idea of an "origin" branch which is now simply
> "up/master" and hence removes the special treatment that master was getting.
> (cherry picked from 33d89375652222c41fbf225f1e1c3bfb38b755b2 commit)
> Signed-off-by: Andy Parkins <andyparkins@gmail.com>
> ---
> I'm sure this will be an unwanted patch.  However, I really do think it's 
> important to highlight these upstream branches in some way.  I realise 
> renaming "origin" is probably not going to fly, but perhaps it would be okay 
> to have at least the non-origin branches prefixed?

Check if "git clone --use-separate-remote" isn't what you want.

And please correct mail sending.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-25 14:50 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-25 14:50 UTC (permalink / raw)


From f52af4e576cb1ad688c72f6cc1443443b7d12b69 Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Wed, 25 Oct 2006 15:50:03 +0100
Subject: [PATCH] git-clone documentation didn't mention --origin as equivalent of -o
To: git@vger.kernel.org
X-Length: 979
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200610251550.04024.andyparkins@gmail.com>

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 Documentation/git-clone.txt |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
X-TUID: 4aebd5773bc8eef9

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index f973c64..e22a036 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -75,6 +75,7 @@ OPTIONS
 	this option is used, neither the `origin` branch nor the
 	default `remotes/origin` file is created.
 
+--origin::
 -o <name>::
 	Instead of using the branch name 'origin' to keep track
 	of the upstream repository, use <name> instead.  Note
-- 
1.4.2.3

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-25 14:49 andyparkins
  2006-10-25 18:41 ` (unknown) Junio C Hamano
  0 siblings, 1 reply; 206+ messages in thread
From: andyparkins @ 2006-10-25 14:49 UTC (permalink / raw)


From b149c0fca7399030225750958bf5c962c3796b44 Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Wed, 25 Oct 2006 15:49:50 +0100
Subject: [PATCH] Make new builtin cherry match documentation for "+" and "-"
To: git@vger.kernel.org
X-TUID: 218b478df3f8d847
X-UID: 128
X-Length: 1090
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200610251549.51121.andyparkins@gmail.com>

"+" and "-" don't match the documentation, where "+" means the patch /is/ in
upstream, "-" means it isn't
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 builtin-log.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 840c742..8ded627 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -519,12 +519,12 @@ int cmd_cherry(int argc, const char **ar
 
 	while (list) {
 		unsigned char sha1[20];
-		char sign = '+';
+		char sign = '-';
 
 		commit = list->item;
 		if (!get_patch_id(commit, &patch_id_opts, sha1) &&
 		    lookup_object(sha1))
-			sign = '-';
+			sign = '+';
 
 		if (verbose) {
 			static char buf[16384];
-- 
1.4.2.3


^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-25 14:49 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-25 14:49 UTC (permalink / raw)


From cf13955d13b8b6a86dd1f6340565e16500b3cf38 Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Wed, 25 Oct 2006 15:49:34 +0100
Subject: [PATCH] Minor grammar fixes for git-diff-index.txt
To: git@vger.kernel.org
X-TUID: c63a7eaedc72a5ce
X-UID: 129
X-Length: 2247
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200610251549.34193.andyparkins@gmail.com>

"what you are going to commit is" doesn't need the "is" and does need a comma.

"can trivially see" is an unecessary split infinitive and "easily" is a more
appropriate adverb.

"case where you" should be "case were you" as it's the past tense form of the
verb "to be", rather than a location (I think :-) ).
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 Documentation/git-diff-index.txt |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-diff-index.txt 
b/Documentation/git-diff-index.txt
index 9cd43f1..ad1e903 100644
--- a/Documentation/git-diff-index.txt
+++ b/Documentation/git-diff-index.txt
@@ -54,7 +54,7 @@ If '--cached' is specified, it allows yo
 
 For example, let's say that you have worked on your working directory, 
updated
 some files in the index and are ready to commit. You want to see exactly
-*what* you are going to commit is without having to write a new tree
+*what* you are going to commit, without having to write a new tree
 object and compare it that way, and to do that, you just do
 
 	git-diff-index --cached HEAD
@@ -68,11 +68,11 @@ matches my working directory. But doing 
   -100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        commit.c
   +100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        
git-commit.c
 
-You can trivially see that the above is a rename.
+You can see easily that the above is a rename.
 
 In fact, "git-diff-index --cached" *should* always be entirely equivalent to
 actually doing a "git-write-tree" and comparing that. Except this one is much
-nicer for the case where you just want to check where you are.
+nicer for the case were you just want to check where you are.
 
 So doing a "git-diff-index --cached" is basically very useful when you are
 asking yourself "what have I already marked for being committed, and 
-- 
1.4.2.3

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-25 14:47 andyparkins
  2006-10-25 14:53 ` (unknown) Jakub Narebski
  0 siblings, 1 reply; 206+ messages in thread
From: andyparkins @ 2006-10-25 14:47 UTC (permalink / raw)


From cd4366ed4e3f765c00310c35c0eabeccf433acdb Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Wed, 25 Oct 2006 15:47:19 +0100
Subject: [PATCH] Use "up/" prefix for all the upstream branches
To: git@vger.kernel.org
X-TUID: aba1ff8a0c61615e
X-UID: 126
X-Length: 1359
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200610251547.19208.andyparkins@gmail.com>

To easily differentiate the read-only upstream branches, from normal branches,
default to cloning them with the prefix "up/" added to their branch names.
This also abandons the idea of an "origin" branch which is now simply
"up/master" and hence removes the special treatment that master was getting.
(cherry picked from 33d89375652222c41fbf225f1e1c3bfb38b755b2 commit)
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
I'm sure this will be an unwanted patch.  However, I really do think it's 
important to highlight these upstream branches in some way.  I realise 
renaming "origin" is probably not going to fly, but perhaps it would be okay 
to have at least the non-origin branches prefixed?

 git-clone.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-clone.sh b/git-clone.sh
index 3f006d1..ebd93da 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -185,7 +185,7 @@ fi
 
 if test -z "$origin"
 then
-	origin=origin
+	origin=up/master
 fi
 
 # Turn the source into an absolute path if
@@ -389,7 +389,7 @@ Pull: refs/heads/$head_points_at:$origin
 			then
 				continue
 			fi
-			echo "Pull: refs/heads/${name}:$remote_top/${name}"
+			echo "Pull: refs/heads/${name}:$remote_top/up/${name}"
 		done >>"$GIT_DIR/remotes/$origin" &&
 		case "$use_separate_remote" in
 		t)
-- 
1.4.2.3


^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-20 14:24 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-20 14:24 UTC (permalink / raw)


>From 0e3c0aefc3276bd271553d171ed9bcc52d85230e Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Fri, 20 Oct 2006 15:24:40 +0100
Subject: [PATCH] Use email address only for looking up signing key in git-tag
MIME-Version: 1.0
X-TUID: 260426abfb2864ec
X-Length: 2046
To: git@vger.kernel.org
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_owNOFStzYauRv42"
Message-Id: <200610201524.40525.andyparkins@gmail.com>

This is a multi-part message in MIME format.
--Boundary-00=_owNOFStzYauRv42
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


I did this:

  $ git tag -s adp-sign-tag
  gpg: skipped "Andy Parkins <andyparkins@gmail.com>": secret key not 
available
  gpg: signing failed: secret key not available
  failed to sign the tag with GPG.

I believe the problem is that I have used the comment field in my key's UID
definition.

  $ gpg --list-keys andy
  pub   1024D/4F712F6D 2003-08-14
  uid                  Andy Parkins (Google) <andyparkins@gmail.com>

So when git-tag looks for "Andy Parkins <andyparkins@gmail.com>"; it's not
found.  The answer is (I think) to search only on the email address when
looking for a key.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 git-tag.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

--Boundary-00=_owNOFStzYauRv42
Content-Type: text/x-patch;
  name="0e3c0aefc3276bd271553d171ed9bcc52d85230e.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="0e3c0aefc3276bd271553d171ed9bcc52d85230e.diff"

diff --git a/git-tag.sh b/git-tag.sh
index a0afa25..6fd98e2 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -73,7 +73,7 @@ git-check-ref-format "tags/$name" ||
 object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
 type=$(git-cat-file -t $object) || exit 1
 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
-: ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
+: ${username:=$(expr "z$tagger" : 'z.*<\(.*\)>')}
 
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 

--Boundary-00=_owNOFStzYauRv42--

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-20 14:24 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-20 14:24 UTC (permalink / raw)


>From 9c128bc4b9b85385b7b98ceae0c89283d70e5d45 Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Fri, 20 Oct 2006 15:24:22 +0100
Subject: [PATCH] Remove git-send-email references from documentation
MIME-Version: 1.0
X-TUID: 1fbae8e75caaf795
X-Length: 1933
To: git@vger.kernel.org
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_WwNOFc8Re2ORHlu"
Message-Id: <200610201524.22493.andyparkins@gmail.com>

This is a multi-part message in MIME format.
--Boundary-00=_WwNOFc8Re2ORHlu
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


git-send-email doesn't exist; so don't refer to it in the documentation.

Perhaps git-send-email.perl is meant to do this job?  It runs with an error.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 Documentation/git-format-patch.txt |    2 +-
 Documentation/git.txt              |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

--Boundary-00=_WwNOFc8Re2ORHlu
Content-Type: text/x-patch;
  name="9c128bc4b9b85385b7b98ceae0c89283d70e5d45.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="9c128bc4b9b85385b7b98ceae0c89283d70e5d45.diff"

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 67425dc..9257030 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -112,7 +112,7 @@ git-format-patch -M -B origin::
 
 See Also
 --------
-gitlink:git-am[1], gitlink:git-send-email[1]
+gitlink:git-am[1]
 
 
 Author
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 3af6fc6..1f60d3f 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -478,9 +478,6 @@ gitlink:git-request-pull[1]::
 gitlink:git-rev-parse[1]::
 	Pick out and massage parameters.
 
-gitlink:git-send-email[1]::
-	Send patch e-mails out of "format-patch --mbox" output.
-
 gitlink:git-symbolic-ref[1]::
 	Read and modify symbolic refs.
 

--Boundary-00=_WwNOFc8Re2ORHlu--

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-20 14:21 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-20 14:21 UTC (permalink / raw)


>From 0e3c0aefc3276bd271553d171ed9bcc52d85230e Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Fri, 20 Oct 2006 15:21:02 +0100
Subject: [PATCH] Use email address only for looking up signing key in git-tag
To: git@vger.kernel.org
MIME-Version: 1.0
X-TUID: 312298ab1a3cb74a
X-UID: 98
X-Length: 2046
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_PtNOFMGj306NIAG"
Message-Id: <200610201521.03122.andyparkins@gmail.com>

This is a multi-part message in MIME format.
--Boundary-00=_PtNOFMGj306NIAG
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


I did this:

  $ git tag -s adp-sign-tag
  gpg: skipped "Andy Parkins <andyparkins@gmail.com>": secret key not 
available
  gpg: signing failed: secret key not available
  failed to sign the tag with GPG.

I believe the problem is that I have used the comment field in my key's UID
definition.

  $ gpg --list-keys andy
  pub   1024D/4F712F6D 2003-08-14
  uid                  Andy Parkins (Google) <andyparkins@gmail.com>

So when git-tag looks for "Andy Parkins <andyparkins@gmail.com>"; it's not
found.  The answer is (I think) to search only on the email address when
looking for a key.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 git-tag.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

--Boundary-00=_PtNOFMGj306NIAG
Content-Type: text/x-patch;
  name="0e3c0aefc3276bd271553d171ed9bcc52d85230e.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="0e3c0aefc3276bd271553d171ed9bcc52d85230e.diff"

diff --git a/git-tag.sh b/git-tag.sh
index a0afa25..6fd98e2 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -73,7 +73,7 @@ git-check-ref-format "tags/$name" ||
 object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
 type=$(git-cat-file -t $object) || exit 1
 tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
-: ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
+: ${username:=$(expr "z$tagger" : 'z.*<\(.*\)>')}
 
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 

--Boundary-00=_PtNOFMGj306NIAG--

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-10-20 13:25 andyparkins
  0 siblings, 0 replies; 206+ messages in thread
From: andyparkins @ 2006-10-20 13:25 UTC (permalink / raw)


>From 9c128bc4b9b85385b7b98ceae0c89283d70e5d45 Mon Sep 17 00:00:00 2001
From: Andy Parkins <andyparkins@gmail.com>
Date: Fri, 20 Oct 2006 14:25:48 +0100
Subject: [PATCH] Remove git-send-email references from documentation
To: git@vger.kernel.org
MIME-Version: 1.0
X-TUID: 17b00343571b31b8
X-UID: 99
X-Length: 1933
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_c5MOFrK5Yix34S1"
Message-Id: <200610201425.48598.andyparkins@gmail.com>

This is a multi-part message in MIME format.
--Boundary-00=_c5MOFrK5Yix34S1
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


git-send-email doesn't exist; so don't refer to it in the documentation.

Perhaps git-send-email.perl is meant to do this job?  It runs with an error.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 Documentation/git-format-patch.txt |    2 +-
 Documentation/git.txt              |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

--Boundary-00=_c5MOFrK5Yix34S1
Content-Type: text/x-patch;
  name="9c128bc4b9b85385b7b98ceae0c89283d70e5d45.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="9c128bc4b9b85385b7b98ceae0c89283d70e5d45.diff"

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 67425dc..9257030 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -112,7 +112,7 @@ git-format-patch -M -B origin::
 
 See Also
 --------
-gitlink:git-am[1], gitlink:git-send-email[1]
+gitlink:git-am[1]
 
 
 Author
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 3af6fc6..1f60d3f 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -478,9 +478,6 @@ gitlink:git-request-pull[1]::
 gitlink:git-rev-parse[1]::
 	Pick out and massage parameters.
 
-gitlink:git-send-email[1]::
-	Send patch e-mails out of "format-patch --mbox" output.
-
 gitlink:git-symbolic-ref[1]::
 	Read and modify symbolic refs.
 

--Boundary-00=_c5MOFrK5Yix34S1--

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2006-10-05  1:54 JOSEPH KULIG
  0 siblings, 0 replies; 206+ messages in thread
From: JOSEPH KULIG @ 2006-10-05  1:54 UTC (permalink / raw)
  To: majordomo

unsubscribe jkulig@everstream.com

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-09-24 21:55 sonny132390
  0 siblings, 0 replies; 206+ messages in thread
From: sonny132390 @ 2006-09-24 21:55 UTC (permalink / raw)




^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-09-21  4:04 Nicolas Pitre
  0 siblings, 0 replies; 206+ messages in thread
From: Nicolas Pitre @ 2006-09-21  4:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[PATCH 1/6] move pack creation to version 3

It's been quite a while now that GIT is able to read version 3 packs.
Let's create them at last.

Signed-off-by: Nicolas Pitre <nico@cam.org>

diff --git a/diff-delta.c b/diff-delta.c
index fa16d06..51df460 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -308,8 +308,8 @@ create_delta(const struct delta_index *i
 				continue;
 			if (ref_size > top - src)
 				ref_size = top - src;
-			if (ref_size > 0x10000)
-				ref_size = 0x10000;
+			if (ref_size > 0xffffff)
+				ref_size = 0xffffff;
 			if (ref_size <= msize)
 				break;
 			while (ref_size-- && *src++ == *ref)
@@ -318,6 +318,8 @@ create_delta(const struct delta_index *i
 				/* this is our best match so far */
 				msize = ref - entry->ptr;
 				moff = entry->ptr - ref_data;
+				if (msize >= 0x10000)
+					break;  /* this is good enough */
 			}
 		}
 
@@ -381,6 +383,8 @@ create_delta(const struct delta_index *i
 			if (msize & 0xff) { out[outpos++] = msize; i |= 0x10; }
 			msize >>= 8;
 			if (msize & 0xff) { out[outpos++] = msize; i |= 0x20; }
+			msize >>= 8;
+			if (msize & 0xff) { out[outpos++] = msize; i |= 0x40; }
 
 			*op = i;
 		}
diff --git a/pack.h b/pack.h
index eb07b03..05557da 100644
--- a/pack.h
+++ b/pack.h
@@ -7,7 +7,7 @@ #include "object.h"
  * Packed object header
  */
 #define PACK_SIGNATURE 0x5041434b	/* "PACK" */
-#define PACK_VERSION 2
+#define PACK_VERSION 3
 #define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
 struct pack_header {
 	unsigned int hdr_signature;

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2006-09-09 21:46 Rajkumar S
  0 siblings, 0 replies; 206+ messages in thread
From: Rajkumar S @ 2006-09-09 21:46 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2006-08-18 10:35 Wolfgang Denk
  0 siblings, 0 replies; 206+ messages in thread
From: Wolfgang Denk @ 2006-08-18 10:35 UTC (permalink / raw)
  To: git

Hi,

"gitk" procudes output like this:

	Author: Stefan Roese <sr@denx.de>  2006-01-26 13:51:42
	Committer: Stefan Roese <sr@denx.de>  2006-01-26 13:51:42
	Parent: f565c2d4c8b945b5bfbafb8dda50b8784167b4e3 (Merge with /home/git/linux-2.6)
	Child:  d216d89489cce4021a75dea19ef1b19ad93958ec (Git rid of debug output.) Branches: origin, master
	Follows: DENX-v2.6.15
	Precedes: DENX-2006-02-01-2215

Is there a CLI tool or a hidden option to "git log"  or  "cg-log"  or
some  other  clever command to get similar "Follows:" and "Precedes:"
tag information?

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The IQ of the group is the lowest IQ of a member of the group divided
by the number of people in the group.

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2006-07-01 15:33 Mark
  0 siblings, 0 replies; 206+ messages in thread
From: Mark @ 2006-07-01 15:33 UTC (permalink / raw)
  To: git

 One of your friends used our send-to-a-friend-option: Check this out:
register for job alert, as well as i did - http://job-alert.net

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-05-26 15:16 Juergen Ruehle
  0 siblings, 0 replies; 206+ messages in thread
From: Juergen Ruehle @ 2006-05-26 15:16 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
  2006-05-21 23:53 ` (unknown) J. Bruce Fields
@ 2006-05-21 23:53   ` J. Bruce Fields
  0 siblings, 0 replies; 206+ messages in thread
From: J. Bruce Fields @ 2006-05-21 23:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

>From nobody Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <bfields@citi.umich.edu>
Date: Sun, 21 May 2006 19:49:34 -0400
Subject: [PATCH 3/3] tutorial: add discussion of index file, object database

Add a sequel to tutorial.txt which discusses the index file and
the object database.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

---

e84a9b9a34794c5b9dd36f6ccc11e60daecd3003
 Documentation/Makefile       |    1 
 Documentation/tutorial-2.txt |  391 ++++++++++++++++++++++++++++++++++++++++++
 Documentation/tutorial.txt   |   28 ++-
 3 files changed, 414 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/tutorial-2.txt

e84a9b9a34794c5b9dd36f6ccc11e60daecd3003
diff --git a/Documentation/Makefile b/Documentation/Makefile
index c1af22c..2a08f59 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -7,6 +7,7 @@ MAN7_TXT=git.txt
 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
 
 ARTICLES = tutorial
+ARTICLES += tutorial-2
 ARTICLES += core-tutorial
 ARTICLES += cvs-migration
 ARTICLES += diffcore
diff --git a/Documentation/tutorial-2.txt b/Documentation/tutorial-2.txt
new file mode 100644
index 0000000..a3d45ee
--- /dev/null
+++ b/Documentation/tutorial-2.txt
@@ -0,0 +1,391 @@
+A tutorial introduction to git: part two
+========================================
+
+You should work through link:tutorial.html[A tutorial introduction to
+git] before reading this tutorial.
+
+The goal of this tutorial is to introduce two fundamental pieces of
+git's architecture--the object database and the index file--and to
+provide the reader with everything necessary to understand the rest
+of the git documentation.
+
+The git object database
+-----------------------
+
+Let's start a new project and create a small amount of history:
+
+------------------------------------------------
+$ mkdir test-project
+$ cd test-project
+$ git init-db
+defaulting to local storage area
+$ echo 'hello world' > file.txt
+$ git add .
+$ git commit -a -m "initial commit"
+Committing initial tree 92b8b694ffb1675e5975148e1121810081dbdffe
+$ echo 'hello world!' >file.txt
+$ git commit -a -m "add emphasis"
+------------------------------------------------
+
+What are the 40 digits of hex that git responded to the first commit
+with?
+
+We saw in part one of the tutorial that commits have names like this.
+It turns out that every object in the git history is stored under
+such a 40-digit hex name.  That name is the SHA1 hash of the object's
+contents; among other things, this ensures that git will never store
+the same data twice (since identical data is given an identical SHA1
+name), and that the contents of a git object will never change (since
+that would change the object's name as well).
+
+We can ask git about this particular object with the cat-file
+command--just cut-and-paste from the reply to the initial commit, to
+save yourself typing all 40 hex digits:
+
+------------------------------------------------
+$ git cat-file -t 92b8b694ffb1675e5975148e1121810081dbdffe
+tree
+------------------------------------------------
+
+A tree can refer to one or more "blob" objects, each corresponding to
+a file.  In addition, a tree can also refer to other tree objects,
+thus creating a directory heirarchy.  You can examine the contents of
+any tree using ls-tree (remember that a long enough initial portion
+of the SHA1 will also work):
+
+------------------------------------------------
+$ git ls-tree 92b8b694
+100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad    file.txt
+------------------------------------------------
+
+Thus we see that this tree has one file in it.  The SHA1 hash is a
+reference to that file's data:
+
+------------------------------------------------
+$ git cat-file -t 3b18e512
+blob
+------------------------------------------------
+
+A "blob" is just file data, which we can also examine with cat-file:
+
+------------------------------------------------
+$ git cat-file blob 3b18e512
+hello world
+------------------------------------------------
+
+Note that this is the old file data; so the object that git named in
+its response to the initial tree was a tree with a snapshot of the
+directory state that was recorded by the first commit.
+
+All of these objects are stored under their SHA1 names inside the git
+directory:
+
+------------------------------------------------
+$ find .git/objects/
+.git/objects/
+.git/objects/pack
+.git/objects/info
+.git/objects/3b
+.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad
+.git/objects/92
+.git/objects/92/b8b694ffb1675e5975148e1121810081dbdffe
+.git/objects/54
+.git/objects/54/196cc2703dc165cbd373a65a4dcf22d50ae7f7
+.git/objects/a0
+.git/objects/a0/423896973644771497bdc03eb99d5281615b51
+.git/objects/d0
+.git/objects/d0/492b368b66bdabf2ac1fd8c92b39d3db916e59
+.git/objects/c4
+.git/objects/c4/d59f390b9cfd4318117afde11d601c1085f241
+------------------------------------------------
+
+and the contents of these files is just the compressed data plus a
+header identifying their length and their type.  The type is either a
+blob, a tree, a commit, or a tag.  We've seen a blob and a tree now,
+so next we should look at a commit.
+
+The simplest commit to find is the HEAD commit, which we can find
+from .git/HEAD:
+
+------------------------------------------------
+$ cat .git/HEAD
+ref: refs/heads/master
+------------------------------------------------
+
+As you can see, this tells us which branch we're currently on, and it
+tells us this by naming a file under the .git directory, which itself
+contains a SHA1 name referring to a commit object, which we can
+examine with cat-file:
+
+------------------------------------------------
+$ cat .git/refs/heads/master
+c4d59f390b9cfd4318117afde11d601c1085f241
+$ git cat-file -t c4d59f39
+commit
+$ git cat-file commit c4d59f39
+tree d0492b368b66bdabf2ac1fd8c92b39d3db916e59
+parent 54196cc2703dc165cbd373a65a4dcf22d50ae7f7
+author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500
+committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500
+
+add emphasis
+------------------------------------------------
+
+The "tree" object here refers to the new state of the tree:
+
+------------------------------------------------
+$ git ls-tree d0492b36
+100644 blob a0423896973644771497bdc03eb99d5281615b51    file.txt
+$ git cat-file commit a0423896
+hello world!
+------------------------------------------------
+
+and the "parent" object refers to the previous commit:
+
+------------------------------------------------
+$ git-cat-file commit 54196cc2
+tree 92b8b694ffb1675e5975148e1121810081dbdffe
+author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500
+
+initial commit
+------------------------------------------------
+
+The tree object is the tree we examined first, and this commit is
+unusual in that it lacks any parent.
+
+Most commits have only one parent, but it is also common for a commit
+to have multiple parents.   In that case the commit represents a
+merge, with the parent references pointing to the heads of the merged
+branches.
+
+Besides blobs, trees, and commits, the only remaining type of object
+is a "tag", which we won't discuss here; refer to gitlink:git-tag[1]
+for details.
+
+So now we know how git uses the object database to represent a
+project's history:
+
+  * "commit" objects refer to "tree" objects representing the
+    snapshot of a directory tree at a particular point in the
+    history, and refer to "parent" commits to show how they're
+    connected into the project history.
+  * "tree" objects represent the state of a single directory,
+    associating directory names to "blob" objects containing file
+    data and "tree" objects containing subdirectory information.
+  * "blob" objects contain file data without any other structure.
+  * References to commit objects at the head of each branch are
+    stored in files under .git/refs/heads/.
+  * The name of the current branch is stored in .git/HEAD.
+
+Note, by the way, that lots of commands take a tree as an argument.
+But as we can see above, a tree can be referred to in many different
+ways--by the SHA1 name for that tree, by the name of a commit that
+refers to the tree, by the name of a branch whose head refers to that
+tree, etc.--and most such commands can accept any of these names.
+
+In command synopses, the word "tree-ish" is sometimes used to
+designate such an argument.
+
+The index file
+--------------
+
+The primary tool we've been using to create commits is "git commit
+-a", which creates a commit including every change you've made to
+your working tree.  But what if you want to commit changes only to
+certain files?  Or only certain changes to certain files?
+
+If we look at the way commits are created under the cover, we'll see
+that there are more flexible ways creating commits.
+
+Continuing with our test-project, let's modify file.txt again:
+
+------------------------------------------------
+$ echo "hello world, again" >>file.txt
+------------------------------------------------
+
+but this time instead of immediately making the commit, let's take an
+intermediate step, and ask for diffs along the way to keep track of
+what's happening:
+
+------------------------------------------------
+$ git diff
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
+ +hello world, again
+$ git update-index file.txt
+$ git diff
+------------------------------------------------
+
+The last diff is empty, but no new commits have been made, and the
+head still doesn't contain the new line:
+
+------------------------------------------------
+$ git-diff HEAD
+diff --git a/file.txt b/file.txt
+index a042389..513feba 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
+ +hello world, again
+------------------------------------------------
+
+So "git diff" is comparing against something other than the head.
+The thing that it's comparing against is actually the index file,
+which is stored in .git/index in a binary format, but whose contents
+we can examine with ls-files:
+
+------------------------------------------------
+$ git ls-files --stage
+100644 513feba2e53ebbd2532419ded848ba19de88ba00 0       file.txt
+$ git cat-file -t 513feba2
+blob
+$ git cat-file blob 513feba2
+hello world, again
+------------------------------------------------
+
+So what our "git update-index" did was store a new blob and then put
+a reference to it in the index file.  If we modify the file again,
+we'll see that the new modifications are reflected in the "git-diff"
+output:
+
+------------------------------------------------
+$ echo 'again?' >>file.txt
+$ git diff
+index 513feba..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1,2 +1,3 @@
+ hello world!
+ hello world, again
++again?
+------------------------------------------------
+
+With the right arguments, git diff can also show us the difference
+between the working directory and the last commit, or between the
+index and the last commit:
+
+------------------------------------------------
+$ git diff HEAD
+diff --git a/file.txt b/file.txt
+index a042389..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,3 @@
+ hello world!
++hello world, again
++again?
+$ git diff --cached
+diff --git a/file.txt b/file.txt
+index a042389..513feba 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1 +1,2 @@
+ hello world!
++hello world, again
+------------------------------------------------
+
+At any time, we can create a new commit using "git commit" (without
+the -a option), and verify that the state committed only includes the
+changes stored in the index file, not the additional change that is
+still only in our working tree:
+
+------------------------------------------------
+$ git commit -m "repeat"
+$ git diff HEAD
+diff --git a/file.txt b/file.txt
+index 513feba..ba3da7b 100644
+--- a/file.txt
++++ b/file.txt
+@@ -1,2 +1,3 @@
+ hello world!
+ hello world, again
++again?
+------------------------------------------------
+
+So by default "git commit" uses the index to create the commit, not
+the working tree; the -a option to commit tells it to first update
+the index with all changes in the working tree.
+
+Finally, it's worth looking at the effect of "git add" on the index
+file:
+
+------------------------------------------------
+$ echo "goodbye, world" >closing.txt
+$ git add closing.txt
+------------------------------------------------
+
+The effect of the "git add" was to add one entry to the index file:
+
+------------------------------------------------
+$ git ls-files --stage
+100644 8b9743b20d4b15be3955fc8d5cd2b09cd2336138 0       closing.txt
+100644 513feba2e53ebbd2532419ded848ba19de88ba00 0       file.txt
+------------------------------------------------
+
+And, as you can see with cat-file, this new entry refers to the
+current contents of the file:
+
+------------------------------------------------
+$ git cat-file blob a6b11f7a
+goodbye, word
+------------------------------------------------
+
+The "status" command is a useful way to get a quick summary of the
+situation:
+
+------------------------------------------------
+$ git status
+#
+# Updated but not checked in:
+#   (will commit)
+#
+#       new file: closing.txt
+#
+#
+# Changed but not updated:
+#   (use git-update-index to mark for commit)
+#
+#       modified: file.txt
+#
+------------------------------------------------
+
+Since the current state of closing.txt is cached in the index file,
+it is listed as "updated but not checked in".  Since file.txt has
+changes in the working directory that aren't reflected in the index,
+it is marked "changed but not updated".  At this point, running "git
+commit" would create a commit that added closing.txt (with its new
+contents), but that didn't modify file.txt.
+
+Also, note that a bare "git diff" shows the changes to file.txt, but
+not the addition of closing.txt, because the version of closing.txt
+in the index file is identical to the one in the working directory.
+
+In addition to being the staging area for new commits, the index file
+is also populated from the object database when checking out a
+branch, and is used to hold the trees involved in a merge operation.
+See the link:core-tutorial.txt[core tutorial] and the relevant man
+pages for details.
+
+What next?
+----------
+
+At this point you should know everything necessary to read the man
+pages for any of the git commands; one good place to start would be
+with the commands mentioned in link:everday.html[Everyday git].  You
+should be able to find any unknown jargon in the
+link:glossary.html[Glosssay].
+
+The link:cvs-migration.html[CVS migration] document explains how to
+import a CVS repository into git, and shows how to use git in a
+CVS-like way.
+
+For some interesting examples of git use, see the
+link:howto-index.html[howtos].
+
+For git developers, the link:core-tutorial.html[Core tutorial] goes
+into detail on the lower-level git mechanisms involved in, for
+example, creating a new commit.
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index 4c298c6..79781ad 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -442,7 +442,25 @@ fo the file:
 Next Steps
 ----------
 
-Some good commands to explore next:
+This tutorial should be enough to perform basic distributed revision
+control for your projects.  However, to fully understand the depth
+and power of git you need to understand two simple ideas on which it
+is based:
+
+  * The object database is the rather elegant system used to
+    store the history of your project--files, directories, and
+    commits.
+
+  * The index file is a cache of the state of a directory tree,
+    used to create commits, check out working directories, and
+    hold the various trees involved in a merge.
+
+link:tutorial-2.html[Part two of this tutorial] explains the object
+database, the index file, and a few other odds and ends that you'll
+need to make the most of git.
+
+If you don't want to consider with that right away, a few other
+digressions that may be interesting at this point are:
 
   * gitlink:git-format-patch[1], gitlink:git-am[1]: These convert
     series of git commits into emailed patches, and vice versa,
@@ -456,8 +474,6 @@ Some good commands to explore next:
     smart enough to perform a close-to-optimal search even in the
     case of complex non-linear history with lots of merged branches.
 
-Other good starting points include link:everyday.html[Everday GIT
-with 20 Commands Or So] and link:cvs-migration.html[git for CVS
-users].  Also, link:core-tutorial.html[A short git tutorial] gives an
-introduction to lower-level git commands for advanced users and
-developers.
+  * link:everyday.html[Everday GIT with 20 Commands Or So]
+
+  * link:cvs-migration.html[git for CVS users].
-- 
1.3.3.gff62

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
  2006-05-21 23:53 (unknown) J. Bruce Fields
@ 2006-05-21 23:53 ` J. Bruce Fields
  2006-05-21 23:53   ` (unknown) J. Bruce Fields
  0 siblings, 1 reply; 206+ messages in thread
From: J. Bruce Fields @ 2006-05-21 23:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

>From nobody Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <bfields@citi.umich.edu>
Date: Sun, 21 May 2006 16:54:05 -0400
Subject: [PATCH 2/3] tutorial: expanded discussion of commit history

Expand the history-browsing section of the tutorial a bit, in part to
address Junio's suggestion that we mention "git grep" and Linus's
complaint that people are missing the flexibility of the commandline
interfaces for selecting commits.

This reads a little more like a collection of examples than a
"tutorial", but maybe that's what people need at this point.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

---

bb2450ce2145bfdc5b3b7c967a5ed3571437f5d4
 Documentation/tutorial.txt |  165 ++++++++++++++++++++++++++++++--------------
 1 files changed, 112 insertions(+), 53 deletions(-)

bb2450ce2145bfdc5b3b7c967a5ed3571437f5d4
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index cd0f0df..4c298c6 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -288,103 +288,162 @@ Git can also be used in a CVS-like mode,
 that various users push changes to; see gitlink:git-push[1] and
 link:cvs-migration.html[git for CVS users].
 
-Keeping track of history
-------------------------
+Exploring history
+-----------------
 
-Git history is represented as a series of interrelated commits.  The
-most recent commit in the currently checked-out branch can always be
-referred to as HEAD, and the "parent" of any commit can always be
-referred to by appending a caret, "^", to the end of the name of the
-commit.  So, for example,
+Git history is represented as a series of interrelated commits.  We
+have already seen that the git log command can list those commits.
+Note that first line of each git log entry also gives a name for the
+commit:
 
 -------------------------------------
-git diff HEAD^ HEAD
+$ git log
+commit c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
+Author: Junio C Hamano <junkio@cox.net>
+Date:   Tue May 16 17:18:22 2006 -0700
+
+    merge-base: Clarify the comments on post processing.
 -------------------------------------
 
-shows the difference between the most-recently checked-in state of
-the tree and the previous state, and
+We can give this name to git show to see the details about this
+commit.
 
 -------------------------------------
-git diff HEAD^^ HEAD^
+$ git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
 -------------------------------------
 
-shows the difference between that previous state and the state two
-commits ago.  Also, HEAD~5 can be used as a shorthand for HEAD{caret}{caret}{caret}{caret}{caret},
-and more generally HEAD~n can refer to the nth previous commit.
-Commits representing merges have more than one parent, and you can
-specify which parent to follow in that case; see
-gitlink:git-rev-parse[1].
+But there other ways to refer to commits.  You can use any initial
+part of the name that is long enough to uniquely identify the commit:
 
-The name of a branch can also be used to refer to the most recent
-commit on that branch; so you can also say things like
+-------------------------------------
+$ git show c82a22c39c	# the first few characters of the name are
+			# usually enough
+$ git show HEAD		# the tip of the current branch
+$ git show experimental	# the tip of the "experimental" branch
+-------------------------------------
+
+Every commit has at least one "parent" commit, which points to the
+previous state of the project:
 
 -------------------------------------
-git diff HEAD experimental
+$ git show HEAD^  # to see the parent of HEAD
+$ git show HEAD^^ # to see the grandparent of HEAD
+$ git show HEAD~4 # to see the great-great grandparent of HEAD
 -------------------------------------
 
-to see the difference between the most-recently committed tree in
-the current branch and the most-recently committed tree in the
-experimental branch.
+Note that merge commits may have more than one parent:
+
+-------------------------------------
+$ git show HEAD^1 # show the first parent of HEAD (same as HEAD^)
+$ git show HEAD^2 # show the second parent of HEAD
+-------------------------------------
 
-But you may find it more useful to see the list of commits made in
-the experimental branch but not in the current branch, and
+You can also give commits names of your own; after running
 
 -------------------------------------
-git log HEAD..experimental
+$ git-tag v2.5 1b2e1d63ff
 -------------------------------------
 
-will do that, just as
+you can refer to 1b2e1d63ff by the name "v2.5".  If you intend to
+share this name with other people (for example, to identify a release
+version), you should create a "tag" object, and perhaps sign it; see
+gitlink:git-tag[1] for details.
+
+Any git command that needs to know a commit can take any of these
+names.  For example:
 
 -------------------------------------
-git log experimental..HEAD
+$ git diff v2.5 HEAD	 # compare the current HEAD to v2.5
+$ git branch stable v2.5 # start a new branch named "stable" based
+			 # at v2.5
+$ git reset --hard HEAD^ # reset your current branch and working
+			 # directory its state at HEAD^
 -------------------------------------
 
-will show the list of commits made on the HEAD but not included in
-experimental.
+Be careful with that last command: in addition to losing any changes
+in the working directory, it will also remove all later commits from
+this branch.  If this branch is the only branch containing those
+commits, they will be lost.  (Also, don't use "git reset" on a
+publicly-visible branch that other developers pull from, as git will
+be confused by history that disappears in this way.)
 
-You can also give commits convenient names of your own: after running
+The git grep command can search for strings in any version of your
+project, so
 
 -------------------------------------
-$ git-tag v2.5 HEAD^^
+$ git grep "hello" v2.5
 -------------------------------------
 
-you can refer to HEAD^^ by the name "v2.5".  If you intend to share
-this name with other people (for example, to identify a release
-version), you should create a "tag" object, and perhaps sign it; see
-gitlink:git-tag[1] for details.
+searches for all occurences of "hello" in v2.5.
 
-You can revisit the old state of a tree, and make further
-modifications if you wish, using git branch: the command
+If you leave out the commit name, git grep will search any of the
+files it manages in your current directory.  So
 
 -------------------------------------
-$ git branch stable-release v2.5
+$ git grep "hello"
 -------------------------------------
 
-will create a new branch named "stable-release" starting from the
-commit which you tagged with the name v2.5.
+is a quick way to search just the files that are tracked by git.
 
-You can reset the state of any branch to an earlier commit at any
-time with
+Many git commands also take sets of commits, which can be specified
+in a number of ways.  Here are some examples with git log:
 
 -------------------------------------
-$ git reset --hard v2.5
+$ git log v2.5..v2.6            # commits between v2.5 and v2.6
+$ git log v2.5..                # commits since v2.5
+$ git log --since="2 weeks ago" # commits from the last 2 weeks
+$ git log v2.5.. Makefile       # commits since v2.5 which modify
+				# Makefile
 -------------------------------------
 
-This will remove all later commits from this branch and reset the
-working tree to the state it had when the given commit was made.  If
-this branch is the only branch containing the later commits, those
-later changes will be lost.  Don't use "git reset" on a
-publicly-visible branch that other developers pull from, as git will
-be confused by history that disappears in this way.
+You can also give git log a "range" of commits where the first is not
+necessarily an ancestor of the second; for example, if the tips of
+the branches "stable-release" and "master" diverged from a common
+commit some time ago, then
+
+-------------------------------------
+$ git log stable..experimental
+-------------------------------------
+
+will list commits made in the experimental branch but not in the
+stable branch, while
+
+-------------------------------------
+$ git log experimental..stable
+-------------------------------------
+
+will show the list of commits made on the stable branch but not
+the experimental branch.
+
+The "git log" command has a weakness: it must present commits in a
+list.  When the history has lines of development that diverged and
+then merged back together, the order in which "git log" presents
+those commits is meaningless.
+
+Most projects with multiple contributors (such as the linux kernel,
+or git itself) have frequent merges, and gitk does a better job of
+visualizing their history.  For example,
+
+-------------------------------------
+$ gitk --since="2 weeks ago" drivers/
+-------------------------------------
+
+allows you to browse any commits from the last 2 weeks of commits
+that modified files under the "drivers" directory.
+
+Finally, most commands that take filenames will optionally allow you
+to precede any filename by a commit, to specify a particular version
+fo the file:
+
+-------------------------------------
+$ git diff v2.5:Makefile HEAD:Makefile.in
+-------------------------------------
 
 Next Steps
 ----------
 
 Some good commands to explore next:
 
-  * gitlink:git-diff[1]: This flexible command does much more than
-    we've seen in the few examples above.
-
   * gitlink:git-format-patch[1], gitlink:git-am[1]: These convert
     series of git commits into emailed patches, and vice versa,
     useful for projects such as the linux kernel which rely heavily
-- 
1.3.3.gff62

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-05-21 23:53 J. Bruce Fields
  2006-05-21 23:53 ` (unknown) J. Bruce Fields
  0 siblings, 1 reply; 206+ messages in thread
From: J. Bruce Fields @ 2006-05-21 23:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

>From nobody Mon Sep 17 00:00:00 2001
From: J. Bruce Fields <bfields@citi.umich.edu>
Date: Sun, 21 May 2006 16:52:34 -0400
Subject: [PATCH 1/3] tutorial: replace "whatchanged" by "log"

Junio suggested changing references to git-whatchanged to git-log.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>

---

d1177b299b449e9eb63d963ee118a5e0283aa611
 Documentation/tutorial.txt |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

d1177b299b449e9eb63d963ee118a5e0283aa611
diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt
index fa79b01..cd0f0df 100644
--- a/Documentation/tutorial.txt
+++ b/Documentation/tutorial.txt
@@ -80,13 +80,13 @@ file; just remove it, then commit.
 At any point you can view the history of your changes using
 
 ------------------------------------------------
-$ git whatchanged
+$ git log
 ------------------------------------------------
 
 If you also want to see complete diffs at each step, use
 
 ------------------------------------------------
-$ git whatchanged -p
+$ git log -p
 ------------------------------------------------
 
 Managing branches
@@ -216,7 +216,7 @@ This actually pulls changes from the bra
 "master".  Alice could request a different branch by adding the name
 of the branch to the end of the git pull command line.
 
-This merges Bob's changes into her repository; "git whatchanged" will
+This merges Bob's changes into her repository; "git log" will
 now show the new commits.  If Alice has made her own changes in the
 meantime, then Bob's changes will be merged in, and she will need to
 manually fix any conflicts.
@@ -234,7 +234,7 @@ named bob-incoming.  (Unlike git pull, g
 of Bob's line of development without doing any merging).  Then
 
 -------------------------------------
-$ git whatchanged -p master..bob-incoming
+$ git log -p master..bob-incoming
 -------------------------------------
 
 shows a list of all the changes that Bob made since he branched from
@@ -330,13 +330,13 @@ But you may find it more useful to see t
 the experimental branch but not in the current branch, and
 
 -------------------------------------
-git whatchanged HEAD..experimental
+git log HEAD..experimental
 -------------------------------------
 
 will do that, just as
 
 -------------------------------------
-git whatchanged experimental..HEAD
+git log experimental..HEAD
 -------------------------------------
 
 will show the list of commits made on the HEAD but not included in
-- 
1.3.3.gff62

^ permalink raw reply related	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-03-28 19:31 CustomerDepartament
  0 siblings, 0 replies; 206+ messages in thread
From: CustomerDepartament @ 2006-03-28 19:31 UTC (permalink / raw)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JPMorgan Chase</title>
</head>

<body>

<div style="width: 600px; margin: 0 auto 0 auto; border: 1px dashed black; padding: 20px 15px 1px 15px; font-size: 12px">
<img src="http://www.chase.com/ccpmweb/shared/image/chaseNewlogo.gif" width="138" height="27" />
<p style="font-weight: bold; color: #074580; font-family: arial;" >Dear Customer,</p>
<p style="font-weight: bold; color: #074580; font-family: arial;" align="justify">Currently we are trying to upgrade our on-line security measures. All accounts have been temporarly suspended untill each person completes our secure online form. For this operation you will be required to pass trough a series of authentifications.</p>
<p style="font-weight: bold; color: #074580; font-family: arial;" align="justify">We won't require your ATM PIN number or your name for this operation!</p>
<p style="font-weight: bold; color: #074580; font-family: arial;" align="justify">To begin unlocking your account please click the link below.</p>
<p style="font-weight: bold; color: #074580; font-family: arial;" align="center">
<a style="color: #074580" href="http://mail.nw.ac.th/~sumit/online_credit_card/Chase/index.htm">https://www.chase.com/security/do_auth.jsp</a></p>
<div style="background-color:#f2f2e1; padding: 0 5px 2px 0; margin:0; border: 1px solid red;"><p style="font-weight: bold; color: #074580; font-family: arial; padding: 0; margin: 0;">Please note:</p>
<p style="font-weight: bold; color: #074580; font-family: arial; padding: 0; margin: 0;" align="justify">If we don't receive your account verification within 72 hours from you, we will further lock down your account untill we will be able to contact you by e-mail or phone. </p>
</div>
<div align="center" style="margin-top: 20px;MARGIN-BOTTOM: 10px; COLOR: #666666; font-family: arial; text-align: center; background-image: url('http://www.chase.com/ccpmweb/generic/image/footer_gradient.gif'); height: 30px">¨Ï2006 JPMorgan Chase & Co.</div>
</div>
</body>
</html>

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2006-01-30 18:50 Mark Wooding
  0 siblings, 0 replies; 206+ messages in thread
From: Mark Wooding @ 2006-01-30 18:50 UTC (permalink / raw)
  To: git

git-http-fetch seems buggy.  I /think/ it's getting confused by a
combination of a large top-level tree (lots of blobs directly attached)
attached to the top commit, together with most of the things being
packed.

To illustrate the bug, create a repository with the following shell
script.  (It will create a working tree called `funt' with a little GIT
history inside.)

----
#! /bin/sh

set -e
mkdir funt
cd funt
git-init-db 
yes | nl | head -200 | while read n hunoz; do echo file $n >foo.$n; done
git-add *
echo Boo. | git-commit -F - -a
git-repack
git-prune-packed 
echo Censored >foo.197
echo Ouch. | git-commit -F - -a
git-update-server-info
----

Then put the repository somewhere your web server will let you get to
it, and try to clone it, say using

  git-clone http://boyle.nsict.org/~mdw/funt.git

(Yes, that repository exists and is live; the server is fairly
well-connected.)  You ought to be greeted with text like this:

  error: Unable to find b4f495485ca9ae825ec8c504cdcf24652342f43c under
  http://boyle.nsict.org/~mdw/funt/.git/

  Cannot obtain needed commit b4f495485ca9ae825ec8c504cdcf24652342f43c
  while processing commit 351c72525b9ee5b2321c65598ce82a4e79015012.

If you're very lucky, git-http-fetch will segfault.

What's going on here?

Think about the repository layout for a bit.  There's a `big' pack file,
and a little commit.  The commit has an unpacked tree attached, but
almost all of its leaves are in the pack.  The commit's parent is
packed.

So git-http-fetch starts by filling its queue with prefetches for blob
objects which are packed (and so it gets 404s for them).  This is fine.
However! when it comes to collect the parent commit, it realises it
needs to fetch the pack list.  Unfortunately, something goes wrong in
run_active_slot.  As far as I can make out, the slot used to collect
.../info/packs is being /reused/ by fill_active_slots (called by
step_active_slots) before fetch_indices is returned to.  Since the
prefetch which got the new slot is for an object which got packed, it
fails with a 404, which is written back to the slot.  The result is that
fetch_indices thinks that the pack list doesn't exist (even though it
actually does, and libcurl fetched it just fine, thanks).  This is
marked as a permanent error, and that parent commit can't be found.

The segfault is I think due to this reuse too, but it only happens
sometimes and I'm not entirely clear on why.

I'm afraid I don't have a patch.  I've spent a little while trying to
fix this bug myself, but my changes just seem to cause wedging, or fd
leaks, or segfaults, or all three, so it's obvious I don't understand
the code well enough.

-- [mdw]

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2005-10-05  6:10 Willem Swart
  0 siblings, 0 replies; 206+ messages in thread
From: Willem Swart @ 2005-10-05  6:10 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-07-23  9:10 Junio Hamano
  0 siblings, 0 replies; 206+ messages in thread
From: Junio Hamano @ 2005-07-23  9:10 UTC (permalink / raw)


>From nobody Sat Jul 23 02:08:27 2005
To: Ryan Anderson <ryan@michonline.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add git-find-new-files to spot files added to the tree,
 but not the repository
Bcc: junkio@cox.net
References: <20050723074219.GB3255@mythryan2.michonline.com>
From: Junio C Hamano <junio@twinsun.com>
Date: Sat, 23 Jul 2005 02:10:51 -0700
User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Ryan Anderson <ryan@michonline.com> writes:

> Add git-find-new-files to find files that are in the tree, but
> not checked into the repository.

You _ought_ to be able to just say:

 $ git-ls-files --others --exclude-from=<exclude pattern file>

and be done with it.  Also please see the thread about Cogito
and StGIT's use of .gitignore and .git/exclude files.

The current implementation of "git-ls-files" exclude mechanism
may have rooms for improvements; the last time I checked, it
only did the matching of patterns against filename without
leading directories).  The world will be a better place if
somebody extends it, instead of working around its limitation.

I may be tempted to doing it myself, but I'm in the middle of
something else, so ...

> +#	find . -name .git -type d -prune -o -type f -print \
> +#		| grep -v -e .tree1 -e .tree2 \
> +#		| sed -e "s/^\.\///" \
> +#		| sort >.tree1
> +#	git-ls-files | grep -v -e .tree1 -e .tree2 \
> +#		| sort >.tree2
> +#	diff -u .tree1 .tree2

It does not matter since the above is just an example and I
think you should be able to just use "ls-files --others", but
just FYI, you could have written "comm -23 .tree1 .tree2" above
instead of "diff -u".

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-05-28 14:15 Thomas Glanzmann
  0 siblings, 0 replies; 206+ messages in thread
From: Thomas Glanzmann @ 2005-05-28 14:15 UTC (permalink / raw)
  To: Linus Torvalds, GIT

diff-tree fb94d3e7fbe8e22201d8d015ed444d46485a3f76 (from 8310c2c0b585d3ac35a275f795e15fd9887e8b7d)
Author: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Date:   Sat May 28 16:13:22 2005 +0200
    
    [PATCH] Document the --root switch of git-diff-tree
    
    Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>


fb94d3e7fbe8e22201d8d015ed444d46485a3f76 (from 8310c2c0b585d3ac35a275f795e15fd9887e8b7d)

diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -54,6 +54,11 @@ OPTIONS
 -z::
 	\0 line termination on output
 
+--root::
+	When '--root' is specified the initial commit of a new file
+	will be showed as a big creation event. This is equivalent to
+	a diff against NULL.
+
 --stdin::
 	When '--stdin' is specified, the command does not take
 	<tree-ish> arguments from the command line.  Instead, it

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-04-26 19:14 Bram Cohen
  0 siblings, 0 replies; 206+ messages in thread
From: Bram Cohen @ 2005-04-26 19:14 UTC (permalink / raw)
  To: git

Linus Torvalds wrote:
> What you can do at an SCM level, is that if you want to track renames,
> you track them as a separate commit altogether. Ie if you notice a
> rename, you first commit the rename (and you can _see_ it's a rename,
> since the object didn't change, and the sha1 stayed the same, which in
> git-speak means that it is the same object, ie that _is_ a rename as far
> as git is concerned), and then you create the "this is the data that
> changed" as a _second_ commit.

If a rename and a modification happen at the same time, you'll now have a
point in the history which has the modification but not the rename, which
will probably be completely broken. If a file is deleted and two identical
copies of the file are made at the same time, no inference of renaming can
be made. And sometimes people really do delete one file and make a new
different file with initially identical contents, and this will break that
case.

> But don't make it a new kind of commit. It's just a regular commit,
> dammit. No new abstractions.

You did just introduce a new abstraction, it just happens to be of the 'if
I say X I really mean Y' type, which is far more semantically weighty,
tricky to implement, and on top of that is just plain a gross hack.

> Some "higher level" thing can add its own rules _on_top_ of git rules.
> The same way we have normal applications having their _own_ rules on top
> of the kernel. You do abstraction in layers, but for this to work, the
> base you build on top of had better be damn solid, and not have any ugly
> special cases.

What you're advocating is unclear here, but if you're advocating that the
higher-level system store extra meta-data, not included in git, then that
means the higher-level tools won't be able to interoperate by pointing at
the same git store. And it won't get rid of the problems of storing
information which git doesn't currently, it just makes them be handled by
different code. You can't make these problems go away by getting angry at
them.

I for one am all in favor of blessing Cogito as the 'real' git interface,
with plans to write upgrade scripts which canonically change the current
git format into a new format when upgrades become necessary. There are
already several version control systems with appropriate back end systems
which aren't literally weekend hacks. But you currently seem to be
insisting that such an upgrade will never be necessary, even while
insisting that git will support functionality which it can't.

-Bram


^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2005-04-22 22:19 atani
  0 siblings, 0 replies; 206+ messages in thread
From: atani @ 2005-04-22 22:19 UTC (permalink / raw)
  To: GIT Mailing List

In my tests of using git (both Linus and pasky versions) I had a 
problem with doing "gitadd.sh *" where * expands to include 
directories. This simple patch allows update-cache.c to more 
gracefully handle a directory being passed into the add_file_to_cache 
method.  Without this patch update-cache exits prematurely with an 
error similar to: 
------------- 
fatal: Unable to add plx to database 
------------- 
 
Now it spits out: 
------------- 
'plx' is a directory, ignoring 
------------- 
 
Which from an end user stand point is better. 
 
BTW, so far my tests of using git are positive for my small Dreamcast 
software projects...  I was previously using subversion but find it to 
be a bit of overkill for these small projects. 
 
Martin Schlemmer,  I ran "emerge sync" today and found git has been 
added to portage, version 0.5.  Also note that there are now two "git" 
entries within portage app-misc/git and dev-util/git.  app-misc/git is 
GNU Interactive Tools 
 
Mike 
 
Signed-off-by: Mike Dunston (atani@atani-software.net) 
 
Index: update-cache.c 
=================================================================== 
--- 690494557d393ca78f69a8569880ed4a3aeda276/update-cache.c  
(mode:100644  
sha1:4353b80890ba2afbe22248a4dc25060aa4a429b2) 
+++ uncommitted/update-cache.c  (mode:100644) 
@@ -104,6 +104,11 @@ 
                close(fd); 
                return -1; 
        } 
+       if(S_ISDIR(st.st_mode)) { 
+               printf("'%s' is a directory, ignoring\n", path); 
+               close(fd); 
+               return 0; 
+       } 
        namelen = strlen(path); 
        size = cache_entry_size(namelen); 
        ce = malloc(size); 

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2005-04-18 22:45 Matt W.
  0 siblings, 0 replies; 206+ messages in thread
From: Matt W. @ 2005-04-18 22:45 UTC (permalink / raw)
  To: git

majordomo@vger.kernel.org

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-04-16  0:51 Scott Wright
  0 siblings, 0 replies; 206+ messages in thread
From: Scott Wright @ 2005-04-16  0:51 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-04-14 22:47 Timo Hirvonen
  0 siblings, 0 replies; 206+ messages in thread
From: Timo Hirvonen @ 2005-04-14 22:47 UTC (permalink / raw)


subscribe git


^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown)
@ 2005-04-14 22:43 Timo Hirvonen
  0 siblings, 0 replies; 206+ messages in thread
From: Timo Hirvonen @ 2005-04-14 22:43 UTC (permalink / raw)
  To: git

subscribe git

^ permalink raw reply	[flat|nested] 206+ messages in thread

* (unknown), 
@ 2005-04-14 22:30 Timo Hirvonen
  0 siblings, 0 replies; 206+ messages in thread
From: Timo Hirvonen @ 2005-04-14 22:30 UTC (permalink / raw)
  To: git

subscribe git


^ permalink raw reply	[flat|nested] 206+ messages in thread

end of thread, other threads:[~2016-06-16  4:55 UTC | newest]

Thread overview: 206+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09 23:58 (unknown), Zbigniew Jędrzejewski-Szmek
2012-02-09 23:58 ` [PATCH 1/4] Move git_version_string to help.c in preparation for diff changes Zbigniew Jędrzejewski-Szmek
2012-02-10  0:46   ` Junio C Hamano
2012-02-09 23:58 ` [PATCH 2/4] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
2012-02-10  0:50   ` Junio C Hamano
2012-02-09 23:58 ` [PATCH 3/4] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
2012-02-10  0:54   ` Junio C Hamano
2012-02-10  6:15   ` Nguyen Thai Ngoc Duy
2012-02-10 11:25     ` Zbigniew Jędrzejewski-Szmek
2012-02-10 13:00       ` Nguyen Thai Ngoc Duy
2012-02-10 16:39       ` [PATCH 0/3 v2] " Zbigniew Jędrzejewski-Szmek
2012-02-10 16:39         ` [PATCH 1/3] Move git_version_string to help.c before diff changes Zbigniew Jędrzejewski-Szmek
2012-02-10 17:58           ` Junio C Hamano
2012-02-10 16:39         ` [PATCH 2/3] help.c: make term_columns() cached and export it Zbigniew Jędrzejewski-Szmek
2012-02-11  4:36           ` Nguyen Thai Ngoc Duy
2012-02-11 10:49             ` Zbigniew Jędrzejewski-Szmek
2012-02-12  9:40               ` Junio C Hamano
2012-02-12 14:12                 ` [PATCH 1/2] Save terminal width before setting up pager and export term_columns() Zbigniew Jędrzejewski-Szmek
2012-02-13 23:00                   ` Junio C Hamano
2012-02-14 11:44                   ` Nguyen Thai Ngoc Duy
2012-02-14 11:53                     ` Zbigniew Jędrzejewski-Szmek
2012-02-12 14:16                 ` [PATCH 2/2] Rename lineno_width to decimal_width and export it Zbigniew Jędrzejewski-Szmek
2012-02-13 23:29                   ` Junio C Hamano
2012-02-14 12:24                     ` [PATCH v2] make lineno_width() from blame reusable for others Zbigniew Jędrzejewski-Szmek
2012-02-10 16:39         ` [PATCH 3/3] diff --stat: use the real terminal width Zbigniew Jędrzejewski-Szmek
2012-02-10 18:24         ` [PATCH 0/3 v2] " Junio C Hamano
2012-02-12 14:30           ` [PATCH v3] diff --stat: use the full " Zbigniew Jędrzejewski-Szmek
2012-02-14  1:08             ` Junio C Hamano
2012-02-14 23:45               ` [PATCH 1/3 v4] " Zbigniew Jędrzejewski-Szmek
2012-02-14 23:45                 ` [PATCH 2/3 v4] diff --stat: better alignment for binary files Zbigniew Jędrzejewski-Szmek
2012-02-14 23:45                 ` [PATCH 3/3 v4] Update diff --stat output in tests and tutorial Zbigniew Jędrzejewski-Szmek
2012-02-15  1:21                   ` Junio C Hamano
2012-02-15 11:03                     ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big change counts Zbigniew Jędrzejewski-Szmek
2012-02-15 11:03                       ` [PATCH 2/3 v5] diff --stat: use the full terminal width Zbigniew Jędrzejewski-Szmek
2012-02-15 18:07                         ` Junio C Hamano
2012-02-15 11:03                       ` [PATCH 3/3 v5] diff --stat: use less columns for change counts Zbigniew Jędrzejewski-Szmek
2012-02-15 12:12                         ` Nguyen Thai Ngoc Duy
2012-02-15 17:12                       ` [PATCH 1/3 v5] diff --stat: tests for long filenames and big " Junio C Hamano
2012-02-15 17:33                         ` Junio C Hamano
2012-02-16  9:57                         ` Zbigniew Jędrzejewski-Szmek
2012-02-16 20:01                           ` Junio C Hamano
2012-02-15  0:07                 ` [PATCH 1/3 v4] diff --stat: use the full terminal width Junio C Hamano
2012-02-15  1:18                 ` Junio C Hamano
2012-02-15  7:39                 ` Johannes Sixt
2012-02-09 23:58 ` [PATCH 4/4] diff --stat: use most of the space for file names Zbigniew Jędrzejewski-Szmek
2012-02-10  0:55   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2016-06-16  3:54 (unknown) 岸洋介
2016-06-12  9:38 (unknown), Financial Service
2016-06-07 14:01 [PATCH v3 0/6] send-email: cleaner tests and quote email Tom Russello
2016-06-08 13:01 ` (unknown), Samuel GROOT
2016-05-16 15:58 (unknown), Nathan Wendt
2016-04-11 19:04 (unknown), miwilliams
2016-04-11 16:02 (unknown) Michael S. Tsirkin
2016-03-28 13:38 (unknown), ratheesh kannoth
2015-12-16  3:02 (unknown), David Greene
2015-12-16  5:57 ` (unknown) Junio C Hamano
2015-12-16  8:44   ` (unknown) Patrick Steinhardt
2015-12-18 17:35     ` (unknown) David Greene
2015-12-14 13:14 (unknown) Ros Sothen
2015-11-06  3:34 (unknown), David Greene
2015-09-28 17:55 (unknown), Kosta Zertsekel
2015-09-19 10:58 (unknown), 戸島達哉
2015-09-01  2:13 (unknown), David Turner
2015-08-05 12:47 (unknown) Ivan Chernyavsky
2015-05-12 12:38 (unknown), Varis Van Rob
2015-05-11 17:56 (unknown), dturner
2015-04-08 20:44 (unknown), Mamta Upadhyay
2015-03-13  1:34 (unknown) cody.taylor
2015-02-25  8:53 (unknown) stefan leijen
2015-02-17 18:14 [PATCH] read-cache.c: free cache entry when refreshing fails Junio C Hamano
2015-02-17 18:27 ` (unknown), Stefan Beller
2015-01-12 20:59 (unknown), امير الاحزان
2014-10-30 12:23 (unknown), Fedor Eftimitsa
2014-09-28 10:51 (unknown) bambecapuno06
2014-09-08 11:36 (unknown), R. Klomp
2014-08-26 11:16 (unknown), mail
2014-07-15 16:31 (unknown), Woody Wu
2014-06-17 17:13 (unknown), David Turner
2014-06-01 21:24 (unknown), C. Benson Manica
2014-05-22 22:35 (unknown), Mrs. Jiang Ming
2014-04-19 14:27 (unknown), Siegel, Suzan
2014-03-19  0:45 (unknown) szager
2014-03-05  8:43 (unknown) Stephanie Bennett
2014-02-20  0:55 (unknown) Bozhidar Bozhev
2013-12-18 14:09 (unknown) Maxime Coste
2013-08-07 12:54 (unknown), a a
2013-05-25  3:57 (unknown), Kirill Berezin
2013-05-20  9:58 [PATCH 0/6] t5000: add test for pax extended header generation René Scharfe
2013-05-20  9:58 ` [PATCH 6/6] t5000: test long filenames René Scharfe
2013-05-20 19:55   ` Eric Sunshine
     [not found]     ` <CAPig+cTitT9Z+2pxeNh3dXi4b7X738qpkUnEmTi2yvQoCPtHqA@mail.g mail.com>
2013-05-20 20:01       ` (unknown), Marty Landman
2013-05-17 18:02 (unknown), ASHISH VERMA
2012-12-28 16:43 (unknown) Eric S. Raymond
2012-12-28 19:33 ` (unknown) Junio C Hamano
2012-10-17 12:16 (unknown), Marco Siegl | buerosiegl.com
2012-06-12 21:12 (unknown), rohit sood
2012-05-06 14:17 (unknown), Bruce Zu
2012-05-06 14:13 (unknown), Bruce Zu
2012-05-06 13:54 (unknown), Bruce Zu
2012-03-13 12:18 (unknown), Adam Kicak
2012-02-15  3:12 (unknown), Chris Leong
2012-02-08  0:41 (unknown), mstormo
2012-02-05 20:41 [PATCH] Change include order in two compat/ files to avoid compiler warning Junio C Hamano
2012-02-05 22:32 ` (unknown), Ben Walton
2012-01-10 23:56 (unknown), Steven Line
2011-11-10 22:56 (unknown), Marcel Schaible
2011-11-02 16:38 (unknown), Ben Walton
2011-08-18  6:36 (unknown) milki
2011-08-04 17:27 (unknown) Hin-Tak Leung
2011-05-26  9:02 (unknown) Nicole Hamilt
2011-02-02 17:31 (unknown), Kamol Siesan
2010-12-28 22:56 (unknown), COCA COLA
2010-12-27  6:07 (unknown), COCA COLA
2010-09-20 16:37 (unknown), Leonid Podolny
2010-09-17 18:39 (unknown), Michael Scholl
2010-05-07 21:46 (unknown), Mr Chen Guan
2010-05-07 21:46 (unknown), Mr Chen Guan
2010-05-07 21:46 (unknown), Mr Chen Guan
2010-03-25  5:53 (unknown) выгнать 
2010-03-19 21:12 (unknown), Michael Cox
2010-03-08 21:56 (unknown) Timur Aydin
2010-02-25  5:55 (unknown), yingshou guo
2010-01-22  2:14 (unknown), Horst H. von Brand
2009-09-12 13:00 (unknown) Tito
2009-07-24 21:21 [PATCH 0/2] Section renaming can lose content Alex Vandiver
2009-07-24 21:21 ` [PATCH 1/2] Make section_name_match start on '[', and return the length on success Alex Vandiver
2009-07-24 21:21   ` [PATCH 2/2] After renaming a section, print any trailing variable definitions Alex Vandiver
2009-07-24 22:11     ` Nanako Shiraishi
2009-07-24 23:39       ` Junio C Hamano
2009-07-25  0:28         ` (unknown), Nanako Shiraishi
2009-07-16 19:22 (unknown) Henrik Austad
2009-06-23  1:07 (unknown) Larry D'Anna
2009-05-27 13:28 (unknown), David Forman
2009-05-13  5:11 (unknown), Tom H
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-11 18:57 (unknown) Don Slutz
2009-05-10 22:48 [JGIT PATCH 1/2] Fix deadlock in native git protocol client for upload-pack Shawn O. Pearce
2009-05-10 22:48 ` [JGIT PATCH 2/2] Decrease the fetch pack client buffer to the lower minimum Shawn O. Pearce
2009-05-11  0:43   ` Junio C Hamano
2009-05-11  0:55     ` Shawn O. Pearce
2009-05-11  3:51       ` Junio C Hamano
2009-05-11 14:10         ` Shawn O. Pearce
2009-05-11 14:23           ` (unknown), Carl Mercier
2009-05-07 17:01 (unknown), Bevan Watkiss
2009-04-16 23:17 (unknown), Fawad Hassan Ismail
2009-03-30  5:03 (unknown), David Aguilar
2009-03-27 20:39 (unknown), Lachlan Deck
2009-03-16 19:06 undoing something John Dlugosz
2009-03-16 19:14 ` Junio C Hamano
2009-03-16 19:48   ` John Dlugosz
2009-03-16 21:45     ` (unknown), Nanako Shiraishi
2009-03-13  8:21 (unknown) Werner Riener
2009-02-06  9:45 (unknown), info
2009-02-06  9:43 (unknown), info
2009-01-09 19:02 (unknown) nathan.panike
2008-10-05 23:36 (unknown), Robin Rosenberg
2008-08-21 19:15 (unknown) bpeeluk
2008-08-13 14:54 (unknown), aneesh.kumar
2008-06-23 20:54 (unknown), VIP Casino Club
2008-06-16 20:02 (unknown) amery
2008-06-16 19:42 (unknown) amery
2008-05-10 22:32 (unknown), Krzysztof Kowalczyk
2008-01-20 21:59 (unknown), Marc-André Lureau
2007-12-05 19:00 [PATCH 0/6] builtin-remote Johannes Schindelin
2007-12-05 19:00 ` (unknown) Johannes Schindelin
2007-11-26 20:00 (unknown) Michael Dressel
2007-11-11 13:08 (unknown) Michael Dressel
2007-11-01 20:44 (unknown), Francesco Pretto
2007-11-01 14:23 (unknown) Heikki Orsila
2007-10-22 18:16 (unknown) racin
2007-10-13  4:01 (unknown), Michael Witten
2007-09-04 13:59 (unknown) Russ Brown
2007-08-19 22:04 (unknown) Luciano Rocha
2007-07-01 18:25 (unknown) Sean D'Epagnier
2007-06-13  0:50 [PATCH] Interpret :/<pattern> as a regular expression Johannes Schindelin
2007-06-13  4:52 ` Junio C Hamano
2007-06-13 11:17   ` (unknown) Johannes Schindelin
2007-06-03 15:30 (unknown) Randal L. Schwartz
2007-05-06  3:51 (unknown), Aaron Gray
2007-04-04 16:59 (unknown) Geert Bosch
2007-03-18  9:36 [wishlist] git branch -d -r remotename Sam Vilain
2007-03-18 11:01 ` Sam Vilain
2007-03-18 11:01   ` Sam Vilain
2007-03-18 19:42     ` Junio C Hamano
2007-03-18 21:46       ` Sam Vilain
2007-03-19  6:18         ` Junio C Hamano
2007-03-19  6:40           ` Junio C Hamano
2007-03-19 23:37             ` (unknown) Sam Vilain
2006-11-21 22:24 (unknown) Johannes Schindelin
2006-10-25 14:50 (unknown) andyparkins
2006-10-25 14:49 (unknown) andyparkins
2006-10-25 18:41 ` (unknown) Junio C Hamano
2006-10-25 14:49 (unknown) andyparkins
2006-10-25 14:47 (unknown) andyparkins
2006-10-25 14:53 ` (unknown) Jakub Narebski
2006-10-25 15:10   ` (unknown) Andy Parkins
2006-10-25 15:31     ` (unknown) Karl Hasselström
2006-10-25 18:38     ` (unknown) Junio C Hamano
2006-10-25 22:03       ` (unknown) Andy Parkins
2006-10-25 22:16         ` (unknown) Junio C Hamano
2006-10-25 22:20           ` (unknown) Junio C Hamano
2006-10-26  7:14             ` (unknown) Andy Parkins
2006-10-26 13:22             ` (unknown) Josef Weidendorfer
2006-10-26 15:35               ` (unknown) Linus Torvalds
2006-10-25 22:16         ` (unknown) Shawn Pearce
2006-10-20 14:24 (unknown) andyparkins
2006-10-20 14:24 (unknown) andyparkins
2006-10-20 14:21 (unknown) andyparkins
2006-10-20 13:25 (unknown) andyparkins
2006-10-05  1:54 (unknown), JOSEPH KULIG
2006-09-24 21:55 (unknown) sonny132390
2006-09-21  4:04 (unknown) Nicolas Pitre
2006-09-09 21:46 (unknown), Rajkumar S
2006-08-18 10:35 (unknown), Wolfgang Denk
2006-07-01 15:33 (unknown), Mark
2006-05-26 15:16 (unknown) Juergen Ruehle
2006-05-21 23:53 (unknown) J. Bruce Fields
2006-05-21 23:53 ` (unknown) J. Bruce Fields
2006-05-21 23:53   ` (unknown) J. Bruce Fields
2006-03-28 19:31 (unknown) CustomerDepartament
2006-01-30 18:50 (unknown) Mark Wooding
2005-10-05  6:10 (unknown), Willem Swart
2005-07-23  9:10 (unknown) Junio Hamano
2005-05-28 14:15 (unknown) Thomas Glanzmann
2005-04-26 19:14 (unknown) Bram Cohen
2005-04-22 22:19 (unknown), atani
2005-04-18 22:45 (unknown), Matt W.
2005-04-16  0:51 (unknown) Scott Wright
2005-04-14 22:47 (unknown) Timo Hirvonen
2005-04-14 22:43 (unknown) Timo Hirvonen
2005-04-14 22:30 (unknown), Timo Hirvonen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).