Git development
 help / color / mirror / Atom feed
* Re: [msysGit] [FYI][PATCH] Customizing the WinGit installer
From: Johannes Schindelin @ 2008-10-06 14:22 UTC (permalink / raw)
  To: Petr Baudis; +Cc: msysgit, git
In-Reply-To: <20081003122727.GE10360@machine.or.cz>

Hi,

On Fri, 3 Oct 2008, Petr Baudis wrote:

> -InfoBeforeFile=gpl-2.0.rtf

I'd rather keep it in, especially in a corporate environment.

Ciao,
Dscho

^ permalink raw reply

* Re: [msysGit] [FYI][PATCH] Customizing the WinGit installer
From: Petr Baudis @ 2008-10-06 14:18 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: msysgit, git
In-Reply-To: <alpine.DEB.1.00.0810061621110.22125@pacific.mpi-cbg.de.mpi-cbg.de>

  Hi,

On Mon, Oct 06, 2008 at 04:22:08PM +0200, Johannes Schindelin wrote:
> On Fri, 3 Oct 2008, Petr Baudis wrote:
> 
> > -InfoBeforeFile=gpl-2.0.rtf
> 
> I'd rather keep it in, especially in a corporate environment.

  why? How is it relevant for the users?

  (Corporate environment or not, I actually never understood showing GPL
in the installers. It always seemed to me that people just feel the need
to fill the space where the EULA usually appears. ;-)

				Petr "Pasky" Baudis

^ permalink raw reply

* Re: [PATCH] builtin-commit: avoid always using reduce_heads()
From: Shawn O. Pearce @ 2008-10-06 14:19 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: jnareb, Johannes.Schindelin, git, SZEDER GGGbor
In-Reply-To: <1223236300-2170-1-git-send-email-vmiklos@frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> wrote:
> In case git merge --no-ff is used with --no-commit or we have a
> conflict, write info about if fast forwards are allowed or not to
> $GIT_DIR/MERGE_MODE.
 
> On Fri, Oct 03, 2008 at 07:59:15AM -0700, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> > ./test-lib.sh: line 237:   362 Segmentation fault      git commit -m
> > initial
> > * FAIL 1: setup
> >
> > I leave the debugging to you.  ;-)
> 
> That's weird, make test passed for me before I sent this patch. It was
> based on 15dc66a.
> 
> Now I squashed in Gabor's patch and rebased it against 52e8370, I hope
> it fixed the issue (make test still passes for me).

Yea, Gabor's patch squashed in is what was needed.  This is already
in next; it was there on Friday.  But thanks anyway.

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] rebase --no-verify
From: Shawn O. Pearce @ 2008-10-06 14:30 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: git
In-Reply-To: <20081006141429.6117@nanako3.lavabit.com>

Nanako Shiraishi <nanako3@lavabit.com> wrote:
> It is sometimes desirable to disable the safety net of pre-rebase hook
> when the user knows what he is doing (for example, when the original
> changes on the branch have not been shown to the public yet).
> 
> This teaches --no-verify option to git-rebase, which is similar to the way
> pre-commit hook is bypassed by git-commit.

Looks good.
 
>     It probably is better to fix "rebase -i" to share more code with the main
>     "rebase" script to avoid duplicated run-pre-rebase-hook function, but it
>     is beyond what I can do right now.  Perhaps people more smart and
>     beautiful than me can help (^_^;)

True.  But its already a mess.  git-sequencer is probably the
right approach to merge it all together.
 
>  git-rebase--interactive.sh |   10 +++++++++-
>  git-rebase.sh              |    7 ++++++-
>  t/t3409-rebase-hook.sh     |   16 ++++++++++++++++
>  3 files changed, 31 insertions(+), 2 deletions(-)

Docs?

-- 
Shawn.

^ permalink raw reply

* [PATCH 1/2] add--interactive: rename [r]evert command to [r]eset
From: Marc Weber @ 2008-10-06 14:46 UTC (permalink / raw)
  To: git; +Cc: Shawn Pearce
In-Reply-To: <20081005221150.GA22007@coredump.intra.peff.net>

The term "revert" is used very confusingly here. In git, to "revert"
is to take the changes made by a previous commit and un-apply them,
creating a new commit. The act of changing what is in the index to
match HEAD is called "reset".

Furthermore, incoming svn users will also find this confusing, since
to them, "revert" means to reset the working tree, which corresponds
to "checkout" in git.

Signed-off-by: Marc Weber <marco-oweber@gmx.de>
commit message rewritten by: Jeff King <peff@peff.net>
---
 git-add--interactive.perl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..5352d16 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,7 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
        }
        print "\n";
 }
@@ -1046,7 +1046,7 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of changes
@@ -1070,7 +1070,7 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],
-- 
1.6.0.2.309.g14f93

^ permalink raw reply related

* [PATCH 2/2] add--interactive: added [c]heckout
From: Marc Weber @ 2008-10-06 14:49 UTC (permalink / raw)
  To: git; +Cc: Shawn Pearce
In-Reply-To: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223304141.git.marco-oweber@gmx.de>

this is convinient for cygwin users not using rxvt.

added last (before quit and help) to not break menu layout and keep exisiting
numbering

Signed-off-by: Marc Weber <marco-oweber@gmx.de>
---
 git-add--interactive | 1129 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1129 insertions(+), 0 deletions(-)
 create mode 100755 git-add--interactive

