Git development
 help / color / mirror / Atom feed
* bundles with multiple branches
From: Jeffrey Ratcliffe @ 2009-08-23 20:36 UTC (permalink / raw)
  To: git

I tend to work on multiple machines that don't have direct access to
each and therefore keep my git repositories in sync using bundles.

This works fine for single branches - but how can I set things up so
that I can just

$ git pull <bundle>

or

$ git fetch <bundle>

and have git update all branches?

Regards

Jeff

^ permalink raw reply

* Re: [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space on incomplete line
From: Thell Fowler @ 2009-08-23 20:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thell Fowler, git, Johannes.Schindelin
In-Reply-To: <7vljlauxmk.fsf@alter.siamese.dyndns.org>

Junio C Hamano (gitster@pobox.com) wrote on Aug 23, 2009:

> Thell Fowler <git@tbfowler.name> writes:
> 
> > Because the flow is much more direct it also makes the test additions to 
> > t4015 obsolete as they essentially tested for line end conditions instead 
> > of whitespace (like they should have).
> 
> Your patch 6/6 that added the tests were useful to find a bug I originally
> had, which is the one below that is commented out.
> 

That's good to hear!

> >> +		/*
> >> +		 * If we do not want -b to imply --ignore-space-at-eol
> >> +		 * then you would need to add this:
> >> +		 *
> >> +		 * if (!(flags & XDF_IGNORE_WHITESPACE_AT_EOL))
> >> +		 *	return (s1 <= i1 && s2 <= i2);
> >> +		 *
> >> +		 */
> >> +
> >
> > While it would be nice to have -b and --ignore-space-at-eol be two 
> > different options that could be merged together the documentation states 
> > that -b ignores spaces at eol, and there are scripts that depend on this 
> > behavior.
> 
> Also that is how "diff -b" behaves, and that is why I said your tests
> found a _bug_ in my original.  I'll drop the above large comment and
> replace it with just a "/* -b implies --ignore-space-at-eol */".
> 

In that case the only other outstanding issue to being able to use 
patch-id to validate a whitespace fixed patch is diff's -B option to catch 
the situations where the original has multiple blank newlines at the end 
of file.


> > Right now the xdl_recmatch() checks three distinct flags before having the 
> > opportunity to do the default behavior of a straight diff.  In 
> > xdl_hash_record there is an initial check for whitespace flags.
> >
> > ...
> > 	if (flags & XDF_WHITESPACE_FLAGS)
> > 		return xdl_hash_record_with_whitespace(data, top, flags);
> > ...
> >
> > Perhaps a similar setup for xdl_rematch() and a 
> > xdl_recmatch_with_whitespace() ?
> 
> Or we can just move the final else clause up and start the function like
> this:
> 
> 	int i1, i2;
> 
> 	if (!(flags & XDF_WHITESPACE_FLAGS))
>  		return s1 == s2 && !memcmp(l1, l2, s1);
> 
> 	i1 = i2 = 0;
>  	if (flags & XDF_IGNORE_WHITESPACE) {
> 		...
> 
> that would get rid of two unnecessary clearing of variables (i1 and i2,
> even though I suspect that the compiler _could_ optimize them out without
> such an change), and three flags-bit check in the most common case of not
> ignoring any whitespaces.
> 

HA!  That's a nifty way to do that with the variables.

> > Since your to counter-proposals give the same results, provide safer and 
> > faster processing, eliminate the additional test, as well as being easier 
> > to read and comprehend I propose a v3 with just those two patches.  I'll 
> > be glad to post it, with or without a xdl_recmatch_with_whitespace, if 
> > need be.  And should I, or do I need to, add something to the commit (ie: 
> > ack, tested, ...) ?
> 
> I can amend the counterproposal patches with tests from your 6/6 and add
> your "Tested-by:" and commit them myself.
> 

Excellent.

> > Thank you again for taking the time to look at this change!
> 
> Thank _you_ for bringing this issue up in the first place.

My pleasure!  It has been quite the learning experience!

-- 
Thell

^ permalink raw reply

* Re: [PATCH] Add script for importing bits-and-pieces to Git.
From: Thomas Adam @ 2009-08-23 20:28 UTC (permalink / raw)
  To: Peter Krefting; +Cc: git
In-Reply-To: <20090823201624.206F52FC20@perkele>

2009/8/23 Peter Krefting <peter@softwolves.pp.se>:
> +       my (undef, undef, undef, undef, undef, undef,
> +               undef, $size, undef, $time, undef, undef, undef) = stat FILE;

Minor nit.  Better written as:

my ($size, $mtime) = (stat(FILE))[7,9];

-- Thomas Adam

^ permalink raw reply

* Re: Pulling one commit at a time.
From: Adam Brewster @ 2009-08-23 20:17 UTC (permalink / raw)
  To: Sanjiv Gupta; +Cc: git
In-Reply-To: <4A9172D0.6030507@microchip.com>

On Sun, Aug 23, 2009 at 12:48 PM, Sanjiv
Gupta<sanjiv.gupta@microchip.com> wrote:
> Hi,
> This is my first post here.
> I just wanted to know how can I pull one commit at a time from public
> repository.
> e.g.
> when I first cloned from the public repo, it was at X. now it has reached Y.
> I just want to pull x+1.
>
> how to do that?
>
> In SVN, we can just do $ svn update -r next_rev_num
>

Git is a distributed system and handles branching much differently
than svn, so pull x+1 sounds like a funny request to git.

You could use `git fetch` to get the history from the remote
repository, then use `git log` or `gitk` to find the name of the
commit you're interested in, and use `git checkout` to switch to that
branch or `git merge` to merge the changes from the next commit into
your current branch.

Perhaps it would help if we knew why you only wanted to fetch one
commit at a time.

Adam

^ permalink raw reply

* Re: Pulling one commit at a time.
From: Sam Vilain @ 2009-08-23 20:19 UTC (permalink / raw)
  To: Sanjiv Gupta; +Cc: git
In-Reply-To: <4A9172D0.6030507@microchip.com>

On Sun, 2009-08-23 at 22:18 +0530, Sanjiv Gupta wrote:
> Hi,
> This is my first post here.
> I just wanted to know how can I pull one commit at a time from public 
> repository.
> e.g.
> when I first cloned from the public repo, it was at X. now it 
> has reached Y. I just want to pull x+1.
>  
> how to do that?
>  
> In SVN, we can just do $ svn update -r next_rev_num

git pull or git pull --rebase

Why not find a tutorial or go through the user manual.

Sam

^ permalink raw reply

* [PATCH] Add script for importing bits-and-pieces to Git.
From: Peter Krefting @ 2009-08-23 20:11 UTC (permalink / raw)
  To: git

Allows the user to import version history that is stored in bits and
pieces in the file system, for instance snapshots of old development
trees, or day-by-day backups. A configuration file is used to
describe the relationship between the different files and allow
describing branches and merges, as well as authorship and commit
messages.

Output is created in a format compatible with git-fast-import.

Full documentation is provided inline in perldoc format.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
---
I used this to import a couple of projects which had history that
was too complex for import-tars or import-zips. The configuration
file language for this script allow creation of both branches and
merges.

 contrib/fast-import/import-directories.perl |  333 +++++++++++++++++++++++++++
 1 files changed, 333 insertions(+), 0 deletions(-)
 create mode 100755 contrib/fast-import/import-directories.perl

diff --git a/contrib/fast-import/import-directories.perl b/contrib/fast-import/import-directories.perl
new file mode 100755
index 0000000..1f5ea07
--- /dev/null
+++ b/contrib/fast-import/import-directories.perl
@@ -0,0 +1,333 @@
+#!/usr/bin/perl -w
+#
+# Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
+#
+# ------------------------------------------------------------------------
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# ------------------------------------------------------------------------
+
+=pod
+
+=head1 NAME
+
+import-directories - Import bits and pieces to Git.
+
+=head1 SYNOPSIS
+
+B<import-directories.perl> F<configfile>
+
+=head1 DESCRIPTION
+
+Script to import arbitrary projects version controlled by the "copy the
+source directory to a new location and edit it there"-version controlled
+projects into version control. Handles projects with arbitrary branching
+and version trees, taking a file describing the inputs and generating a
+file compatible with the L<git-fast-import(1)> format.
+
+=head1 CONFIGURATION FILE
+
+=head2 Format
+
+The configuration file is using a standard I<.ini> format.
+
+ ; Comments start with semi-colons
+ [section]
+ key=value
+
+=head2 Global configuration
+
+Global configuration is done in the B<[config]> section, which should be
+the first section in the file. Configuration can be changed by
+repeating configuration sections later on.
+
+ [config]
+ ; configure conversion of CRLFs. "convert" means that all CRLFs
+ ; should be converted into LFs (suitable for the core.autocrlf
+ ; setting set to true in Git). "none" means that all data is
+ ; treated as binary.
+ crlf=convert
+
+=head2 Revision configuration
+
+Each revision that is to be imported is described in three
+sections. Sections should be defined chronologically, so that a
+revision's parent has always been defined when a new revision
+is introduced. All sections for one revision should be defined
+before defining the next revision.
+
+Revisions are specified numerically, but they numbers need not be
+consecutive, only unique.
+
+=pod
+
+=head3 Revision description section
+
+A section whose section name is just an integer gives meta-data
+about the revision.
+
+ [3]
+ ; author sets the author of the revisions
+ author=Peter Krefting <peter@softwolves.pp.se>
+ ; branch sets the branch that the revision should be committed to
+ branch=master
+ ; parent describes the revision that is the parent of this commit
+ ; (optional)
+ parent=1
+ ; merges describes a revision that is merged into this commit
+ ; (optional; can be repeated)
+ merges=2
+ ; selects one file to take the timestamp from
+ ; (optional; if unspecified, the most recent file from the .files
+ ;  section is used)
+ timestamp=3/source.c
+
+=head3 Revision contents section
+
+A section whose section name is an integer followed by B<.files>
+describes the files included in this revision.
+
+ [3.files]
+ ; the key is the path inside the repository, the value is the path
+ ; as seen from the importer script.
+ source.c=3/source.c
+ source.h=3/source.h
+
+=head3 Revision commit message section
+
+A section whose section name is an integer followed by B<.message>
+gives the commit message. This section is read verbatim.
+
+ [3.message]
+ Implement foobar.
+ ; trailing blank lines are ignored.
+
+=cut
+
+# Globals
+use strict;
+use integer;
+my $crlfmode = 0;
+my @revs;
+my (%revmap, %message, %files, %author, %branch, %parent, %merges, %time, %timesource);
+my $sectiontype = 0;
+my $rev = 0;
+my $mark = 1;
+
+# Check command line
+if ($#ARGV == -1 || $ARGV[0] =~ /^--?h/)
+{
+    exec('perldoc', $0);
+    exit 1;
+}
+
+# Open configuration
+my $config = $ARGV[0];
+open CFG, '<', $config or die "Cannot open configuration file \"$config\": ";
+
+# Open output
+my $output = $ARGV[1];
+open OUT, '>', $output or die "Cannot create output file \"$output\": ";
+binmode OUT;
+
+LINE: while (my $line = <CFG>)
+{
+	$line =~ s/\r?\n$//;
+	next LINE if $sectiontype != 4 && $line eq '';
+	next LINE if $line =~ /^;/;
+	my $oldsectiontype = $sectiontype;
+	my $oldrev = $rev;
+
+	# Sections
+	if ($line =~ m"^\[(config|(\d+)(|\.files|\.message))\]$")
+	{
+		if ($1 eq 'config')
+		{
+			$sectiontype = 1;
+		}
+		elsif ($3 eq '')
+		{
+			$sectiontype = 2;
+			$rev = $2;
+			# Create a new revision
+			die "Duplicate rev: $line\n " if defined $revmap{$rev};
+			print "Reading revision $rev\n";
+			push @revs, $rev;
+			$revmap{$rev} = $mark ++;
+			$time{$revmap{$rev}} = 0;
+		}
+		elsif ($3 eq '.files')
+		{
+			$sectiontype = 3;
+			$rev = $2;
+			die "Revision mismatch: $line\n " unless $rev == $oldrev;
+		}
+		elsif ($3 eq '.message')
+		{
+			$sectiontype = 4;
+			$rev = $2;
+			die "Revision mismatch: $line\n " unless $rev == $oldrev;
+		}
+		else
+		{
+			die "Internal parse error: $line\n ";
+		}
+		next LINE;
+	}
+
+	# Parse data
+	if ($sectiontype != 4)
+	{
+		# Key and value
+		if ($line =~ m"^(.*)=(.*)$")
+		{
+			my ($key, $value) = ($1, $2);
+			# Global configuration
+			if (1 == $sectiontype)
+			{
+				if ($key eq 'crlf')
+				{
+					$crlfmode = 1, next LINE if $value eq 'convert';
+					$crlfmode = 0, next LINE if $value eq 'none';
+				}
+				die "Unknown configuration option: $line\n ";
+			}
+			# Revision specification
+			if (2 == $sectiontype)
+			{
+				my $current = $revmap{$rev};
+				$author{$current} = $value, next LINE if $key eq 'author';
+				$branch{$current} = $value, next LINE if $key eq 'branch';
+				$parent{$current} = $value, next LINE if $key eq 'parent';
+				$timesource{$current} = $value, next LINE if $key eq 'timestamp';
+				push(@{$merges{$current}}, $value), next LINE if $key eq 'merges';
+				die "Unknown revision option: $line\n ";
+			}
+			# Filespecs
+			if (3 == $sectiontype)
+			{
+				# Add the file and create a marker
+				die "File not found: $line\n " unless -f $value;
+				my $current = $revmap{$rev};
+				${$files{$current}}{$key} = $mark;
+				my $time = &fileblob($value, $crlfmode, $mark ++);
+
+				# Update revision timestamp if more recent than other
+				# files seen, or if this is the file we have selected
+				# to take the time stamp from using the "timestamp"
+				# directive.
+				if ((defined $timesource{$current} && $timesource{$current} eq $value)
+				    || $time > $time{$current})
+				{
+					$time{$current} = $time;
+				}
+			}
+		}
+		else
+		{
+			die "Parse error: $line\n ";
+		}
+	}
+	else
+	{
+		# Commit message
+		my $current = $revmap{$rev};
+		if (defined $message{$current})
+		{
+			$message{$current} .= "\n";
+		}
+		$message{$current} .= $line;
+	}
+}
+close CFG;
+
+# Start spewing out data for git-fast-import
+foreach my $commit (@revs)
+{
+	# Progress
+	print OUT "progress Creating revision $commit\n";
+
+	# Create commit header
+	my $mark = $revmap{$commit};
+
+	# Branch and commit id
+	print OUT "commit refs/heads/", $branch{$mark}, "\nmark :", $mark, "\n";
+
+	# Author and timestamp
+	die "No timestamp defined for $commit (no files?)\n" unless defined $time{$mark};
+	print OUT "committer ", $author{$mark}, " ", $time{$mark}, " +0100\n";
+
+	# Commit message
+	die "No message defined for $commit\n" unless defined $message{$mark};
+	my $message = $message{$mark};
+	$message =~ s/\n$//; # Kill trailing empty line
+	print OUT "data ", length($message), "\n", $message, "\n";
+
+	# Parent and any merges
+	print OUT "from :", $revmap{$parent{$mark}}, "\n" if defined $parent{$mark};
+	if (defined $merges{$mark})
+	{
+		foreach my $merge (@{$merges{$mark}})
+		{
+			print OUT "merge :", $revmap{$merge}, "\n";
+		}
+	}
+
+	# Output file marks
+	print OUT "deleteall\n"; # start from scratch
+	foreach my $file (sort keys %{$files{$mark}})
+	{
+		print OUT "M 644 :", ${$files{$mark}}{$file}, " $file\n";
+	}
+	print OUT "\n";
+}
+
+# Create one file blob
+sub fileblob
+{
+	my ($filename, $crlfmode, $mark) = @_;
+
+	# Import the file
+	print OUT "progress Importing $filename\nblob\nmark :$mark\n";
+	open FILE, '<', $filename or die "Cannot read $filename\n ";
+	binmode FILE;
+	my (undef, undef, undef, undef, undef, undef,
+		undef, $size, undef, $time, undef, undef, undef) = stat FILE;
+	my $file;
+	read FILE, $file, $size;
+	close FILE;
+	$file =~ s/\r\n/\n/g if $crlfmode;
+	print OUT "data ", length($file), "\n", $file, "\n";
+
+	return $time;
+}
+
+__END__
+
+=pod
+
+=head1 EXAMPLES
+
+B<import-directories.perl> F<project.import>
+
+=head1 AUTHOR
+
+Copyright 2008-2009 Peter Krefting E<lt>peter@softwolves.pp.se>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation.
+
+=cut
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH] gitweb: pull ref markes pull out of subject <a> tag
From: Jakub Narebski @ 2009-08-23 20:13 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: git, Junio C Hamano
In-Reply-To: <1251016089-10548-1-git-send-email-giuseppe.bilotta@gmail.com>

On Sun, 23 Aug 2009, Giuseppe Bilotta wrote:

> Since 4afbaefffa9095fe1391b4b61289a7dc954e9f7b ref markers that
> accompain the subject in views such as shortlog and history point to
> something different from the subject itself. Therefore, they should not
> be included in the same <a> tag.
> 
> Benefits of the change are:
> * better compliance to the XHTML standards, that forbid links within
>   links even though the restriction cannot be imposed via DTD; this also
>   benefits visualization in some older browsers;

Yes, some older browsers (like Mozilla 1.7.12, Gecko/20050923) did 
_enforce_ that requirement when served document with XHTML DOCTYPE,
and application/xml+xhtml Content-Type, by moving inner link (A element)
just outside (just after) outer, containing <a> element.

For format_subject_html which you are fixing, and which is used by 
'shortlog', 'history' and 'tags' views this didn't cause much changes
in layout.  But the way gitweb uses git_print_header_div in views such
as 'tree', 'blob' etc., where the outer (containing) link is made into
*block* element[1] by the way of CSS (display: block) makes layout 
(visualisation) very screwed up in older browser.  But I don't expect
you to fix that.

[1] Originally so the area to click is larger.

> * when hovering the subject, only the subject itself is underlined; when
>   hovering the ref markers, only the text in the hovered ref marker is
>   underlined; previously, hovering any written part of the subject
>   column led to complete underlying of everything at the same time,
>   with unpleasing effects.

Signoff?

Acked-by: Jakub Narebski <jnareb@gmail.com>

> ---
>  gitweb/gitweb.perl |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> The next step would be to find a way to layout decently the case when
> some shortlog entries have a _humongous_ amount of ref markers. See
> for example http://git.oblomov.eu/acecad/shortlog
> 
> I honestly doubt these cases happen in normal git repositories, but it
> might still be worth taking them into consideration. Possibilities
> include hard-limiting the title column maximum width (in browsers for
> which the corresponding attributes and rules work), manual insertion of
> hard line breaks <br/> every n-th ref marker, or something more dynamic
> such as hiding most of the ref markers when they are more than, say, 5,
> and showing them on hover.
> 
> Suggestions? Comments?

Perhaps limiting to heads and tags if there are too many refs?

> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index ce6e8f6..bb9648b 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1524,10 +1524,10 @@ sub format_subject_html {
>  		$long =~ s/[[:cntrl:]]/?/g;
>  		return $cgi->a({-href => $href, -class => "list subject",
>  		                -title => to_utf8($long)},
> -		       esc_html($short) . $extra);
> +		       esc_html($short)) . $extra;
>  	} else {
>  		return $cgi->a({-href => $href, -class => "list subject"},
> -		       esc_html($long)  . $extra);
> +		       esc_html($long)) . $extra;
>  	}
>  }
>  
> -- 
> 1.6.3.rc1.192.gdbfcb
> 
> 

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: Pulling one commit at a time.
From: Alex Riesen @ 2009-08-23 20:11 UTC (permalink / raw)
  To: Sanjiv Gupta; +Cc: git