diff --git a/git-add--interactive b/git-add--interactive
new file mode 100755
index 0000000..2e7fa55
--- /dev/null
+++ b/git-add--interactive
@@ -0,0 +1,1129 @@
+#!/nix/store/y0s7qlxqr35cqscfg9xy7pvvjmx1hgmn-perl-5.10.0/bin/perl -w
+use lib (split(/:/, $ENV{GITPERLLIB} || "/usr/local/lib/site_perl/5.10.0"));
+
+use strict;
+use Git;
+
+my $repo = Git->repository();
+
+my $menu_use_color = $repo->get_colorbool('color.interactive');
+my ($prompt_color, $header_color, $help_color) =
+	$menu_use_color ? (
+		$repo->get_color('color.interactive.prompt', 'bold blue'),
+		$repo->get_color('color.interactive.header', 'bold'),
+		$repo->get_color('color.interactive.help', 'red bold'),
+	) : ();
+
+my $diff_use_color = $repo->get_colorbool('color.diff');
+my ($fraginfo_color) =
+	$diff_use_color ? (
+		$repo->get_color('color.diff.frag', 'cyan'),
+	) : ();
+my ($diff_plain_color) =
+	$diff_use_color ? (
+		$repo->get_color('color.diff.plain', ''),
+	) : ();
+my ($diff_old_color) =
+	$diff_use_color ? (
+		$repo->get_color('color.diff.old', 'red'),
+	) : ();
+my ($diff_new_color) =
+	$diff_use_color ? (
+		$repo->get_color('color.diff.new', 'green'),
+	) : ();
+
+my $normal_color = $repo->get_color("", "reset");
+
+sub colored {
+	my $color = shift;
+	my $string = join("", @_);
+
+	if (defined $color) {
+		# Put a color code at the beginning of each line, a reset at the end
+		# color after newlines that are not at the end of the string
+		$string =~ s/(\n+)(.)/$1$color$2/g;
+		# reset before newlines
+		$string =~ s/(\n+)/$normal_color$1/g;
+		# codes at beginning and end (if necessary):
+		$string =~ s/^/$color/;
+		$string =~ s/$/$normal_color/ unless $string =~ /\n$/;
+	}
+	return $string;
+}
+
+# command line options
+my $patch_mode;
+
+sub run_cmd_pipe {
+	if ($^O eq 'MSWin32' || $^O eq 'msys') {
+		my @invalid = grep {m/[":*]/} @_;
+		die "$^O does not support: @invalid\n" if @invalid;
+		my @args = map { m/ /o ? "\"$_\"": $_ } @_;
+		return qx{@args};
+	} else {
+		my $fh = undef;
+		open($fh, '-|', @_) or die;
+		return <$fh>;
+	}
+}
+
+my ($GIT_DIR) = run_cmd_pipe(qw(git rev-parse --git-dir));
+
+if (!defined $GIT_DIR) {
+	exit(1); # rev-parse would have already said "not a git repo"
+}
+chomp($GIT_DIR);
+
+sub refresh {
+	my $fh;
+	open $fh, 'git update-index --refresh |'
+	    or die;
+	while (<$fh>) {
+		;# ignore 'needs update'
+	}
+	close $fh;
+}
+
+sub list_untracked {
+	map {
+		chomp $_;
+		$_;
+	}
+	run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @ARGV);
+}
+
+my $status_fmt = '%12s %12s %s';
+my $status_head = sprintf($status_fmt, 'staged', 'unstaged', 'path');
+
+{
+	my $initial;
+	sub is_initial_commit {
+		$initial = system('git rev-parse HEAD -- >/dev/null 2>&1') != 0
+			unless defined $initial;
+		return $initial;
+	}
+}
+
+sub get_empty_tree {
+	return '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
+}
+
+# Returns list of hashes, contents of each of which are:
+# VALUE:	pathname
+# BINARY:	is a binary path
+# INDEX:	is index different from HEAD?
+# FILE:		is file different from index?
+# INDEX_ADDDEL:	is it add/delete between HEAD and index?
+# FILE_ADDDEL:	is it add/delete between index and file?
+
+sub list_modified {
+	my ($only) = @_;
+	my (%data, @return);
+	my ($add, $del, $adddel, $file);
+	my @tracked = ();
+
+	if (@ARGV) {
+		@tracked = map {
+			chomp $_; $_;
+		} run_cmd_pipe(qw(git ls-files --exclude-standard --), @ARGV);
+		return if (!@tracked);
+	}
+
+	my $reference = is_initial_commit() ? get_empty_tree() : 'HEAD';
+	for (run_cmd_pipe(qw(git diff-index --cached
+			     --numstat --summary), $reference,
+			     '--', @tracked)) {
+		if (($add, $del, $file) =
+		    /^([-\d]+)	([-\d]+)	(.*)/) {
+			my ($change, $bin);
+			if ($add eq '-' && $del eq '-') {
+				$change = 'binary';
+				$bin = 1;
+			}
+			else {
+				$change = "+$add/-$del";
+			}
+			$data{$file} = {
+				INDEX => $change,
+				BINARY => $bin,
+				FILE => 'nothing',
+			}
+		}
+		elsif (($adddel, $file) =
+		       /^ (create|delete) mode [0-7]+ (.*)$/) {
+			$data{$file}{INDEX_ADDDEL} = $adddel;
+		}
+	}
+
+	for (run_cmd_pipe(qw(git diff-files --numstat --summary --), @tracked)) {
+		if (($add, $del, $file) =
+		    /^([-\d]+)	([-\d]+)	(.*)/) {
+			if (!exists $data{$file}) {
+				$data{$file} = +{
+					INDEX => 'unchanged',
+					BINARY => 0,
+				};
+			}
+			my ($change, $bin);
+			if ($add eq '-' && $del eq '-') {
+				$change = 'binary';
+				$bin = 1;
+			}
+			else {
+				$change = "+$add/-$del";
+			}
+			$data{$file}{FILE} = $change;
+			if ($bin) {
+				$data{$file}{BINARY} = 1;
+			}
+		}
+		elsif (($adddel, $file) =
+		       /^ (create|delete) mode [0-7]+ (.*)$/) {
+			$data{$file}{FILE_ADDDEL} = $adddel;
+		}
+	}
+
+	for (sort keys %data) {
+		my $it = $data{$_};
+
+		if ($only) {
+			if ($only eq 'index-only') {
+				next if ($it->{INDEX} eq 'unchanged');
+			}
+			if ($only eq 'file-only') {
+				next if ($it->{FILE} eq 'nothing');
+			}
+		}
+		push @return, +{
+			VALUE => $_,
+			%$it,
+		};
+	}
+	return @return;
+}
+
+sub find_unique {
+	my ($string, @stuff) = @_;
+	my $found = undef;
+	for (my $i = 0; $i < @stuff; $i++) {
+		my $it = $stuff[$i];
+		my $hit = undef;
+		if (ref $it) {
+			if ((ref $it) eq 'ARRAY') {
+				$it = $it->[0];
+			}
+			else {
+				$it = $it->{VALUE};
+			}
+		}
+		eval {
+			if ($it =~ /^$string/) {
+				$hit = 1;
+			};
+		};
+		if (defined $hit && defined $found) {
+			return undef;
+		}
+		if ($hit) {
+			$found = $i + 1;
+		}
+	}
+	return $found;
+}
+
+# inserts string into trie and updates count for each character
+sub update_trie {
+	my ($trie, $string) = @_;
+	foreach (split //, $string) {
+		$trie = $trie->{$_} ||= {COUNT => 0};
+		$trie->{COUNT}++;
+	}
+}
+
+# returns an array of tuples (prefix, remainder)
+sub find_unique_prefixes {
+	my @stuff = @_;
+	my @return = ();
+
+	# any single prefix exceeding the soft limit is omitted
+	# if any prefix exceeds the hard limit all are omitted
+	# 0 indicates no limit
+	my $soft_limit = 0;
+	my $hard_limit = 3;
+
+	# build a trie modelling all possible options
+	my %trie;
+	foreach my $print (@stuff) {
+		if ((ref $print) eq 'ARRAY') {
+			$print = $print->[0];
+		}
+		elsif ((ref $print) eq 'HASH') {
+			$print = $print->{VALUE};
+		}
+		update_trie(\%trie, $print);
+		push @return, $print;
+	}
+
+	# use the trie to find the unique prefixes
+	for (my $i = 0; $i < @return; $i++) {
+		my $ret = $return[$i];
+		my @letters = split //, $ret;
+		my %search = %trie;
+		my ($prefix, $remainder);
+		my $j;
+		for ($j = 0; $j < @letters; $j++) {
+			my $letter = $letters[$j];
+			if ($search{$letter}{COUNT} == 1) {
+				$prefix = substr $ret, 0, $j + 1;
+				$remainder = substr $ret, $j + 1;
+				last;
+			}
+			else {
+				my $prefix = substr $ret, 0, $j;
+				return ()
+				    if ($hard_limit && $j + 1 > $hard_limit);
+			}
+			%search = %{$search{$letter}};
+		}
+		if ($soft_limit && $j + 1 > $soft_limit) {
+			$prefix = undef;
+			$remainder = $ret;
+		}
+		$return[$i] = [$prefix, $remainder];
+	}
+	return @return;
+}
+
+# filters out prefixes which have special meaning to list_and_choose()
+sub is_valid_prefix {
+	my $prefix = shift;
+	return (defined $prefix) &&
+	    !($prefix =~ /[\s,]/) && # separators
+	    !($prefix =~ /^-/) &&    # deselection
+	    !($prefix =~ /^\d+/) &&  # selection
+	    ($prefix ne '*') &&      # "all" wildcard
+	    ($prefix ne '?');        # prompt help
+}
+
+# given a prefix/remainder tuple return a string with the prefix highlighted
+# for now use square brackets; later might use ANSI colors (underline, bold)
+sub highlight_prefix {
+	my $prefix = shift;
+	my $remainder = shift;
+
+	if (!defined $prefix) {
+		return $remainder;
+	}
+
+	if (!is_valid_prefix($prefix)) {
+		return "$prefix$remainder";
+	}
+
+	if (!$menu_use_color) {
+		return "[$prefix]$remainder";
+	}
+
+	return "$prompt_color$prefix$normal_color$remainder";
+}
+
+sub list_and_choose {
+	my ($opts, @stuff) = @_;
+	my (@chosen, @return);
+	my $i;
+	my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
+
+      TOPLOOP:
+	while (1) {
+		my $last_lf = 0;
+
+		if ($opts->{HEADER}) {
+			if (!$opts->{LIST_FLAT}) {
+				print "     ";
+			}
+			print colored $header_color, "$opts->{HEADER}\n";
+		}
+		for ($i = 0; $i < @stuff; $i++) {
+			my $chosen = $chosen[$i] ? '*' : ' ';
+			my $print = $stuff[$i];
+			my $ref = ref $print;
+			my $highlighted = highlight_prefix(@{$prefixes[$i]})
+			    if @prefixes;
+			if ($ref eq 'ARRAY') {
+				$print = $highlighted || $print->[0];
+			}
+			elsif ($ref eq 'HASH') {
+				my $value = $highlighted || $print->{VALUE};
+				$print = sprintf($status_fmt,
+				    $print->{INDEX},
+				    $print->{FILE},
+				    $value);
+			}
+			else {
+				$print = $highlighted || $print;
+			}
+			printf("%s%2d: %s", $chosen, $i+1, $print);
+			if (($opts->{LIST_FLAT}) &&
+			    (($i + 1) % ($opts->{LIST_FLAT}))) {
+				print "\t";
+				$last_lf = 0;
+			}
+			else {
+				print "\n";
+				$last_lf = 1;
+			}
+		}
+		if (!$last_lf) {
+			print "\n";
+		}
+
+		return if ($opts->{LIST_ONLY});
+
+		print colored $prompt_color, $opts->{PROMPT};
+		if ($opts->{SINGLETON}) {
+			print "> ";
+		}
+		else {
+			print ">> ";
+		}
+		my $line = <STDIN>;
+		if (!$line) {
+			print "\n";
+			$opts->{ON_EOF}->() if $opts->{ON_EOF};
+			last;
+		}
+		chomp $line;
+		last if $line eq '';
+		if ($line eq '?') {
+			$opts->{SINGLETON} ?
+			    singleton_prompt_help_cmd() :
+			    prompt_help_cmd();
+			next TOPLOOP;
+		}
+		for my $choice (split(/[\s,]+/, $line)) {
+			my $choose = 1;
+			my ($bottom, $top);
+
+			# Input that begins with '-'; unchoose
+			if ($choice =~ s/^-//) {
+				$choose = 0;
+			}
+			# A range can be specified like 5-7 or 5-.
+			if ($choice =~ /^(\d+)-(\d*)$/) {
+				($bottom, $top) = ($1, length($2) ? $2 : 1 + @stuff);
+			}
+			elsif ($choice =~ /^\d+$/) {
+				$bottom = $top = $choice;
+			}
+			elsif ($choice eq '*') {
+				$bottom = 1;
+				$top = 1 + @stuff;
+			}
+			else {
+				$bottom = $top = find_unique($choice, @stuff);
+				if (!defined $bottom) {
+					print "Huh ($choice)?\n";
+					next TOPLOOP;
+				}
+			}
+			if ($opts->{SINGLETON} && $bottom != $top) {
+				print "Huh ($choice)?\n";
+				next TOPLOOP;
+			}
+			for ($i = $bottom-1; $i <= $top-1; $i++) {
+				next if (@stuff <= $i || $i < 0);
+				$chosen[$i] = $choose;
+			}
+		}
+		last if ($opts->{IMMEDIATE} || $line eq '*');
+	}
+	for ($i = 0; $i < @stuff; $i++) {
+		if ($chosen[$i]) {
+			push @return, $stuff[$i];
+		}
+	}
+	return @return;
+}
+
+sub singleton_prompt_help_cmd {
+	print colored $help_color, <<\EOF ;
+Prompt help:
+1          - select a numbered item
+foo        - select item based on unique prefix
+           - (empty) select nothing
+EOF
+}
+
+sub prompt_help_cmd {
+	print colored $help_color, <<\EOF ;
+Prompt help:
+1          - select a single item
+3-5        - select a range of items
+2-3,6-9    - select multiple ranges
+foo        - select item based on unique prefix
+-...       - unselect specified items
+*          - choose all items
+           - (empty) finish selecting
+EOF
+}
+
+sub status_cmd {
+	list_and_choose({ LIST_ONLY => 1, HEADER => $status_head },
+			list_modified());
+	print "\n";
+}
+
+sub say_n_paths {
+	my $did = shift @_;
+	my $cnt = scalar @_;
+	print "$did ";
+	if (1 < $cnt) {
+		print "$cnt paths\n";
+	}
+	else {
+		print "one path\n";
+	}
+}
+
+sub update_cmd {
+	my @mods = list_modified('file-only');
+	return if (!@mods);
+
+	my @update = list_and_choose({ PROMPT => 'Update',
+				       HEADER => $status_head, },
+				     @mods);
+	if (@update) {
+		system(qw(git update-index --add --remove --),
+		       map { $_->{VALUE} } @update);
+		say_n_paths('updated', @update);
+	}
+	print "\n";
+}
+
+sub reset_cmd {
+	my @update = list_and_choose({ PROMPT => 'Reset',
+				       HEADER => $status_head, },
+				     list_modified());
+	if (@update) {
+		if (is_initial_commit()) {
+			system(qw(git rm --cached),
+				map { $_->{VALUE} } @update);
+		}
+		else {
+			my @lines = run_cmd_pipe(qw(git ls-tree HEAD --),
+						 map { $_->{VALUE} } @update);
+			my $fh;
+			open $fh, '| git update-index --index-info'
+			    or die;
+			for (@lines) {
+				print $fh $_;
+			}
+			close($fh);
+			for (@update) {
+				if ($_->{INDEX_ADDDEL} &&
+				    $_->{INDEX_ADDDEL} eq 'create') {
+					system(qw(git update-index --force-remove --),
+					       $_->{VALUE});
+					print "note: $_->{VALUE} is untracked now.\n";
+				}
+			}
+		}
+		refresh();
+		say_n_paths('reset', @update);
+	}
+	print "\n";
+}
+
+sub checkout_cmd {
+	my @update = list_and_choose({ PROMPT => 'Checkout',
+				       HEADER => $status_head, },
+				     list_modified());
+	if (@update) {
+		if (is_initial_commit()) {
+                        # should never be executed because there can't be modified files
+                        print "error: no revision in repo yet\n";
+		}
+		else {
+			for (@update) {
+                                system(qw(git checkout --),
+                                       $_->{VALUE});
+			}
+		}
+		refresh();
+		say_n_paths('checked out', @update);
+	}
+	print "\n";
+}
+
+sub add_untracked_cmd {
+	my @add = list_and_choose({ PROMPT => 'Add untracked' },
+				  list_untracked());
+	if (@add) {
+		system(qw(git update-index --add --), @add);
+		say_n_paths('added', @add);
+	}
+	print "\n";
+}
+
+sub parse_diff {
+	my ($path) = @_;
+	my @diff = run_cmd_pipe(qw(git diff-files -p --), $path);
+	my @colored = ();
+	if ($diff_use_color) {
+		@colored = run_cmd_pipe(qw(git diff-files -p --color --), $path);
+	}
+	my (@hunk) = { TEXT => [], DISPLAY => [] };
+
+	for (my $i = 0; $i < @diff; $i++) {
+		if ($diff[$i] =~ /^@@ /) {
+			push @hunk, { TEXT => [], DISPLAY => [] };
+		}
+		push @{$hunk[-1]{TEXT}}, $diff[$i];
+		push @{$hunk[-1]{DISPLAY}},
+			($diff_use_color ? $colored[$i] : $diff[$i]);
+	}
+	return @hunk;
+}
+
+sub parse_diff_header {
+	my $src = shift;
+
+	my $head = { TEXT => [], DISPLAY => [] };
+	my $mode = { TEXT => [], DISPLAY => [] };
+
+	for (my $i = 0; $i < @{$src->{TEXT}}; $i++) {
+		my $dest = $src->{TEXT}->[$i] =~ /^(old|new) mode (\d+)$/ ?
+			$mode : $head;
+		push @{$dest->{TEXT}}, $src->{TEXT}->[$i];
+		push @{$dest->{DISPLAY}}, $src->{DISPLAY}->[$i];
+	}
+	return ($head, $mode);
+}
+
+sub hunk_splittable {
+	my ($text) = @_;
+
+	my @s = split_hunk($text);
+	return (1 < @s);
+}
+
+sub parse_hunk_header {
+	my ($line) = @_;
+	my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) =
+	    $line =~ /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
+	$o_cnt = 1 unless defined $o_cnt;
+	$n_cnt = 1 unless defined $n_cnt;
+	return ($o_ofs, $o_cnt, $n_ofs, $n_cnt);
+}
+
+sub split_hunk {
+	my ($text, $display) = @_;
+	my @split = ();
+	if (!defined $display) {
+		$display = $text;
+	}
+	# If there are context lines in the middle of a hunk,
+	# it can be split, but we would need to take care of
+	# overlaps later.
+
+	my ($o_ofs, undef, $n_ofs) = parse_hunk_header($text->[0]);
+	my $hunk_start = 1;
+
+      OUTER:
+	while (1) {
+		my $next_hunk_start = undef;
+		my $i = $hunk_start - 1;
+		my $this = +{
+			TEXT => [],
+			DISPLAY => [],
+			OLD => $o_ofs,
+			NEW => $n_ofs,
+			OCNT => 0,
+			NCNT => 0,
+			ADDDEL => 0,
+			POSTCTX => 0,
+			USE => undef,
+		};
+
+		while (++$i < @$text) {
+			my $line = $text->[$i];
+			my $display = $display->[$i];
+			if ($line =~ /^ /) {
+				if ($this->{ADDDEL} &&
+				    !defined $next_hunk_start) {
+					# We have seen leading context and
+					# adds/dels and then here is another
+					# context, which is trailing for this
+					# split hunk and leading for the next
+					# one.
+					$next_hunk_start = $i;
+				}
+				push @{$this->{TEXT}}, $line;
+				push @{$this->{DISPLAY}}, $display;
+				$this->{OCNT}++;
+				$this->{NCNT}++;
+				if (defined $next_hunk_start) {
+					$this->{POSTCTX}++;
+				}
+				next;
+			}
+
+			# add/del
+			if (defined $next_hunk_start) {
+				# We are done with the current hunk and
+				# this is the first real change for the
+				# next split one.
+				$hunk_start = $next_hunk_start;
+				$o_ofs = $this->{OLD} + $this->{OCNT};
+				$n_ofs = $this->{NEW} + $this->{NCNT};
+				$o_ofs -= $this->{POSTCTX};
+				$n_ofs -= $this->{POSTCTX};
+				push @split, $this;
+				redo OUTER;
+			}
+			push @{$this->{TEXT}}, $line;
+			push @{$this->{DISPLAY}}, $display;
+			$this->{ADDDEL}++;
+			if ($line =~ /^-/) {
+				$this->{OCNT}++;
+			}
+			else {
+				$this->{NCNT}++;
+			}
+		}
+
+		push @split, $this;
+		last;
+	}
+
+	for my $hunk (@split) {
+		$o_ofs = $hunk->{OLD};
+		$n_ofs = $hunk->{NEW};
+		my $o_cnt = $hunk->{OCNT};
+		my $n_cnt = $hunk->{NCNT};
+
+		my $head = ("@@ -$o_ofs" .
+			    (($o_cnt != 1) ? ",$o_cnt" : '') .
+			    " +$n_ofs" .
+			    (($n_cnt != 1) ? ",$n_cnt" : '') .
+			    " @@\n");
+		my $display_head = $head;
+		unshift @{$hunk->{TEXT}}, $head;
+		if ($diff_use_color) {
+			$display_head = colored($fraginfo_color, $head);
+		}
+		unshift @{$hunk->{DISPLAY}}, $display_head;
+	}
+	return @split;
+}
+
+
+sub color_diff {
+	return map {
+		colored((/^@/  ? $fraginfo_color :
+			 /^\+/ ? $diff_new_color :
+			 /^-/  ? $diff_old_color :
+			 $diff_plain_color),
+			$_);
+	} @_;
+}
+
+sub edit_hunk_manually {
+	my ($oldtext) = @_;
+
+	my $hunkfile = $repo->repo_path . "/addp-hunk-edit.diff";
+	my $fh;
+	open $fh, '>', $hunkfile
+		or die "failed to open hunk edit file for writing: " . $!;
+	print $fh "# Manual hunk edit mode -- see bottom for a quick guide\n";
+	print $fh @$oldtext;
+	print $fh <<EOF;
+# ---
+# To remove '-' lines, make them ' ' lines (context).
+# To remove '+' lines, delete them.
+# Lines starting with # will be removed.
+#
+# If the patch applies cleanly, the edited hunk will immediately be
+# marked for staging. If it does not apply cleanly, you will be given
+# an opportunity to edit again. If all lines of the hunk are removed,
+# then the edit is aborted and the hunk is left unchanged.
+EOF
+	close $fh;
+
+	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
+		|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
+	system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
+
+	open $fh, '<', $hunkfile
+		or die "failed to open hunk edit file for reading: " . $!;
+	my @newtext = grep { !/^#/ } <$fh>;
+	close $fh;
+	unlink $hunkfile;
+
+	# Abort if nothing remains
+	if (!grep { /\S/ } @newtext) {
+		return undef;
+	}
+
+	# Reinsert the first hunk header if the user accidentally deleted it
+	if ($newtext[0] !~ /^@/) {
+		unshift @newtext, $oldtext->[0];
+	}
+	return \@newtext;
+}
+
+sub diff_applies {
+	my $fh;
+	open $fh, '| git apply --recount --cached --check';
+	for my $h (@_) {
+		print $fh @{$h->{TEXT}};
+	}
+	return close $fh;
+}
+
+sub prompt_yesno {
+	my ($prompt) = @_;
+	while (1) {
+		print colored $prompt_color, $prompt;
+		my $line = <STDIN>;
+		return 0 if $line =~ /^n/i;
+		return 1 if $line =~ /^y/i;
+	}
+}
+
+sub edit_hunk_loop {
+	my ($head, $hunk, $ix) = @_;
+	my $text = $hunk->[$ix]->{TEXT};
+
+	while (1) {
+		$text = edit_hunk_manually($text);
+		if (!defined $text) {
+			return undef;
+		}
+		my $newhunk = { TEXT => $text, USE => 1 };
+		if (diff_applies($head,
+				 @{$hunk}[0..$ix-1],
+				 $newhunk,
+				 @{$hunk}[$ix+1..$#{$hunk}])) {
+			$newhunk->{DISPLAY} = [color_diff(@{$text})];
+			return $newhunk;
+		}
+		else {
+			prompt_yesno(
+				'Your edited hunk does not apply. Edit again '
+				. '(saying "no" discards!) [y/n]? '
+				) or return undef;
+		}
+	}
+}
+
+sub help_patch_cmd {
+	print colored $help_color, <<\EOF ;
+y - stage this hunk
+n - do not stage this hunk
+a - stage this and all the remaining hunks in the file
+d - do not stage this hunk nor any of the remaining hunks in the file
+j - leave this hunk undecided, see next undecided hunk
+J - leave this hunk undecided, see next hunk
+k - leave this hunk undecided, see previous undecided hunk
+K - leave this hunk undecided, see previous hunk
+s - split the current hunk into smaller hunks
+e - manually edit the current hunk
+? - print help
+EOF
+}
+
+sub patch_update_cmd {
+	my @mods = grep { !($_->{BINARY}) } list_modified('file-only');
+	my @them;
+
+	if (!@mods) {
+		print STDERR "No changes.\n";
+		return 0;
+	}
+	if ($patch_mode) {
+		@them = @mods;
+	}
+	else {
+		@them = list_and_choose({ PROMPT => 'Patch update',
+					  HEADER => $status_head, },
+					@mods);
+	}
+	for (@them) {
+		patch_update_file($_->{VALUE});
+	}
+}
+
+sub patch_update_file {
+	my ($ix, $num);
+	my $path = shift;
+	my ($head, @hunk) = parse_diff($path);
+	($head, my $mode) = parse_diff_header($head);
+	for (@{$head->{DISPLAY}}) {
+		print;
+	}
+
+	if (@{$mode->{TEXT}}) {
+		while (1) {
+			print @{$mode->{DISPLAY}};
+			print colored $prompt_color,
+				"Stage mode change [y/n/a/d/?]? ";
+			my $line = <STDIN>;
+			if ($line =~ /^y/i) {
+				$mode->{USE} = 1;
+				last;
+			}
+			elsif ($line =~ /^n/i) {
+				$mode->{USE} = 0;
+				last;
+			}
+			elsif ($line =~ /^a/i) {
+				$_->{USE} = 1 foreach ($mode, @hunk);
+				last;
+			}
+			elsif ($line =~ /^d/i) {
+				$_->{USE} = 0 foreach ($mode, @hunk);
+				last;
+			}
+			else {
+				help_patch_cmd('');
+				next;
+			}
+		}
+	}
+
+	$num = scalar @hunk;
+	$ix = 0;
+
+	while (1) {
+		my ($prev, $next, $other, $undecided, $i);
+		$other = '';
+
+		if ($num <= $ix) {
+			$ix = 0;
+		}
+		for ($i = 0; $i < $ix; $i++) {
+			if (!defined $hunk[$i]{USE}) {
+				$prev = 1;
+				$other .= '/k';
+				last;
+			}
+		}
+		if ($ix) {
+			$other .= '/K';
+		}
+		for ($i = $ix + 1; $i < $num; $i++) {
+			if (!defined $hunk[$i]{USE}) {
+				$next = 1;
+				$other .= '/j';
+				last;
+			}
+		}
+		if ($ix < $num - 1) {
+			$other .= '/J';
+		}
+		for ($i = 0; $i < $num; $i++) {
+			if (!defined $hunk[$i]{USE}) {
+				$undecided = 1;
+				last;
+			}
+		}
+		last if (!$undecided);
+
+		if (hunk_splittable($hunk[$ix]{TEXT})) {
+			$other .= '/s';
+		}
+		$other .= '/e';
+		for (@{$hunk[$ix]{DISPLAY}}) {
+			print;
+		}
+		print colored $prompt_color, "Stage this hunk [y/n/a/d$other/?]? ";
+		my $line = <STDIN>;
+		if ($line) {
+			if ($line =~ /^y/i) {
+				$hunk[$ix]{USE} = 1;
+			}
+			elsif ($line =~ /^n/i) {
+				$hunk[$ix]{USE} = 0;
+			}
+			elsif ($line =~ /^a/i) {
+				while ($ix < $num) {
+					if (!defined $hunk[$ix]{USE}) {
+						$hunk[$ix]{USE} = 1;
+					}
+					$ix++;
+				}
+				next;
+			}
+			elsif ($line =~ /^d/i) {
+				while ($ix < $num) {
+					if (!defined $hunk[$ix]{USE}) {
+						$hunk[$ix]{USE} = 0;
+					}
+					$ix++;
+				}
+				next;
+			}
+			elsif ($other =~ /K/ && $line =~ /^K/) {
+				$ix--;
+				next;
+			}
+			elsif ($other =~ /J/ && $line =~ /^J/) {
+				$ix++;
+				next;
+			}
+			elsif ($other =~ /k/ && $line =~ /^k/) {
+				while (1) {
+					$ix--;
+					last if (!$ix ||
+						 !defined $hunk[$ix]{USE});
+				}
+				next;
+			}
+			elsif ($other =~ /j/ && $line =~ /^j/) {
+				while (1) {
+					$ix++;
+					last if ($ix >= $num ||
+						 !defined $hunk[$ix]{USE});
+				}
+				next;
+			}
+			elsif ($other =~ /s/ && $line =~ /^s/) {
+				my @split = split_hunk($hunk[$ix]{TEXT}, $hunk[$ix]{DISPLAY});
+				if (1 < @split) {
+					print colored $header_color, "Split into ",
+					scalar(@split), " hunks.\n";
+				}
+				splice (@hunk, $ix, 1, @split);
+				$num = scalar @hunk;
+				next;
+			}
+			elsif ($line =~ /^e/) {
+				my $newhunk = edit_hunk_loop($head, \@hunk, $ix);
+				if (defined $newhunk) {
+					splice @hunk, $ix, 1, $newhunk;
+				}
+			}
+			else {
+				help_patch_cmd($other);
+				next;
+			}
+			# soft increment
+			while (1) {
+				$ix++;
+				last if ($ix >= $num ||
+					 !defined $hunk[$ix]{USE});
+			}
+		}
+	}
+
+	my $n_lofs = 0;
+	my @result = ();
+	if ($mode->{USE}) {
+		push @result, @{$mode->{TEXT}};
+	}
+	for (@hunk) {
+		if ($_->{USE}) {
+			push @result, @{$_->{TEXT}};
+		}
+	}
+
+	if (@result) {
+		my $fh;
+
+		open $fh, '| git apply --cached --recount';
+		for (@{$head->{TEXT}}, @result) {
+			print $fh $_;
+		}
+		if (!close $fh) {
+			for (@{$head->{TEXT}}, @result) {
+				print STDERR $_;
+			}
+		}
+		refresh();
+	}
+
+	print "\n";
+}
+
+sub diff_cmd {
+	my @mods = list_modified('index-only');
+	@mods = grep { !($_->{BINARY}) } @mods;
+	return if (!@mods);
+	my (@them) = list_and_choose({ PROMPT => 'Review diff',
+				     IMMEDIATE => 1,
+				     HEADER => $status_head, },
+				   @mods);
+	return if (!@them);
+	my $reference = is_initial_commit() ? get_empty_tree() : 'HEAD';
+	system(qw(git diff -p --cached), $reference, '--',
+		map { $_->{VALUE} } @them);
+}
+
+sub quit_cmd {
+	print "Bye.\n";
+	exit(0);
+}
+
+sub help_cmd {
+	print colored $help_color, <<\EOF ;
+status        - show paths with changes
+update        - add working tree state to the staged set of changes
+reset         - reset staged set of changes back to the HEAD version
+patch         - pick hunks and update selectively
+diff	      - view diff between HEAD and index
+add untracked - add contents of untracked files to the staged set of changes
+EOF
+}
+
+sub process_args {
+	return unless @ARGV;
+	my $arg = shift @ARGV;
+	if ($arg eq "--patch") {
+		$patch_mode = 1;
+		$arg = shift @ARGV or die "missing --";
+		die "invalid argument $arg, expecting --"
+		    unless $arg eq "--";
+	}
+	elsif ($arg ne "--") {
+		die "invalid argument $arg, expecting --";
+	}
+}
+
+sub main_loop {
+	my @cmd = ([ 'status', \&status_cmd, ],
+		   [ 'update', \&update_cmd, ],
+		   [ 'reset', \&reset_cmd, ],
+		   [ 'add untracked', \&add_untracked_cmd, ],
+		   [ 'patch', \&patch_update_cmd, ],
+		   [ 'diff', \&diff_cmd, ],
+		   [ 'checkout', \&checkout_cmd, ],
+		   [ 'quit', \&quit_cmd, ],
+		   [ 'help', \&help_cmd, ],
+	);
+	while (1) {
+		my ($it) = list_and_choose({ PROMPT => 'What now',
+					     SINGLETON => 1,
+					     LIST_FLAT => 4,
+					     HEADER => '*** Commands ***',
+					     ON_EOF => \&quit_cmd,
+					     IMMEDIATE => 1 }, @cmd);
+		if ($it) {
+			eval {
+				$it->[1]->();
+			};
+			if ($@) {
+				print "$@";
+			}
+		}
+	}
+}
+
+process_args();
+refresh();
+if ($patch_mode) {
+	patch_update_cmd();
+}
+else {
+	status_cmd();
+	main_loop();
+}
-- 
1.6.0.2.309.g14f93

^ permalink raw reply related

* Re: [PATCH 2/2] add--interactive: added [c]heckout
From: Shawn O. Pearce @ 2008-10-06 14:51 UTC (permalink / raw)
  To: Marc Weber; +Cc: git
In-Reply-To: <353e718308129444268e61f251dab769761f095f.1223304141.git.marco-oweber@gmx.de>

Marc Weber <marco-oweber@gmx.de> wrote:
> this is convinient for cygwin users not using rxvt.
> 
> added last (before quit and help) to not break menu layout and keep exisiting
> numbering
> 
> Signed-off-by: Marc Weber <marco-oweber@gmx.de>
> ---
>  git-add--interactive | 1129 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 1129 insertions(+), 0 deletions(-)
>  create mode 100755 git-add--interactive
> 
> diff --git a/git-add--interactive b/git-add--interactive
> new file mode 100755
> index 0000000..2e7fa55
> --- /dev/null
> +++ b/git-add--interactive

Uhm, what is this patch against?  git.git?  If so why are we creating
a new 1129 line script named something erily close to a script we
already have?

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH 1/2] add--interactive: rename [r]evert command to [r]eset
From: Shawn O. Pearce @ 2008-10-06 14:55 UTC (permalink / raw)
  To: Marc Weber; +Cc: git
In-Reply-To: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223304141.git.marco-oweber@gmx.de>

Marc Weber <marco-oweber@gmx.de> wrote:
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index da768ee..5352d16 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -498,8 +498,8 @@ sub update_cmd {
>         print "\n";
>  }
>  
> -sub revert_cmd {
> -       my @update = list_and_choose({ PROMPT => 'Revert',
> +sub reset_cmd {
> +       my @update = list_and_choose({ PROMPT => 'Reset',
>                                        HEADER => $status_head, },
>                                      list_modified());
>         if (@update) {

This patch is mangled.  The context line immediately above is
indented with tabs in the source file, but is 8 spaces in the patch.
The patch doesn't apply.

-- 
Shawn.

^ permalink raw reply

* Git filter branch - removing empty commits
From: Peter Waller @ 2008-10-06 14:57 UTC (permalink / raw)
  To: git


Dear List,

I have removed lots of files from my history with a procedure something like
this:

1) Clone repository

2) git filter-branch --index-filter 'git rm --quiet -r Archive; git ls-files
-z '\''*.png'\'' '\''*.eps'\'' | xargs -0r git rm --quiet; true'

3) git reflog expire --expire=0 --all

4) git prune; git gc

The problem is that this leaves many empty commits.

The helpful people over at #git advised I do:

git filter-branch --commit-filter 'if [ z$1 = z`git rev-parse $3^{tree} 2>
/dev/null` ]; then skip_commit "$@"; else git commit-tree "$@"; fi'

But this gets to about commit 70/1300 and grinds to a halt. I modified
/usr/libexec/git-core/git-filter-branch to say #!/bin/sh -x, and the result
was over 80mb in a few seconds.

I have pasted the last few lines here:
http://rafb.net/p/ABWvCy44.html

It is like it is following some exponential behaviour and not getting
anywhere.

Any ideas what is wrong?

I have tried a couple of scripts I have found around that should do the same
thing, for example:

skip_commit()
{
        shift
        while [[ -n $1 ]] ; do
                shift
                map "$1"
                shift
        done
}

our_tree="$1"
our_parent_tree=$(map $3)

if [[ ${our_tree} == $(git rev-parse $(map $3)) ]]; then
        git commit-tree "$@"
else
        skip_commit "$@"
fi

This goes much faster, but when it reaches the final commit, it says this:
Ref 'refs/heads/master' was deleted
fatal: Not a valid object name HEAD

And not much useful seems to have happened.

Any help appreciated.

Regards,

- Peter
-- 
View this message in context: http://www.nabble.com/Git-filter-branch---removing-empty-commits-tp19839587p19839587.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply

* Re: [msysGit] [FYI][PATCH] Customizing the WinGit installer
From: Johannes Schindelin @ 2008-10-06 15:23 UTC (permalink / raw)
  To: Petr Baudis; +Cc: msysgit, git
In-Reply-To: <20081006141840.GO10360@machine.or.cz>

Hi,

On Mon, 6 Oct 2008, Petr Baudis wrote:

>   Hi,
> 
> On Mon, Oct 06, 2008 at 04:22:08PM +0200, Johannes Schindelin wrote:
> > On Fri, 3 Oct 2008, Petr Baudis wrote:
> > 
> > > -InfoBeforeFile=gpl-2.0.rtf
> > 
> > I'd rather keep it in, especially in a corporate environment.
> 
>   why? How is it relevant for the users?

To give them an idea about their _rights_.  Because they are entitled by 
the GPL to get -- in source -- the changes that were done to that 
particular distributions.

Speaking from experience, companies usually do not want to tell you about 
your rights with regard to free software.

And in this case, I have a personal interest.  I feel that my efforts to 
the msysGit project are not really rewarded.  People like to use it, but 
they hardly give anything back (you being a very notable exception).

Ciao,
Dscho

^ permalink raw reply

* [PATCH RFC] rebase--interactive: if preserving merges, use first-parent to limit what is shown.
From: Stephen Haberman @ 2008-10-06 15:21 UTC (permalink / raw)
  To: Avi Kivity; +Cc: git
In-Reply-To: <48E8DD7E.9040706@redhat.com>

This commit fixes Avi Kivity's use case of squashing two commits on either side
of a merge together.

Changes include:

- Delaying storing the rewrite information if the current commit we are
  applying is being squashed. This means storing multiple lines in the
  current-commit file and recording each of them as rewritten to the
  same HEAD on the next commit.

- Move the "no squashing merges" check into the case statement for
  merges as previously it was catching catching even single-parent
  squashes.

- Conditionally pass "--first-parent" to `git rev-list` based on whether
  this is a rebase is preserving merges or not.

- At the end, just take the current head for the new branch ref instead
  of trying to look up what the OLDHEAD was rewritten to. This fails
  because the OLDHEAD was squashed/moved up earlier in the timeline, so
  even if we can find its rewritten HEAD, that is no longer what we
  ended up at.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
---

I agree with Avi on what the rebase -i -p behavior should be for his
scenario. This patch makes it so. However, the bane of my existence,
t3404 is failing ~12 tests in, which is a real PITA to debug, so please
let me know if this is a worthwhile tangent to continue on.

(That last change of dropping the OLDHEAD->NEWHEAD guessing is probably
what is causing t3404 to fail, but I can't reason why it'd need to do
that rather than just use HEAD.)

I've read in the archives about the git-sequencer stuff, which sounds
cool, my thought is that, if anything, this will clarify git rebase -i -p
behavior and add tests that can later be ensured to still pass when
git-sequencer is dropped in.

 git-rebase--interactive.sh               |   53 ++++++++++---------
 t/t3411-rebase-preserve-around-merges.sh |   83 ++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+), 25 deletions(-)
 create mode 100644 t/t3411-rebase-preserve-around-merges.sh

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index edb6ec6..9914111 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -159,13 +159,18 @@ pick_one_preserving_merges () {
 
 	if test -f "$DOTEST"/current-commit
 	then
-		current_commit=$(cat "$DOTEST"/current-commit) &&
-		git rev-parse HEAD > "$REWRITTEN"/$current_commit &&
-		rm "$DOTEST"/current-commit ||
-		die "Cannot write current commit's replacement sha1"
+		if [ "$fast_forward" == "t" ]
+		then
+			cat "$DOTEST"/current-commit | while read current_commit
+			do
+				git rev-parse HEAD > "$REWRITTEN"/$current_commit
+			done
+			rm "$DOTEST"/current-commit ||
+			die "Cannot write current commit's replacement sha1"
+		fi
 	fi
 
-	echo $sha1 > "$DOTEST"/current-commit
+	echo $sha1 >> "$DOTEST"/current-commit
 
 	# rewrite parents; if none were rewritten, we can fast-forward.
 	new_parents=
@@ -193,15 +198,19 @@ pick_one_preserving_merges () {
 			die "Cannot fast forward to $sha1"
 		;;
 	f)
-		test "a$1" = a-n && die "Refusing to squash a merge: $sha1"
-
 		first_parent=$(expr "$new_parents" : ' \([^ ]*\)')
-		# detach HEAD to current parent
-		output git checkout $first_parent 2> /dev/null ||
-			die "Cannot move HEAD to $first_parent"
+
+		if [ "$1" != "-n" ]
+		then
+			# detach HEAD to current parent
+			output git checkout $first_parent 2> /dev/null ||
+				die "Cannot move HEAD to $first_parent"
+		fi
 
 		case "$new_parents" in
 		' '*' '*)
+			test "a$1" = a-n && die "Refusing to squash a merge: $sha1"
+
 			# redo merge
 			author_script=$(get_author_ident_from_commit $sha1)
 			eval "$author_script"
@@ -350,20 +359,7 @@ do_next () {
 	HEADNAME=$(cat "$DOTEST"/head-name) &&
 	OLDHEAD=$(cat "$DOTEST"/head) &&
 	SHORTONTO=$(git rev-parse --short $(cat "$DOTEST"/onto)) &&
-	if test -d "$REWRITTEN"
-	then
-		test -f "$DOTEST"/current-commit &&
-			current_commit=$(cat "$DOTEST"/current-commit) &&
-			git rev-parse HEAD > "$REWRITTEN"/$current_commit
-		if test -f "$REWRITTEN"/$OLDHEAD
-		then
-			NEWHEAD=$(cat "$REWRITTEN"/$OLDHEAD)
-		else
-			NEWHEAD=$OLDHEAD
-		fi
-	else
-		NEWHEAD=$(git rev-parse HEAD)
-	fi &&
+	NEWHEAD=$(git rev-parse HEAD) &&
 	case $HEADNAME in
 	refs/*)
 		message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)" &&
@@ -561,11 +557,18 @@ first and then run 'git rebase --continue' again."
 			MERGES_OPTION=--no-merges
 		fi
 
+		if test t = "$PRESERVE_MERGES"
+		then
+			first_parent="--first-parent"
+		else
+			first_parent=""
+		fi
+
 		SHORTUPSTREAM=$(git rev-parse --short $UPSTREAM)
 		SHORTHEAD=$(git rev-parse --short $HEAD)
 		SHORTONTO=$(git rev-parse --short $ONTO)
 		git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
-			--abbrev=7 --reverse --left-right --cherry-pick \
+			--abbrev=7 --reverse --left-right --cherry-pick $first_parent \
 			$UPSTREAM...$HEAD | \
 			sed -n "s/^>/pick /p" > "$TODO"
 		cat >> "$TODO" << EOF
diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh
new file mode 100644
index 0000000..b130f5f
--- /dev/null
+++ b/t/t3411-rebase-preserve-around-merges.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Stephen Haberman
+#
+
+test_description='git rebase preserve merges
+
+This test runs git rebase with and tries to squash a commit from after a merge
+to before the merge.
+'
+. ./test-lib.sh
+
+# Copy/paste from t3404-rebase-interactive.sh
+echo "#!$SHELL_PATH" >fake-editor.sh
+cat >> fake-editor.sh <<\EOF
+case "$1" in
+*/COMMIT_EDITMSG)
+	test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
+	test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
+	exit
+	;;
+esac
+test -z "$EXPECT_COUNT" ||
+	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
+	exit
+test -z "$FAKE_LINES" && exit
+grep -v '^#' < "$1" > "$1".tmp
+rm -f "$1"
+cat "$1".tmp
+action=pick
+for line in $FAKE_LINES; do
+	case $line in
+	squash|edit)
+		action="$line";;
+	*)
+		echo sed -n "${line}s/^pick/$action/p"
+		sed -n "${line}p" < "$1".tmp
+		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
+		action=pick;;
+	esac
+done
+EOF
+
+test_set_editor "$(pwd)/fake-editor.sh"
+chmod a+x fake-editor.sh
+
+# set up two branches like this:
+#
+# A - B - D - E - F
+#      \     /
+#       - C -
+
+test_expect_success 'setup' '
+	touch a &&
+	touch b &&
+	git add a &&
+	git commit -m A &&
+	git add b &&
+	git commit -m B &&
+	git tag B &&
+	git checkout -b branch &&
+	touch c &&
+	git add c &&
+	git commit -m C &&
+	git checkout master &&
+	touch d &&
+	git add d &&
+	git commit -m D &&
+	git merge branch &&
+	touch f &&
+	git add f &&
+	git commit -m F &&
+	git tag F
+'
+
+test_expect_success 'squash F into D' '
+	FAKE_LINES="1 squash 3 2" git rebase -i -p B &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse branch)" &&
+	test "$(git rev-parse HEAD~2)" = "$(git rev-parse B)"
+'
+
+test_done
+
-- 
1.6.0.2

^ permalink raw reply related

* Re: [PATCH 0/4] diff text conversion filter
From: Matthieu Moy @ 2008-10-06 15:15 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Jeff King, git
In-Reply-To: <48E9B036.6090805@viscovery.net>

Johannes Sixt <j.sixt@viscovery.net> writes:

> Does the series in any way change whether plumbing and porcelain invoke
> the external diff drivers? I have this particular use-case, which I'd like
> that still works:
>
> - In .git/info/attributes I have specified a diff driver:
>
>     *.doc   diff=docdiff
>
>   The driver runs a script that literally loads the two version of the
>   file into MS Word and uses Word's diffing capability.
>
> - git-gui should not use the diff driver. That is, plumbing should bypass
>   the diff driver and say "Binary files differ". [*]

Actually, I understand you don't want git gui and gitk to load MS-Word
anytime you click something, but I'd love to see the textconv+diff in
gitk.

(yeah, that's pretty hard to specify right, the ideal requirement
seems to be "in a gui, use the good part of the diff driver, but not
the other" :-\).

-- 
Matthieu

^ permalink raw reply

* Re: [PATCH 1/2] add--interactive: rename [r]evert command to [r]eset
From: Marc Weber @ 2008-10-06 15:51 UTC (permalink / raw)
  To: git
In-Reply-To: <20081006145509.GD8203@spearce.org>

> This patch is mangled.  The context line immediately above is
Sorry, I thought set paste sets noexpandtab as well, I was wrong.


============= patch starting at commit message =======================
The term "revert" is used very confusingly here. In git, to "revert"
is to take the changes made by a previous commit and un-apply them,
creating a new commit. The act of changing what is in the index to
match HEAD is called "reset".

Furthermore, incoming svn users will also find this confusing, since
to them, "revert" means to reset the working tree, which corresponds
to "checkout" in git.

Signed-off-by: Marc Weber <marco-oweber@gmx.de>
commit message rewritten by: Jeff King <peff@peff.net>
---
 git-add--interactive.perl |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..5352d16 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
 	print "\n";
 }
 
-sub revert_cmd {
-	my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+	my @update = list_and_choose({ PROMPT => 'Reset',
 				       HEADER => $status_head, },
 				     list_modified());
 	if (@update) {
@@ -527,7 +527,7 @@ sub revert_cmd {
 			}
 		}
 		refresh();
-		say_n_paths('reverted', @update);
+		say_n_paths('reset', @update);
 	}
 	print "\n";
 }
@@ -1046,7 +1046,7 @@ sub help_cmd {
 	print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
 patch         - pick hunks and update selectively
 diff	      - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of changes
@@ -1070,7 +1070,7 @@ sub process_args {
 sub main_loop {
 	my @cmd = ([ 'status', \&status_cmd, ],
 		   [ 'update', \&update_cmd, ],
-		   [ 'revert', \&revert_cmd, ],
+		   [ 'reset', \&reset_cmd, ],
 		   [ 'add untracked', \&add_untracked_cmd, ],
 		   [ 'patch', \&patch_update_cmd, ],
 		   [ 'diff', \&diff_cmd, ],
-- 
1.6.0.2.GIT

^ permalink raw reply related

* Re: [PATCH 2/2] add--interactive: added [c]heckout
From: Marc Weber @ 2008-10-06 15:55 UTC (permalink / raw)
  To: git; +Cc: spearce
In-Reply-To: <20081006145137.GC8203@spearce.org>

> Uhm, what is this patch against?  git.git?  If so why are we creating
> a new 1129 line script named something erily close to a script we
> already have?
I accidently added the dist file git-add--interactive instead of
the .perl file.. I'll take more care the next time.
Both patches should apply cleanly against git.git master branch c4275591fb

============= 2/2 starting at commit message =========================
From 741d1e87669ced27a41f8be1b7b65836bd969d5a Mon Sep 17 00:00:00 2001
Message-Id: <741d1e87669ced27a41f8be1b7b65836bd969d5a.1223307236.git.marco-oweber@gmx.de>
In-Reply-To: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223307236.git.marco-oweber@gmx.de>
References: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223307236.git.marco-oweber@gmx.de>
From: Marc Weber <marco-oweber@gmx.de>
Date: Mon, 6 Oct 2008 14:32:13 +0000
Subject: [PATCH 2/2] add--interactive: added [c]heckout

this is convinient for cygwin users not using rxvt.

command added last (before quit and help) to not break menu layout and keep exisiting
numbering

Signed-off-by: Marc Weber <marco-oweber@gmx.de>
---
 git-add--interactive.perl |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 5352d16..34629b5 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -532,6 +532,27 @@ sub reset_cmd {
 	print "\n";
 }
 
+sub checkout_cmd {
+	my @update = list_and_choose({ PROMPT => 'Checkout',
+				       HEADER => $status_head, },
+				     list_modified());
+	if (@update) {
+		if (is_initial_commit()) {
+			# should never be executed because there can't be modified files
+			print "error: no revision in repo yet\n";
+		}
+		else {
+			for (@update) {
+				system(qw(git checkout --),
+				$_->{VALUE});
+			}
+		}
+		refresh();
+		say_n_paths('checked out', @update);
+	}
+	print "\n";
+}
+
 sub add_untracked_cmd {
 	my @add = list_and_choose({ PROMPT => 'Add untracked' },
 				  list_untracked());
@@ -1074,6 +1095,7 @@ sub main_loop {
 		   [ 'add untracked', \&add_untracked_cmd, ],
 		   [ 'patch', \&patch_update_cmd, ],
 		   [ 'diff', \&diff_cmd, ],
+		   [ 'checkout', \&checkout_cmd, ],
 		   [ 'quit', \&quit_cmd, ],
 		   [ 'help', \&help_cmd, ],
 	);
-- 
1.6.0.2.GIT

^ permalink raw reply related

* Re: [msysGit] [FYI][PATCH] Customizing the WinGit installer
From: Jakub Narebski @ 2008-10-06 16:00 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Petr Baudis, msysgit, git
In-Reply-To: <alpine.DEB.1.00.0810061718240.22125@pacific.mpi-cbg.de.mpi-cbg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Mon, 6 Oct 2008, Petr Baudis wrote:
> > On Mon, Oct 06, 2008 at 04:22:08PM +0200, Johannes Schindelin wrote:
> > > On Fri, 3 Oct 2008, Petr Baudis wrote:
> > > 
> > > > -InfoBeforeFile=gpl-2.0.rtf
> > > 
> > > I'd rather keep it in, especially in a corporate environment.
> > 
> >   why? How is it relevant for the users?
> 
> To give them an idea about their _rights_.  Because they are entitled by 
> the GPL to get -- in source -- the changes that were done to that 
> particular distributions.
> 
> Speaking from experience, companies usually do not want to tell you about 
> your rights with regard to free software.
> 
> And in this case, I have a personal interest.  I feel that my efforts to 
> the msysGit project are not really rewarded.  People like to use it, but 
> they hardly give anything back (you being a very notable exception).

Wouldn't it be better to keep it, but move it from EULA position
to for example 'License' item in 'Help' entry (below 'About') in
gitk and git-gui?  IIRC there was a lot of controversy about Firefox
using EULA, although MS Windows users are most probably used to it...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [msysGit] [FYI][PATCH] Customizing the WinGit installer
From: Johannes Schindelin @ 2008-10-06 16:12 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Petr Baudis, msysgit, git
In-Reply-To: <m3zllhpvby.fsf@localhost.localdomain>

Hi,

On Mon, 6 Oct 2008, Jakub Narebski wrote:

> Wouldn't it be better to keep it [showing the GPL], but move it from 
> EULA position to for example 'License' item in 'Help' entry (below 
> 'About') in gitk and git-gui?  IIRC there was a lot of controversy about 
> Firefox using EULA, although MS Windows users are most probably used to 
> it...

Well, I consider it a courtesy to the msysGit people to leave it where it 
is.  Of course, this is free software and you are free to disregard my 
wish.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] rebase --no-verify
From: Stephan Beyer @ 2008-10-06 16:07 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Nanako Shiraishi, git
In-Reply-To: <20081006143028.GC7684@spearce.org>

Hi,

Shawn O. Pearce wrote:
> >     It probably is better to fix "rebase -i" to share more code with the main
> >     "rebase" script to avoid duplicated run-pre-rebase-hook function, but it
> >     is beyond what I can do right now.  Perhaps people more smart and
> >     beautiful than me can help (^_^;)
> 
> True.  But its already a mess.  git-sequencer is probably the
> right approach to merge it all together.

Hmm, I don't think I like the pre-rebase hook in sequencer. The user
scripts (git-rebase--interactive.sh and git-rebase.sh) should run them;
that's ok.

I think, for the moment it is ok to have the code duplicated.  After
sequencer has merged into master[1], I will probably take a look at
merging git-rebase.sh and git-rebase--interactive.sh if somebody
else is interested in it and if there is a good way to achieve that.

Regards,
  Stephan

Footnotes:
 1. For the *very* interested ones of you,
 	http://repo.or.cz/w/git/sbeyer.git
    is the way to go. seq-builtin-dev is the active development branch
    and git's master is frequently merged into it. seq-builtin-rfc^ is
    an approach to possible patchsets (for review).

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

^ permalink raw reply

* Re: [PATCH] rebase --no-verify
From: Shawn O. Pearce @ 2008-10-06 16:14 UTC (permalink / raw)
  To: Stephan Beyer; +Cc: Nanako Shiraishi, git
In-Reply-To: <20081006160716.GC14479@leksak.fem-net>

Stephan Beyer <s-beyer@gmx.net> wrote:
> Shawn O. Pearce wrote:
> > >     It probably is better to fix "rebase -i" to share more code with the main
> > >     "rebase" script to avoid duplicated run-pre-rebase-hook function, but it
> > >     is beyond what I can do right now.  Perhaps people more smart and
> > >     beautiful than me can help (^_^;)
> > 
> > True.  But its already a mess.  git-sequencer is probably the
> > right approach to merge it all together.
> 
> Hmm, I don't think I like the pre-rebase hook in sequencer. The user
> scripts (git-rebase--interactive.sh and git-rebase.sh) should run them;
> that's ok.

Sorry, my remark wasn't about the rebase hook as much as it was
that there is a good chunk of code duplicated between the two
rebase implementations and all of them were implemented through
git-sequencer its likely they could all collapse into a single
common "git rebase" wrapper script which just sets up the call
to git-sequencer.

So yea, I do agree, the pre-rebase hook should be in rebase, not
git-sequencer, but git-sequencer probably offers a great way to
get the different rebase implementations combined together.
 
> I think, for the moment it is ok to have the code duplicated.  After
> sequencer has merged into master[1], I will probably take a look at
> merging git-rebase.sh and git-rebase--interactive.sh if somebody
> else is interested in it and if there is a good way to achieve that.

Yup, exactly my thoughts.  I just didn't express them well.

-- 
Shawn.

^ permalink raw reply

* What's in git/spearce.git (Oct 2008, #01; Mon, 06)
From: Shawn O. Pearce @ 2008-10-06 16:59 UTC (permalink / raw)
  To: git

What's in git/spearce.git (Oct 2008, #01; Mon, 06)

  maint e261cf9 (Update release notes for 1.6.0.3)
 master 276328f (Merge branch 'maint')
------------------------------------------------------------------------

Junio should be returning from vacation this week.  I will keep
updating my git/spearce.git tree until he gets back and asks for
my current topic heads.

Once Junio gets back I think we need to focus on getting 1.6.0.3
out the door.  We have 77 commits queued up since 1.6.0.2 and it
has been almost 4 weeks since our last maint release.

So please, test, test, test maint.

--------

* The 'maint' branch has these fixes since the last announcement.

Alexander Gavrilov (1):
  builtin-blame: Fix blame -C -C with submodules.

David Soria Parra (1):
  Solaris: Use OLD_ICONV to avoid compile warnings

Dmitry Potapov (2):
  make prefix_path() never return NULL
  do not segfault if make_cache_entry failed

Giuseppe Bilotta (1):
  gitweb: remove PATH_INFO from $my_url and $my_uri

Jakub Narebski (2):
  gitweb: Fix two 'uninitialized value' warnings in git_tree()
  gitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh

Linus Torvalds (1):
  fix bogus "diff --git" header from "diff --no-index"

Luc Heinrich (1):
  git-svn: call 'fatal' correctly in set-tree

Michael Prokop (1):
  Replace svn.foo.org with svn.example.com in git-svn docs (RFC 2606)

Nanako Shiraishi (2):
  docs: describe pre-rebase hook
  Teach rebase -i to honor pre-rebase hook

SZEDER Gábor (3):
  t0024: add executable permission
  Documentation: remove '\' in front of short options
  bash: remove fetch, push, pull dashed form leftovers

Shawn O. Pearce (1):
  Update release notes for 1.6.0.3

Tuncer Ayaz (1):
  Fix fetch/clone --quiet when stdout is connected

martin f. krafft (1):
  Improve git-log documentation wrt file filters


* The 'master' branch has these since the last announcement
  in addition to the above.

Brandon Casey (1):
  diff.c: remove duplicate bibtex pattern introduced by merge 92bb9785

David Aguilar (1):
  tests: add a testcase for "git submodule sync"

David Bryson (1):
  Use "git_config_string" to simplify "builtin-gc.c" code where
    "prune_expire" is set

Dmitry Potapov (1):
  do not segfault if make_cache_entry failed

Jeff King (1):
  tests: grep portability fixes

Jonathan del Strother (1):
  Add OS X support to the pre-auto-gc example hook

Nanako Shiraishi (5):
  dir.c: make dir_add_name() and dir_add_ignored() static
  run-command.c: remove run_command_v_opt_cd()
  config.c: make git_parse_long() static
  commit.c: make read_graft_file() static
  archive.c: make archiver static

Nicolas Pitre (1):
  fix openssl headers conflicting with custom SHA1 implementations

Petr Baudis (3):
  gitweb: Quote non-displayable characters in hex, not octal
  config.c: Tolerate UTF8 BOM at the beginning of config file
  gitweb: Identify all summary metadata table rows

Ralf Wildenhues (1):
  Correct typos in RelNotes-1.6.1

SZEDER Gábor (1):
  remove vim syntax highlighting in favor of upstream


-- 
Shawn.

^ permalink raw reply

* What's cooking in git/spearce.git (Oct 2008, #01; Mon, 06)
From: Shawn O. Pearce @ 2008-10-06 16:59 UTC (permalink / raw)
  To: git

What's cooking in git/spearce.git (Oct 2008, #01; Mon, 06)
--------------------------------------------------

Here are the topics that have been cooking.  Commits prefixed
with '-' are only in 'pu' while commits prefixed with '+' are
in 'next'.

The topics list the commits in reverse chronological order.  The topics
meant to be merged to the maintenance series have "maint-" in their names.

Topics aren't sorted by name; I have tried to cluster them together
to tell the story of how 'next' and 'pu' have evolved this past week.

----------------------------------------------------------------
[New Topics]

* sp/describe-docs (Tue Sep 30 11:55:16 2008 -0700) 1 commit
 . docs: Improve the description of describe --tags

I'm probably going to drop this topic if I can ever get around to
formally writing and posting sp/describe-lwtag for review.

* sp/describe-lwtag (Tue Sep 30 12:03:41 2008 -0700) 1 commit
 - [WIP] Change meaning of --tags and --all

Modifies "git describe --tags" to allow matching against lightweight
tags even when an annotated tag is found in the history.  Its not
in next because I haven't formally written a commit message and
posted the patch for discussion on the list.

This is a fairly significant change in behavior.  Its most certainly
1.6.1 material, but many argue the change is the _correct_ behavior
and the current behavior in 1.6.0 is buggy.

* jk/diff-convfilter (Sun Oct 5 17:43:45 2008 -0400) 4 commits
 - diff: add filter for converting binary to text
 - diff: introduce diff.<driver>.binary
 - diff: unify external diff and funcname parsing code
 - t4012: use test_cmp instead of cmp

A general cleanup on how diff drivers are implemented.  Its still
missing documentation updates and tests but doesn't break anything
current as far as I can tell.  It needs more review before it can
be slated for 'next'.

* pb/rename-rowin32 (Fri Oct 3 12:20:43 2008 +0200) 1 commit
 - Do not rename read-only files during a push

Supposedly fixes pack file renames on Windows, but it makes the
test suite fail on Linux.  I haven't debugged why yet.  Its very
likely we need a replacement patch before this can move forward.

* gb/formatpatch-autonbr (Thu Oct 2 16:55:39 2008 -0400) 1 commit
 - format-patch: autonumber by default

Fails the test suite; some of the test vectors need to be updated
to account for the new default.  Someone who cares about this
change should follow through on the test suite update, or this may
get dropped.

* sh/maint-intrebase (Wed Oct 1 01:11:07 2008 -0500) 1 commit
 + Fix interactive rebase on dropped commits.

This merged to next, then was reverted out this morning, due to
the introduction of the sh/maint-rebase3.  Its dead and will be
dropped from the next "What's cooking" release notes.

* sh/maint-rebase3 (Sun Oct 5 23:26:52 2008 -0500) 1 commit
 - rebase--interactive: fix parent rewriting for dropped commits

A replacement for sh/maint-intrebase.  Its in pu because I have
gotten 3 different versions of this patch, two of them posted a
full 4 days after I merged the first version into next.  I felt
burned by the patch author for not keeping up with my tree, so I'm
not merging the patch to next.

At this point its going to sit in pu until Junio comes back.
I think the topic needs a few more days to settle to see if the
patch author is going to submit any more revisions.

* ns/rebase-noverify (Mon Oct 6 14:14:29 2008 +0900) 1 commit
 + rebase --no-verify

This adds --no-verify to git rebase, to avoid the pre-rebase hook.
Lacks documentation but otherwise looks sound.

* mv/merge-noff (Fri Oct 3 14:04:47 2008 +0200) 1 commit
 + builtin-commit: use reduce_heads() only when appropriate

Fixes "git merge --no-ff --no-commit".

* dp/cywginstat (Tue Sep 30 17:53:47 2008 +0400) 3 commits
 + cygwin: Use native Win32 API for stat
 + mingw: move common functionality to win32.h
 + add have_git_dir() function

Performance improvement for Cygwin, bypassing the Cygwin stat
function and using one more like MinGW uses.  Probably ready for
master on the next round.  Several Cygwin users have given praise
to the series.

* js/objc-funchdr (Wed Oct 1 00:46:34 2008 +0100) 1 commit
 + Teach git diff about Objective-C syntax

Adds support for Objective-C function headers.  I don't use
Objective-C so I can't comment on how good/bad the patterns are
for the language.  Feedback (and improvements if necessary) from
Objective-C users would be appreciated.

* dm/svn-branch (Sat Oct 4 19:35:17 2008 -0700) 1 commit
 + Add git-svn branch to allow branch creation in SVN repositories

Adds "git svn branch" to build branches remotely in SVN.

Might be ready for master, it has an ACK from Eric.  Slated into next
just because I wasn't sure if Junio merges such things immediately
into master or lets them cook for a bit.

* pb/gitweb (Fri Oct 3 07:41:25 2008 -0700) 7 commits
 + Merge branch 'pb/gitweb-tagcloud' into pb/gitweb
 + gitweb: Support for simple project search form
 + gitweb: Make the by_tag filter delve in forks as well
 + gitweb: Support for tag clouds
 + gitweb: Add support for extending the action bar with custom links
 + gitweb: Sort the list of forks on the summary page by age
 + gitweb: Clean-up sorting of project list

I may have been a bad interm maintainer here by shoving together
two different gitweb series from Pasky.  Overall the combined set
looks ready to me.

* ph/parseopt (Thu Oct 2 14:59:20 2008 +0200) 3 commits
 + parse-opt: migrate builtin-merge-file.
 + parse-opt: migrate git-merge-base.
 + parse-opt: migrate fmt-merge-msg.

* rz/grepz (Wed Oct 1 18:11:15 2008 +0200) 1 commit
 + git grep: Add "-z/--null" option as in GNU's grep.

* mv/merge-refresh (Fri Oct 3 15:02:31 2008 +0200) 1 commit
 + builtin-merge: refresh the index before calling a strategy

* bc/xdiffnl (Wed Oct 1 14:28:26 2008 -0500) 1 commit
 + xdiff-interface.c: strip newline (and cr) from line before pattern
   matching

* ae/preservemerge (Mon Sep 29 22:28:57 2008 +0200) 1 commit
 + rebase: Support preserving merges in non-interactive mode

These last five all look ready for master, but should cook longer
than just a few days.

----------------------------------------------------------------
[Old New Topics]

* mw/sendemail (Sun Sep 28 07:51:21 2008 +0300) 10 commits
 + bash completion: Add --[no-]validate to "git send-email"
 + send-email: signedoffcc -> signedoffbycc, but handle both
 + Docs: send-email: Create logical groupings for man text
 + Docs: send-email: Create logical groupings for --help text
 + Docs: send-email: Remove unnecessary config variable description
 + Docs: send-email: --chain_reply_to -> --[no-]chain-reply-to
 + send-email: change --no-validate to boolean --[no-]validate
 + Docs: send-email: Man page option ordering
 + Docs: send-email usage text much sexier
 + Docs: send-email's usage text and man page mention same options

This series looks pretty good to me.  It probably can merge to
master on the next "What's cooking" cycle.

----------------------------------------------------------------
[Dropped Topics]

* sg/merge-options (Sun Apr 6 03:23:47 2008 +0200) 1 commit
 + merge: remove deprecated summary and diffstat options and config
   variables

This has been reverted from next and is being dropped.  Its too
soon to remove a feature that was just added in 1.5.6 timeframe.
Perhaps in 1.7.0 this can be revisited.

----------------------------------------------------------------
[Stuck Topics]

* nd/narrow (Wed Oct 1 11:04:09 2008 +0700) 9 commits
 - grep: skip files outside sparse checkout area
 - checkout_entry(): CE_NO_CHECKOUT on checked out entries.
 - Prevent diff machinery from examining worktree outside sparse
   checkout
 - ls-files: Add tests for --sparse and friends
 - update-index: add --checkout/--no-checkout to update
   CE_NO_CHECKOUT bit
 - update-index: refactor mark_valid() in preparation for new options
 - ls-files: add options to support sparse checkout
 - Introduce CE_NO_CHECKOUT bit
 - Extend index to save more flags

Recently updated with a repost.  I've been too swamped at day-job
to actively review the series.  There has been some discussion on
list about it so its not stalled, but it needs more eyeballs.

* gb/gitweb-pathinfo (Thu Oct 2 02:10:34 2008 +0200) 6 commits
 - gitweb: generate parent..current URLs
 - gitweb: parse parent..current syntax from pathinfo
 - gitweb: use_pathinfo filenames start with /
 - gitweb: generate project/action/hash URLs
 - gitweb: refactor input parameters parse/validation
 - gitweb: parse project/action/hash_base:filename PATH_INFO

Still going through revisions on the git ML.  Its great work and
is heading in the right direction.  But the discussion and patch
generation rate is too high to merge the topic into next just yet.

So its waiting for a re-roll of the series once discussion settles
down and there is a final patch series available.

----------------------------------------------------------------
[Stalled -- Needs Action to Proceed (or to be dropped)]

* pb/submodule (Fri Sep 12 23:09:19 2008 +0200) 1 commit
 - t7400: Add short "git submodule add" testsuite

Still waiting for a reroll.  Should be dropped next week if we
don't get one during this coming week.

* bd/blame (Thu Aug 21 18:22:01 2008 -0500) 5 commits
 - Use xdiff caching to improve git blame performance
 - Allow xdiff machinery to cache hash results for a file
 - Always initialize xpparam_t to 0
 - Bypass textual patch generation and parsing in git blame
 - Allow alternate "low-level" emit function from xdl_diff

(jc: Réne had good comments on how the callback should be
 structured.)

* kb/am-directory (Fri Aug 29 15:27:50 2008 -0700) 1 commit
 - git-am: Pass the --directory option through to git-apply

(jc: I think this is still buggy and drops the option when am stops
 with conflicts.)

All three of these are stalled.  I'm not going to drop them just
yet, but Junio's comments still hold.  If there's no action on
these next week we may seem them drop off.

----------------------------------------------------------------
[Will be merged to 'master/maint' soon]

* jc/add-ita (Thu Aug 21 01:44:53 2008 -0700) 1 commit
 + git-add --intent-to-add (-N)

Teaches "git add" to record only the intent to add a path later.
(jc: I rerolled this without the fake empty blob object.)

* mg/verboseprune (Mon Sep 29 18:49:52 2008 +0200) 1 commit
 + make prune report removed objects on -v

This is a pretty trivial new feature.

* pb/commit-where (Fri Oct 3 22:13:49 2008 -0400) 4 commits
 + tutorial: update output of git commit
 + reformat informational commit message
 + git commit: Reformat output somewhat
 + builtin-commit.c: show on which branch a commit was added

I think this topic is settled for now.

* jk/maint-soliconv (Fri Oct 3 02:39:36 2008 -0400) 1 commit
 + Makefile: do not set NEEDS_LIBICONV for Solaris 8

* sg/maint-intrebase-msghook (Fri Oct 3 11:33:20 2008 +0200) 2 commits
 + rebase -i: remove leftover debugging
 + rebase -i: proper prepare-commit-msg hook argument when squashing

* bc/maint-stashref (Thu Oct 2 18:52:11 2008 -0500) 1 commit
 + git-stash.sh: fix flawed fix of invalid ref handling (commit
   da65e7c1)

The latter three are ready for 'maint'.  I felt burned by a bad
commit into made directly into maint earlier in the week so these
wound up getting queued into 'next' first, even though they are
certainly maint material.

----------------------------------------------------------------
[Actively Cooking]

* tr/workflow-doc (Sat Sep 13 18:11:01 2008 +0200) 2 commits
 + Documentation: Refer to git-rebase(1) to warn against rewriting
 + Documentation: new upstream rebase recovery section in git-rebase

(jc: My impression from the last round of discusson on the third
 patch in this series (not queued here) was that as long as we
 do not present it as "One True Workflow", the description was
 a good starting point, possibly others to add other recommended
 flows later.)

I haven't looked at this series yet.  Based on Junio's remarks above
I'm looking for more input on this series before it goes anywhere.

* lt/time-reject-fractional-seconds (Sat Aug 16 21:25:40 2008 -0700) 1 commit
 + date/time: do not get confused by fractional seconds

I need to look at this in more detail.  I suspect we can merge
this to master soon, but its been kicking around since Aug 16th.
I need to look at it to see if there's any obvious reason why Junio
has no notes on this branch and why it hasn't merged yet.

----------------------------------------------------------------
[On Hold]

* jc/post-simplify (Fri Aug 15 01:34:51 2008 -0700) 2 commits
 - revision --simplify-merges: incremental simplification
 - revision --simplify-merges: prepare for incremental simplification

(jc: I started making this incremental but the progress is not
 so great.)

* jc/stripspace (Sun Mar 9 00:30:35 2008 -0800) 6 commits
 - git-am --forge: add Signed-off-by: line for the author
 - git-am: clean-up Signed-off-by: lines
 - stripspace: add --log-clean option to clean up signed-off-by:
   lines
 - stripspace: use parse_options()
 - Add "git am -s" test
 - git-am: refactor code to add signed-off-by line for the committer

(jc: The one at second from the tip needs reworking.)

* jc/send-pack-tell-me-more (Thu Mar 20 00:44:11 2008 -0700) 1 commit
 - "git push": tellme-more protocol extension

This is a great idea, but IIRC its implementation has a deadlock
during communication between the peers.  Someone needs to pick up
this topic and resolve the deadlock before it can continue.

* jc/blame (Wed Jun 4 22:58:40 2008 -0700) 2 commits
 - blame: show "previous" information in --porcelain/--incremental
   format
 - git-blame: refactor code to emit "porcelain format" output

* jc/merge-whitespace (Sun Feb 24 23:29:36 2008 -0800) 1 commit
 . WIP: start teaching the --whitespace=fix to merge machinery

This has a merge conflict with `next` and isn't even in pu right now.

* jk/renamelimit (Sat May 3 13:58:42 2008 -0700) 1 commit
 - diff: enable "too large a rename" warning when -M/-C is explicitly
   asked for

(jc: This would be the right thing to do for command line use,
 but gitk will be hit due to tcl/tk's limitation, so I am holding
 this back for now.)

-- 
Shawn.

^ permalink raw reply

* Re: [xfs-masters] git://oss.sgi.com broke
From: Russell Cattelan @ 2008-10-06 16:31 UTC (permalink / raw)
  To: xfs-masters; +Cc: git, Andrew Morton
In-Reply-To: <20081003121903.6c9a7ebc.akpm@linux-foundation.org>

Andrew Morton wrote:
> y:/usr/src/git26> git --version
> git version 1.5.6.rc0
>
> y:/usr/src/git26> cat .git/branches/git-xfs
> git://oss.sgi.com:8090/xfs/xfs-2.6.git#master
>
> y:/usr/src/git26> git-fetch git-xfs        
> remote: usage: git-pack-objects [{ -q | --progress | --all-progress }] 
> remote:         [--max-pack-size=N] [--local] [--incremental] 
> remote:         [--window=N] [-remote: -window-memory=N] [--depth=N] 
> remote:         [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] 
> remote:         [--threads=N] [--non-empty] [--reremote: vs [--unpacked | --all]*] [--reflog] 
> remote:         [--stdout | base-name] [--keep-unreachable] [<ref-list | <object-list]
> remote: aborting due to possible repository corruption on the remote side.
> fatal: protocol error: bad pack header
>
> It was OK yesterday.
>   

Hmm sees to work for me.
oss is running a newer version of git 1.6.0.2,  I wonder if there some 
version incomparability happening?
I'm using 1.5.6.4 on my remote client and it did a clone just fine.
Ahh but indeed a fetch failed ...
But it also fails with using v1.5.6.5 of git-daemon ...

So I don't know what is going on.

I'll keep digging into it.

Ohh and BTW we finally got the firewall set up to allow native git traffic
so you can drop port 8090 from the url.





> (cc'ing the git list in case this is an faq?)
>
> The last two error messages there look wrong/misleading?
>
>   

^ permalink raw reply

* Re: how to restrict commit for a repo
From: Dilip M @ 2008-10-06 17:12 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Git Mailing List
In-Reply-To: <20081006130042.GQ23137@genesis.frugalware.org>

2008/10/6 Miklos Vajna <vmiklos@frugalware.org>:
> On Mon, Oct 06, 2008 at 05:39:39PM +0530, Dilip M <dilipm79@gmail.com> wrote:
>> If I have a repository, how to prevent push from other repo's into
>> mine master's? I want to prevent the commits from all developers and
>> allow only few ppl to commit to masters..
>
> Have you seen contrib/hooks/update-paranoid?

Miklos,  I am totally new to this tool ( don't know SVN too) . Can you
please consider giving some more info...or guiding me to some good
links...:)

Thanks in advance..

-- 
dm

^ permalink raw reply

* Re: git://oss.sgi.com broke
From: Linus Torvalds @ 2008-10-06 17:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: xfs-masters, git
In-Reply-To: <20081003121903.6c9a7ebc.akpm@linux-foundation.org>



On Fri, 3 Oct 2008, Andrew Morton wrote:
>
> y:/usr/src/git26> git --version
> git version 1.5.6.rc0
> 
> y:/usr/src/git26> cat .git/branches/git-xfs
> git://oss.sgi.com:8090/xfs/xfs-2.6.git#master

Hmm. That's the really old and deprecated branch format.

I'm getting a "Connection refused" from oss.sgi.com, and I think there's 
possibly something broken there, but quite independently of that, maybe we 
can try to teach you another way to set up remote branches?

In your .git/config file, use

	[remote "git-xfs"]
		url = git://oss.sgi.com:8090/xfs/xfs-2.6.git
		fetch = master

because the whole .git/branches/<branch-name> thing is fairly deprecated, 
and cannot handle some things that the .git/config file format can (like 
saying where to fetch into, or how to push back etc).

		Linus

^ permalink raw reply

* Re: [FYI][PATCH] Customizing the WinGit installer
From: Petr Baudis @ 2008-10-06 17:23 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: msysgit, git
In-Reply-To: <alpine.DEB.1.00.0810061718240.22125@pacific.mpi-cbg.de.mpi-cbg.de>


  Hi,

On Mon, Oct 06, 2008 at 05:23:19PM +0200, Johannes Schindelin wrote:
> To give them an idea about their _rights_.  Because they are entitled by 
> the GPL to get -- in source -- the changes that were done to that 
> particular distributions.
> 
> Speaking from experience, companies usually do not want to tell you about 
> your rights with regard to free software.
> 
> And in this case, I have a personal interest.  I feel that my efforts to 
> the msysGit project are not really rewarded.  People like to use it, but 
> they hardly give anything back (you being a very notable exception).

  Maybe this is a little of a misunderstanding. This is not a "consumer"
aimed customized Git version. This is for internal Git usage within the
corporation, the users have varying interest in Git but it is generally
very low, they just regard it as another tool and they will never hack
or customize it; I just don't see a point in bothering them with another
extra installation step. Maybe in more general Git distribution I would
agree this change indeed is not that appropriate (even though in my own
GPL'd project, I wouldn't add the GPL step to the installer anyway).

-- 
				Petr "Pasky" Baudis
People who take cold baths never have rheumatism, but they have
cold baths.

^ permalink raw reply

* Re: [xfs-masters] git://oss.sgi.com broke
From: Russell Cattelan @ 2008-10-06 17:30 UTC (permalink / raw)
  To: xfs-masters; +Cc: git, Andrew Morton
In-Reply-To: <20081003121903.6c9a7ebc.akpm@linux-foundation.org>

Andrew Morton wrote:
> y:/usr/src/git26> git --version
> git version 1.5.6.rc0
>
> y:/usr/src/git26> cat .git/branches/git-xfs
> git://oss.sgi.com:8090/xfs/xfs-2.6.git#master
>
> y:/usr/src/git26> git-fetch git-xfs        
> remote: usage: git-pack-objects [{ -q | --progress | --all-progress }] 
> remote:         [--max-pack-size=N] [--local] [--incremental] 
> remote:         [--window=N] [-remote: -window-memory=N] [--depth=N] 
> remote:         [--no-reuse-delta] [--no-reuse-object] [--delta-base-offset] 
> remote:         [--threads=N] [--non-empty] [--reremote: vs [--unpacked | --all]*] [--reflog] 
> remote:         [--stdout | base-name] [--keep-unreachable] [<ref-list | <object-list]
> remote: aborting due to possible repository corruption on the remote side.
> fatal: protocol error: bad pack header
>
> It was OK yesterday.
>
> (cc'ing the git list in case this is an faq?)
>
> The last two error messages there look wrong/misleading?
>
>   
Ok not sure exactly what was wrong but it looks like there was some 
confusion
with older git bits still install on oss.

I manually cleaned everything from the system and reinstalled git from a 
fresh "make rpm" rpm.

Please try your pull again and see if the problem is resolved.

-Russell

^ permalink raw reply


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