In-Reply-To: <4A9172D0.6030507@microchip.com>

On Sun, Aug 23, 2009 at 18:48, Sanjiv Gupta<sanjiv.gupta@microchip.com> wrote:
> when I first cloned from the public repo, it was at X. now it has reached Y.
> I just want to pull x+1.
>
> how to do that?

Depending on what you mean, it maybe either the what Git already
does (a git fetch/git pull always transmits only the differences) or a
security risk and impossible (an ability to fetch an arbitrary commit
bypasses checks imposed by the reference names published).

^ permalink raw reply

* Re: [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space on incomplete line
From: Junio C Hamano @ 2009-08-23 19:40 UTC (permalink / raw)
  To: Thell Fowler; +Cc: git, Johannes.Schindelin
In-Reply-To: <alpine.DEB.2.00.0908231110500.29625@GWPortableVCS>

Thell Fowler <git@tbfowler.name> writes:

> Because the flow is much more direct it also makes the test additions to 
> t4015 obsolete as they essentially tested for line end conditions instead 
> of whitespace (like they should have).

Your patch 6/6 that added the tests were useful to find a bug I originally
had, which is the one below that is commented out.

>> +		/*
>> +		 * If we do not want -b to imply --ignore-space-at-eol
>> +		 * then you would need to add this:
>> +		 *
>> +		 * if (!(flags & XDF_IGNORE_WHITESPACE_AT_EOL))
>> +		 *	return (s1 <= i1 && s2 <= i2);
>> +		 *
>> +		 */
>> +
>
> While it would be nice to have -b and --ignore-space-at-eol be two 
> different options that could be merged together the documentation states 
> that -b ignores spaces at eol, and there are scripts that depend on this 
> behavior.

Also that is how "diff -b" behaves, and that is why I said your tests
found a _bug_ in my original.  I'll drop the above large comment and
replace it with just a "/* -b implies --ignore-space-at-eol */".

> Right now the xdl_recmatch() checks three distinct flags before having the 
> opportunity to do the default behavior of a straight diff.  In 
> xdl_hash_record there is an initial check for whitespace flags.
>
> ...
> 	if (flags & XDF_WHITESPACE_FLAGS)
> 		return xdl_hash_record_with_whitespace(data, top, flags);
> ...
>
> Perhaps a similar setup for xdl_rematch() and a 
> xdl_recmatch_with_whitespace() ?

Or we can just move the final else clause up and start the function like
this:

	int i1, i2;

	if (!(flags & XDF_WHITESPACE_FLAGS))
 		return s1 == s2 && !memcmp(l1, l2, s1);

	i1 = i2 = 0;
 	if (flags & XDF_IGNORE_WHITESPACE) {
		...

that would get rid of two unnecessary clearing of variables (i1 and i2,
even though I suspect that the compiler _could_ optimize them out without
such an change), and three flags-bit check in the most common case of not
ignoring any whitespaces.

> Since your to counter-proposals give the same results, provide safer and 
> faster processing, eliminate the additional test, as well as being easier 
> to read and comprehend I propose a v3 with just those two patches.  I'll 
> be glad to post it, with or without a xdl_recmatch_with_whitespace, if 
> need be.  And should I, or do I need to, add something to the commit (ie: 
> ack, tested, ...) ?

I can amend the counterproposal patches with tests from your 6/6 and add
your "Tested-by:" and commit them myself.

> Thank you again for taking the time to look at this change!

Thank _you_ for bringing this issue up in the first place.

^ permalink raw reply

* Re: [PATCH 14/14] Add README and gitignore file for MSVC build
From: Thiago Farina @ 2009-08-23 19:29 UTC (permalink / raw)
  To: Marius Storm-Olsen; +Cc: Reece Dunn, Johannes.Schindelin, msysgit, git, lznuaa
In-Reply-To: <4A91917F.9000709@gmail.com>

Marius, how common-cmds.h will be generated? In the header file says
that it's generated by generate-cmdlist.sh, so the VS user will need
to generate this file first (before compiling)?
When I tried to compile after pulling from the repository, I couldn't,
so I copied it from the the msysgit.

^ permalink raw reply

* Re: [PATCH 14/14] Add README and gitignore file for MSVC build
From: Marius Storm-Olsen @ 2009-08-23 18:59 UTC (permalink / raw)
  To: Reece Dunn; +Cc: Thiago Farina, Johannes.Schindelin, msysgit, git, lznuaa
In-Reply-To: <3f4fd2640908231122m34604196pc98c5871cf5925b5@mail.gmail.com>

Reece Dunn said the following on 23.08.2009 20:22:
> 2009/8/23 Thiago Farina <tfransosi@gmail.com>:
>> Hi,
>>
>> On Fri, Aug 21, 2009 at 10:30 AM, Marius Storm-Olsen<mstormo@gmail.com> wrote:
>>> From: Frank Li <lznuaa@gmail.com>
>>>
>>> +3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
>> F7 does nothing in VS2008, to build the solution you have to press
>> Ctrl+Shift+B. To build and start debugging you have to press F5, and
>> for start without debbuging support is Ctrl+F5.
> 
> IIRC, Visual Studio can be configured to use different keyboard shortcuts.
> 
> However, saying "press F7" says nothing of the intent. It would
> probably be better to have this say something like "Then build the
> solution." or "Open gitbuild\gitbuild.sln with Visual Studio 2008,
> then build it." But then you don't need to open Visual Studio 2008 to
> build it (you can build it from command line).
> 
> So, how about:
>    3. You can now build git with Visual Studio 2008 using the
> gitbuild\gitbuild.sln file.
> 
> - Reece

Agreed.
Thanks guys.

--
.marius

^ permalink raw reply

* Re: [PATCH 14/14] Add README and gitignore file for MSVC build
From: Reece Dunn @ 2009-08-23 18:22 UTC (permalink / raw)
  To: Thiago Farina
  Cc: Marius Storm-Olsen, Johannes.Schindelin, msysgit, git, lznuaa
In-Reply-To: <a4c8a6d00908230926of0ea10bhd8f66e7d37c3b39b@mail.gmail.com>

2009/8/23 Thiago Farina <tfransosi@gmail.com>:
> Hi,
>
> On Fri, Aug 21, 2009 at 10:30 AM, Marius Storm-Olsen<mstormo@gmail.com> wrote:
>> From: Frank Li <lznuaa@gmail.com>
>>
>> +3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
> F7 does nothing in VS2008, to build the solution you have to press
> Ctrl+Shift+B. To build and start debugging you have to press F5, and
> for start without debbuging support is Ctrl+F5.

IIRC, Visual Studio can be configured to use different keyboard shortcuts.

However, saying "press F7" says nothing of the intent. It would
probably be better to have this say something like "Then build the
solution." or "Open gitbuild\gitbuild.sln with Visual Studio 2008,
then build it." But then you don't need to open Visual Studio 2008 to
build it (you can build it from command line).

So, how about:
   3. You can now build git with Visual Studio 2008 using the
gitbuild\gitbuild.sln file.

- Reece

^ permalink raw reply

* Re: [PATCH-v2/RFC 2/6] xutils: fix hash with whitespace on incomplete line
From: Thell Fowler @ 2009-08-23 17:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thell Fowler, git, Johannes.Schindelin
In-Reply-To: <7veir3ynma.fsf@alter.siamese.dyndns.org>

Junio C Hamano (gitster@pobox.com) wrote on Aug 23, 2009:
> Thell Fowler <git@tbfowler.name> writes:
> 
> >   - Make xdl_hash_record_with_whitespace stop hashing before the
> >     eof when ignoring space change or space at eol on an incomplete
> >     line.
> >
> >   Resolves issue with a final trailing space being included in the
> >   hash on an incomplete line by treating the eof in the same fashion
> >   as a newline.
> 
> Please study the style of existing commit messages and imitate them.
> 

I'll keep trying.

> > Signed-off-by: Thell Fowler <git@tbfowler.name>
> > ---
> >  xdiff/xutils.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/xdiff/xutils.c b/xdiff/xutils.c
> > index 04ad468..c6512a5 100644
> > --- a/xdiff/xutils.c
> > +++ b/xdiff/xutils.c
> > @@ -248,12 +248,12 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
> >  			if (flags & XDF_IGNORE_WHITESPACE)
> >  				; /* already handled */
> >  			else if (flags & XDF_IGNORE_WHITESPACE_CHANGE
> > -					&& ptr[1] != '\n') {
> > +					&& ptr[1] != '\n' && ptr + 1 < top) {
> >  				ha += (ha << 5);
> >  				ha ^= (unsigned long) ' ';
> >  			}
> >  			else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
> > -					&& ptr[1] != '\n') {
> > +					&& ptr[1] != '\n' && ptr + 1 < top) {
> >  				while (ptr2 != ptr + 1) {
> >  					ha += (ha << 5);
> >  					ha ^= (unsigned long) *ptr2;
> 
> Thanks.
> 
> The issue you identified and tried to fix is a worthy one.  But before the
> pre-context of this hunk, I notice these lines:
> 
> 		if (isspace(*ptr)) {
> 			const char *ptr2 = ptr;
> 			while (ptr + 1 < top && isspace(ptr[1])
> 					&& ptr[1] != '\n')
> 				ptr++;
> 
> If you have trailing whitespaces on an incomplete line, ptr initially
> points at the first such whitespace, ptr2 points at the same location, and
> then the while() loop advances ptr to point at the last byte on the line,
> which in turn will be the last byte of the file.  And the codepath with
> your updates still try to access ptr[1] that is beyond that last byte.
> 
> I would write it like this patch instead.
> 
> The intent is the same as your patch, but it avoids accessing ptr[1] when
> that is beyond the end of the buffer, and the logic is easier to follow as
> well.
> 

I appreciate your taking the time to look at the issue and explaining the 
reasons for your change.

> -- >8 --
> Subject: xutils: fix hashing an incomplete line with whitespaces at the end
> 
> Upon seeing a whitespace, xdl_hash_record_with_whitespace() first skipped
> the run of whitespaces (excluding LF) that begins there, ensuring that the
> pointer points the last whitespace character in the run, and assumed that
> the next character must be LF at the end of the line.  This does not work
> when hashing an incomplete line, that lacks the LF at the end.
> 
> Introduce "at_eol" variable that is true when either we are at the end of
> line (looking at LF) or at the end of an incomplete line, and use that
> instead throughout the code.
> 
> Noticed by Thell Fowler.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Yeah... comparing this commit message to the original shows a pretty stark 
difference.  I'll get it 'the git way' eventually.

-- 
Thell

^ permalink raw reply

* Re: [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space on incomplete line
From: Thell Fowler @ 2009-08-23 17:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thell Fowler, git, Johannes.Schindelin
In-Reply-To: <7vvdkfx8rl.fsf@alter.siamese.dyndns.org>

Junio C Hamano (gitster@pobox.com) wrote on Aug 23, 2009:

> Thell Fowler <git@tbfowler.name> writes:
> 
> > @@ -191,12 +191,14 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
> >  	int i1, i2;
> >  
> >  	if (flags & XDF_IGNORE_WHITESPACE) {
> > -		for (i1 = i2 = 0; i1 < s1 && i2 < s2; ) {
> > +		for (i1 = i2 = 0; i1 < s1 || i2 < s2; ) {
> >  			if (isspace(l1[i1]))
> > -				while (isspace(l1[i1]) && i1 < s1)
> > +				while ((isspace(l1[i1]) && i1 < s1)
> > +						|| (i1 + 1 == s1 && l1[s1] != '\n'))
> 
> This is wrong.  If you ran out l1/s1/i1 but you still have remaining
> characters in l2/s2/i2, you do not want to even look at l1[i1].
> 
> You can fudge this by sprinkling more "(i1 < s1) &&" in many places (and
> reordering how your inner while() loop checks (i1 < s1) and l1[i1]), but I
> do not think that is the right direction.
> 
> The thing is, the loop control in this function is extremely hard to read
> to begin with, and now it is "if we haven't run out both", the complexity
> seeps into the inner logic.
> 

I see what you're saying here and your absolutely right.  Good thing you 
didn't write a critique of the XDF_IGNORE_WHITESPACE_CHANGE case. ;)

> How about doing it like this patch instead?  This counterproposal replaces
> your 3 patches starting from [3/6].
[...snip...]
> The basic idea of the re-written logic is this.
> 
>  - An initial loop runs while the characters from both strings we are
>    looking at match.  We declare unmatch immediately when we find
>    something that does not match and return false from the loop.  And we
>    break out of the loop if we ran out of either side of the string.
> 
>    The way we skip spaces inside this loop varies depending on the style
>    of ignoring whitespaces.
> 
>  - After the loop, the lines can match only if the remainder consists of
>    nothing but whitespaces.  This part of the logic is shared across all
>    three styles.
> 
> The new code is more obvious and should be much easier to follow.

Because the flow is much more direct it also makes the test additions to 
t4015 obsolete as they essentially tested for line end conditions instead 
of whitespace (like they should have).
[...clip...]
> +		/*
> +		 * If we do not want -b to imply --ignore-space-at-eol
> +		 * then you would need to add this:
> +		 *
> +		 * if (!(flags & XDF_IGNORE_WHITESPACE_AT_EOL))
> +		 *	return (s1 <= i1 && s2 <= i2);
> +		 *
> +		 */
> +

While it would be nice to have -b and --ignore-space-at-eol be two 
different options that could be merged together the documentation states 
that -b ignores spaces at eol, and there are scripts that depend on this 
behavior.

IMHO  it is wrong to accept that new spaces where none existed before is 
akin to having one or more existing spaces coalesced.  I seem to recall 
reading something about 1.7 having some changes in it that wouldn't be 
backward compatible; perhaps -b and --ignore-space-at-eol could be 
distinct options for that release.

On another item:
Right now the xdl_recmatch() checks three distinct flags before having the 
opportunity to do the default behavior of a straight diff.  In 
xdl_hash_record there is an initial check for whitespace flags.

...
	if (flags & XDF_WHITESPACE_FLAGS)
		return xdl_hash_record_with_whitespace(data, top, flags);
...

Perhaps a similar setup for xdl_rematch() and a 
xdl_recmatch_with_whitespace() ?

Lastly:
Since your to counter-proposals give the same results, provide safer and 
faster processing, eliminate the additional test, as well as being easier 
to read and comprehend I propose a v3 with just those two patches.  I'll 
be glad to post it, with or without a xdl_recmatch_with_whitespace, if 
need be.  And should I, or do I need to, add something to the commit (ie: 
ack, tested, ...) ?

Thank you again for taking the time to look at this change!

-- 
Thell

^ permalink raw reply

* Pulling one commit at a time.
From: Sanjiv Gupta @ 2009-08-23 16:48 UTC (permalink / raw)
  To: git
In-Reply-To: <F536B7C316F9474E9F7091239725AC9A02FA7F44@CHN-CL-MAIL01.mchp-main.com>

Hi,
This is my first post here.
I just wanted to know how can I pull one commit at a time from public 
repository.
e.g.
when I first cloned from the public repo, it was at X. now it 
has reached Y. I just want to pull x+1.
 
how to do that?
 
In SVN, we can just do $ svn update -r next_rev_num
 
thanks
- Sanjiv

^ permalink raw reply

* Re: [PATCH 14/14] Add README and gitignore file for MSVC build
From: Thiago Farina @ 2009-08-23 16:26 UTC (permalink / raw)
  To: Marius Storm-Olsen; +Cc: Johannes.Schindelin, msysgit, git, lznuaa
In-Reply-To: <e82f1930173966ebb6b2d2815e037a26e079f969.1250860247.git.mstormo@gmail.com>

Hi,

On Fri, Aug 21, 2009 at 10:30 AM, Marius Storm-Olsen<mstormo@gmail.com> wrote:
> From: Frank Li <lznuaa@gmail.com>
>
> +3. Open gitbuild\gitbuild.sln with VS2008. Then press F7.
F7 does nothing in VS2008, to build the solution you have to press
Ctrl+Shift+B. To build and start debugging you have to press F5, and
for start without debbuging support is Ctrl+F5.

Regards

^ permalink raw reply

* Re: [RFC] gitweb.perl t9500 t9501
From: Mark A Rada @ 2009-08-23 15:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git
In-Reply-To: <7v3a7j2scq.fsf@alter.siamese.dyndns.org>


On 22-Aug-09, at 10:09 PM, Junio C Hamano wrote:

> Mark A Rada <marada@uwaterloo.ca> writes:
>
>> I have not been telling git-format-patch to use a specific width for
>> the diffstat, is the standard width supposed to be 70?
>
> Perhaps there is some misconception here.
>

Yup, my bad, told my MUA to send as text/plain, but it didn't,
so I was seeing perfectly fine e-mails when I received them,
but gmane showed me how mangled everything was. I'll find a
better MUA and resend later, thanks for your patience with me.


--
Mark A Rada (ferrous26)
marada@uwaterloo.ca

^ permalink raw reply

* Re: [PATCH 2/2 (v3)] reset: make the output more user-friendly.
From: Reece Dunn @ 2009-08-23 11:45 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Junio C Hamano, git
In-Reply-To: <vpqiqgevmju.fsf@bauges.imag.fr>

2009/8/23 Matthieu Moy <Matthieu.Moy@imag.fr>:
> For example, the output of 'git status' is very nice to newbies:
>
>  # On branch master
>  # Changed but not updated:
>  #   (use "git add <file>..." to update what will be committed)

Shouldn't this be something like: (use "git add <file>..." to add new
and modified files to be committed) -- I am saying this as "update"
can also refer to removing files, or discarding changes.

>  #   (use "git checkout -- <file>..." to discard changes in working directory)
>  #
>  #       modified:   git.c
>  #
>  no changes added to commit (use "git add" and/or "git commit -a")
>
> But out of these 8 lines, only two contain real informations, and the
> (use "git bla") are just noise to expert users.

Yes and no. Using git for quite a while now, the day-to-day operations
are second nature, but other slightly obscure commands (how exactly do
I remove a staged file?) are useful to have.

> I've been thinking of a configuration option, like "core.expertuser"
> or "ui.expertuser" that would let users disable these informative
> messages on demand. I'm not sure how good the idea is.

The "core.expertuser" option does not really say what this is doing
(should the expertuser option list the sha1's for the commits, trees
and objects it is adding?).

I would call it something like "core.interactive-help",
"core.inplace-help" or "core.inline-help", as that is what the (use
...) lines are.

- Reece

^ permalink raw reply

* Re: Lowlevel documentation
From: Eric Schaefer @ 2009-08-23 11:34 UTC (permalink / raw)
  To: Matthias Kestenholz; +Cc: Git Mailing List
In-Reply-To: <1f6632e50908230325id8422b1t520831869aadcbce@mail.gmail.com>

2009/8/23 Matthias Kestenholz <mk@feinheit.ch>:
> I think you are referring to this blog post:
>
> http://tom.preston-werner.com/2009/05/19/the-git-parable.html

Yes, thats the one.

Thank Matthias, thanks Björn. Schönen Sonntag noch,
Eric

^ permalink raw reply

* Re: [PATCH 2/2 (v3)] reset: make the output more user-friendly.
From: Matthieu Moy @ 2009-08-23 10:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmy5r1cpo.fsf@alter.siamese.dyndns.org>

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

> Two conflicting/competing thoughts come to mind:
>
>  1. Perhaps we should add a similar "explanation" for the list of paths
>     with changes upon switching branches with "git checkout" for
>     consistency.

Actually, I had never paid much attention to this message for
checkout. Just checked, and I got it wrong too ;-). I thought checkout
was showing me the files it was modifying, that wasn't it.

That said, I'm not a heavy user of local branches, so I'm a bad judge
on what should be the behavior.

>  2. Such an "explanation" of what the output means would help the first
>     time people, but would everybody stay "first time" forever?  Would the
>     explanation become just another wasted line in valuable screen real
>     estate after people gain experience?

Yes, and this is a much more general issue than just checkout/reset.
For example, the output of 'git status' is very nice to newbies:

  # On branch master
  # Changed but not updated:
  #   (use "git add <file>..." to update what will be committed)
  #   (use "git checkout -- <file>..." to discard changes in working directory)
  #
  #       modified:   git.c
  #
  no changes added to commit (use "git add" and/or "git commit -a")

But out of these 8 lines, only two contain real informations, and the
(use "git bla") are just noise to expert users.

I've been thinking of a configuration option, like "core.expertuser"
or "ui.expertuser" that would let users disable these informative
messages on demand. I'm not sure how good the idea is.

--
Matthieu

^ permalink raw reply

* Re: Continue git clone after interruption
From: Sam Vilain @ 2009-08-23 10:37 UTC (permalink / raw)
  To: Nicolas Pitre
  Cc: Jakub Narebski, Tomasz Kontusz, git, Johannes Schindelin,
	Scott Chacon
In-Reply-To: <alpine.LFD.2.00.0908220155240.6044@xanadu.home>

On Sat, 2009-08-22 at 04:13 -0400, Nicolas Pitre wrote:
> > Ok, but right now there's no way to specify that you want a thin pack,
> > where the allowable base objects are *newer* than the commit range you
> > wish to include.
> 
> Sure you can.  Try this:
> 
> 	( echo "-$(git rev-parse v1.6.4)"; \
> 	  git rev-list --objects v1.6.2..v1.6.3 ) | \
> 		git pack-objects --progress --stdout > foo.pack
> 
> That'll give you a thin pack for the _new_ objects that _appeared_ 
> between v1.6.2 and v1.6.3, but which external delta base objects are 
> found in v1.6.4.

Aha.  I guess I had made an assumption about where that '-' lets
pack-objects find deltas from that aren't true.

> > What I said in my other e-mail where I showed how well it works taking
> > a given bundle, and slicing it into a series of thin packs, was that it
> > seems to add a bit of extra size to the resultant packs - best I got for
> > slicing up the entire git.git run was about 20%.  If this can be
> > reduced to under 10% (say), then sending bundle slices would be quite
> > reasonable by default for the benefit of making large fetches
> > restartable, or even spreadable across multiple mirrors.
> 
> In theory you could have about no overhead.  That all depends how you 
> slice the pack.  If you want a pack to contain a fixed number of commits 
> (such that all objects introduced by a given commit are all in the same 
> pack) then you are of course putting a constraint on the possible delta 
> matches and compression result might be suboptimal.  In comparison, with 
> a single big pack a given blob can delta against a blob from a 
> completely distant commit in the history graph if that provides a better 
> compression ratio.
 [...]
> If you were envisioning _clients_ à la BitTorrent putting up pack slices 
> instead, then in that case the slices have to be well defined entities, 
> like packs containing objects for known range of commits, but then we're 
> back to the delta inefficiency I mentioned above.

I'll do some more experiments to try to quantify this in light of this
new information; I still think that if the overhead is marginal there
are significant wins to this approach.

> And again this might 
> work only if a lot of people are interested in the same repository at 
> the same time, and of course most people have no big insentive to "seed" 
> once they got their copy. So I'm not sure if that might work that well 
> in practice.

Throw away terms like "seeding" and replace with "mirroring".  Sites
which currently house mirrors could potentially be helping serve git
repos, too.  Popular projects could have many mirrors and on the edges
of the internet, git servers could mirror many projects for users in
their country.

Sam

^ permalink raw reply

* Re: Lowlevel documentation
From: Björn Steinbrink @ 2009-08-23 10:33 UTC (permalink / raw)
  To: Eric Schaefer; +Cc: Git Mailing List
In-Reply-To: <34f8975d0908230304k41ea18b4xf57bdb3099ddfced@mail.gmail.com>

On 2009.08.23 12:04:44 +0200, Eric Schaefer wrote:
> Hi,
> 
> a couple of week ago I read a blog post, a paper or an article about
> how a simple scm could be designed step by step and how this would
> become git in the end. It explained really nicely how things in git
> work and why. Does anybody know which document I am talking about? I
> can't find it anymore...

I guess you're talking about the git parable:
http://tom.preston-werner.com/2009/05/19/the-git-parable.html

Björn

^ permalink raw reply

* Re: Lowlevel documentation
From: Matthias Kestenholz @ 2009-08-23 10:25 UTC (permalink / raw)
  To: Eric Schaefer; +Cc: Git Mailing List
In-Reply-To: <34f8975d0908230304k41ea18b4xf57bdb3099ddfced@mail.gmail.com>

On Sun, Aug 23, 2009 at 12:04 PM, Eric
Schaefer<eric.schaefer@ericschaefer.org> wrote:
> Hi,
>
> a couple of week ago I read a blog post, a paper or an article about
> how a simple scm could be designed step by step and how this would
> become git in the end. It explained really nicely how things in git
> work and why. Does anybody know which document I am talking about? I
> can't find it anymore...
>

I think you are referring to this blog post:

http://tom.preston-werner.com/2009/05/19/the-git-parable.html



Matthias

^ permalink raw reply

* Lowlevel documentation
From: Eric Schaefer @ 2009-08-23 10:04 UTC (permalink / raw)
  To: Git Mailing List

Hi,

a couple of week ago I read a blog post, a paper or an article about
how a simple scm could be designed step by step and how this would
become git in the end. It explained really nicely how things in git
work and why. Does anybody know which document I am talking about? I
can't find it anymore...

Thanks,
Eric

^ permalink raw reply

* Re: [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space on incomplete line
From: Junio C Hamano @ 2009-08-23  8:56 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Thell Fowler, git, Johannes.Schindelin
In-Reply-To: <20090823171819.6117@nanako3.lavabit.com>

Nanako Shiraishi <nanako3@lavabit.com> writes:

> Quoting Junio C Hamano <gitster@pobox.com>
>
>> How about doing it like this patch instead?  This counterproposal replaces
>> your 3 patches starting from [3/6].
>>
>> -- >8 --
>> Subject: xutils: Fix xdl_recmatch() on incomplete lines
>>
>> Thell Fowler noticed that various "ignore whitespace" options to
>> git diff does not work well with whitespace glitches on an incomplete
>> line.
>
> I think this should be "options to git diff don't work".

Soory, I kant speel; thanks.

> (1) Why do you post patches to the list, instead of committing them
> yourself?

So that others can catch silly mistakes of mine, like the one you just
caught.

I play three separate roles here, two of which I should send patches out
while playing them.

 * Just like everybody else, I find itches to scratch from time to time,
   and I build my own topic branches locally for the changes to scratch
   them, just like other contributors.

   They are indeed committed and often immediately merged to 'pu', but I
   send out format-patch output for them, because I firmly believe that
   the development _process_, not just the end result, should be in the
   open.  Everybody's patch should go through the list, get reviewed and
   improved by help from others.  So should mine.

 * I read others' patches, review, comment, and suggest improvements and
   make counterproposals, just like others on the list.

   The "how about" patches when I am playing this role are often not meant
   as the final shape of the patch but to show the direction to improve
   upon.  They are output from "git diff", not format-patch nor even "git
   diff --cached"---I do not commit, nor even add them to the index---and
   after I send out e-mails, I typically reset them away to work on
   something else, because they are usually not my itch.

 * I accept patches that were reviewed favorably on the list by running
   "git am" on them.

> (2) How do I apply a patch like this one to try to my tree? Am I
> expected to edit the mail message to remove everything before the shears
> mark before running the git-am command?

That is how I have been doing it.  My workflow is:

 (1) First read patches in my primary mailbox, while copying promising
     ones to a separate mailbox;

 (2) And then go through the separate mailbox as a separate pass, while
     fixing obvious typos and minor coding style violations still inside
     mailbox; and finally

 (3) Run "git am" on the (possibly edited) patch to apply.

Because I'll be editing the messages (both log and code) _anyway_,
removing everything before the scissors mark is not much of a trouble.

Having said that, I could use something like this.

-- >8 -- cut here -- >8 -- 
Subject: [PATCH] Teach mailinfo to ignore everything before -- >8 -- mark

This teaches mailinfo the scissors -- >8 -- mark; the command ignores
everything before it in the message body.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-mailinfo.c |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b0b5d8f..461c47e 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -712,6 +712,34 @@ static inline int patchbreak(const struct strbuf *line)
 	return 0;
 }
 
+static int scissors(const struct strbuf *line)
+{
+	size_t i, len = line->len;
+	int scissors_dashes_seen = 0;
+	const char *buf = line->buf;
+
+	for (i = 0; i < len; i++) {
+		if (isspace(buf[i]))
+			continue;
+		if (buf[i] == '-') {
+			scissors_dashes_seen |= 02;
+			continue;
+		}
+		if (i + 1 < len && !memcmp(buf + i, ">8", 2)) {
+			scissors_dashes_seen |= 01;
+			i++;
+			continue;
+		}
+		if (i + 7 < len && !memcmp(buf + i, "cut here", 8)) {
+			i += 7;
+			continue;
+		}
+		/* everything else --- not scissors */
+		break;
+	}
+	return scissors_dashes_seen == 03;
+}
+
 static int handle_commit_msg(struct strbuf *line)
 {
 	static int still_looking = 1;
@@ -723,10 +751,17 @@ static int handle_commit_msg(struct strbuf *line)
 		strbuf_ltrim(line);
 		if (!line->len)
 			return 0;
-		if ((still_looking = check_header(line, s_hdr_data, 0)) != 0)
+		still_looking = check_header(line, s_hdr_data, 0);
+		if (still_looking)
 			return 0;
 	}
 
+	if (scissors(line)) {
+		fseek(cmitmsg, 0L, SEEK_SET);
+		still_looking = 1;
+		return 0;
+	}
+
 	/* normalize the log message to UTF-8. */
 	if (metainfo_charset)
 		convert_to_utf8(line, charset.buf);
-- 
1.6.4.1

^ permalink raw reply related


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