Git development
 help / color / mirror / Atom feed
* Re: [PATCH] completion: add --graph to log command completion
From: Teemu Likonen @ 2008-06-20  6:31 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Dan McGee, git, gitster
In-Reply-To: <20080619225552.GQ11793@spearce.org>

Shawn O. Pearce wrote (2008-06-19 18:55 -0400):

> Teemu Likonen <tlikonen@iki.fi> wrote:
> > I think I have already sent twice a patch with --graph completion.
> 
> I didn't Ack them because at the time --graph wasn't even in next yet
> I think.  Then I got busy and forgot.  And --graph slipped through
> into the 1.5.6 release without your bash completion patches. Sorry.

No problems. I should have sent a ping to the list after the log --graph
settled to the master branch. But... I forgot.

^ permalink raw reply

* Re: [PATCH] graph.c: make many functions static
From: Adam Simpkins @ 2008-06-20  6:00 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: しらいしななこ, git
In-Reply-To: <7vhcbptev8.fsf@gitster.siamese.dyndns.org>

On Thu, Jun 19, 2008 at 12:16:11PM -0700, Junio C Hamano wrote:
> しらいしななこ  <nanako3@lavabit.com> writes:
> 
> > ---
> >  graph.c |   57 +++++++++++++++++++++++++++++++++++++++++++--------------
> >  graph.h |   40 ----------------------------------------
> >  2 files changed, 43 insertions(+), 54 deletions(-)
> >
> > diff --git a/graph.c b/graph.c
> > index e2633f8..5f82170 100644
> > --- a/graph.c
> > +++ b/graph.c
> > @@ -4,6 +4,43 @@
> >  #include "diff.h"
> >  #include "revision.h"
> >  
> > +/* Internal API */
> > + ...
> > +static int graph_next_line(struct git_graph *graph, struct strbuf *sb);
> > +static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
> > +static void graph_show_strbuf(struct git_graph *graph, struct strbuf const *sb);
> 
> I think these are probably fine, not in the sense that nobody calls these
> functions _right now_ but in the sense that I do not foresee a calling
> sequence outside the graph.c internal that needs to call these directly,
> instead of calling graph_show_*() functions that use these.

Documentation/technical/api-history-graph.txt should also be updated
to remove the discussion of these functions if they are no longer
publicly exposed.

-- 
Adam Simpkins
adam@adamsimpkins.net

^ permalink raw reply

* Re: [PATCH 3/3] Make rebase--interactive use OPTIONS_SPEC
From: Stephan Beyer @ 2008-06-20  5:48 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Christian Couder
In-Reply-To: <1213929935-15093-4-git-send-email-s-beyer@gmx.net>

Ouch, here is a little mistake:
> +OPTIONS_SPEC='
> +git-rebase -i [options] <upstream> [<branch>]

Must be:
	OPTIONS_SPEC='git-rebase -i [options] <upstream> [<branch>]
...or the usage string will be empty.

Are there other reasons for a v2?

Regards,
  Stephan

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

^ permalink raw reply

* git-svn show-ignore error
From: Adam Doeler @ 2008-06-20  3:27 UTC (permalink / raw)
  To: git

Hello - can anyone help me figure out what is causing the error below,  
and how to get past it..

I started by running:

% git-svn clone -s svn+ssh://path/to/repo local_dir
% cd local_dir
% git-svn show-ignore
Filesystem has no item: File not found: revision 175, path '/build'  
at /opt/local/bin/git-svn line 1879

The repository layout in the trunk is:
/build
/website

build has another directory, which has files, and directories, etc.
website the application files, framework, more directories, files, etc.

Any help with this would be awesome, I have not done anything beyond  
the commands listed above.
-Adam

^ permalink raw reply

* [WIP/PATCH v3] gitweb: add test suite with Test::WWW::Mechanize::CGI
From: Lea Wiemann @ 2008-06-20  3:18 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Lea Wiemann
In-Reply-To: <1213487844-685-1-git-send-email-LeWiemann@gmail.com>

From: Jakub Narebski <jnareb@gmail.com>

This test uses Test::WWW::Mechanize::CGI to check gitweb's output.  It
also uses HTML::Lint (if present) to validate the HTML.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
I haven't gotten around to merging Jakub's recent XML validation patch
yet, but I think it'd be good to have some review now; I'll merge it
tomorrow and send another patch.

Changes since v2:

t9503-gitweb-Mechanize.sh has stayed the same, but t9503/test.pl has
been overhauled: extracted common code into helper functions, only
validate if --long-tests if given, added link-checking with
--long-tests, added some minor tests for page contents, and added
tests for the summary page at the bottom.

This runs on top of the *next* branch plus the following patches:

[PATCH] gitweb: respect $GITPERLLIB
    http://article.gmane.org/gmane.comp.version-control.git/85586/raw
[PATCH 1/2 v3] t/test-lib.sh: add test_external and test_external_without_stderr
    http://article.gmane.org/gmane.comp.version-control.git/85504/raw
[PATCH v3] gitweb: standarize HTTP status codes
    http://article.gmane.org/gmane.comp.version-control.git/85522/raw

(The latter two patches might be in next already by the time you're
reading this.)


 t/t9503-gitweb-Mechanize.sh |  128 +++++++++++++++++++++++++++++++++++++++++++
 t/t9503/test.pl             |  128 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 256 insertions(+), 0 deletions(-)
 create mode 100755 t/t9503-gitweb-Mechanize.sh
 create mode 100755 t/t9503/test.pl

diff --git a/t/t9503-gitweb-Mechanize.sh b/t/t9503-gitweb-Mechanize.sh
new file mode 100755
index 0000000..abcf987
--- /dev/null
+++ b/t/t9503-gitweb-Mechanize.sh
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Jakub Narebski
+# Copyright (c) 2008 Lea Wiemann
+#
+
+test_description='gitweb as CGI (using WWW::Mechanize)
+
+This test uses Perl module Test::WWW::Mechanize::CGI to
+check gitweb output, using HTML::Lint to validate HTML.'
+
+# helper functions
+
+safe_chmod () {
+	chmod "$1" "$2" &&
+	if [ "$(git config --get core.filemode)" = false ]
+	then
+		git update-index --chmod="$1" "$2"
+	fi
+}
+
+. ./test-lib.sh
+
+# check if test can be run
+perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
+	test_expect_success \
+		'skipping gitweb tests, perl version is too old' :
+	test_done
+	exit
+}
+
+perl -MTest::WWW::Mechanize::CGI -e '' >/dev/null 2>&1 || {
+	test_expect_success \
+		'skipping gitweb tests, Test::WWW::Mechanize::CGI not found' :
+	test_done
+	exit
+}
+
+# set up test repository
+test_expect_success 'set up test repository' '
+
+	echo "Not an empty file." > file &&
+	git add file &&
+	test_tick && git commit -a -m "Initial commit." &&
+	git branch b &&
+
+	echo "New file" > new_file &&
+	git add new_file &&
+	test_tick && git commit -a -m "File added." &&
+
+	safe_chmod +x new_file &&
+	test_tick && git commit -a -m "Mode changed." &&
+
+	git mv new_file renamed_file &&
+	test_tick && git commit -a -m "File renamed." &&
+
+	rm renamed_file &&
+	ln -s file renamed_file &&
+	test_tick && git commit -a -m "File to symlink." &&
+	git tag with-symlink &&
+
+	git rm renamed_file &&
+	rm -f renamed_file &&
+	test_tick && git commit -a -m "File removed." &&
+
+	cp file file2 &&
+	git add file2 &&
+	test_tick && git commit -a -m "File copied." &&
+
+	echo "New line" >> file2 &&
+	safe_chmod +x file2 &&
+	test_tick && git commit -a -m "Mode change and modification." &&
+
+	git checkout b &&
+	echo "Branch" >> b &&
+	git add b &&
+	test_tick && git commit -a -m "On branch" &&
+	git checkout master &&
+	test_tick && git pull . b
+'
+
+# set up empty repository
+# TODO!
+
+# set up repositories for gitweb
+# TODO!
+
+# set up gitweb configuration
+safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
+cat >gitweb_config.perl <<EOF
+#!/usr/bin/perl
+
+# gitweb configuration for tests
+
+our \$version = "current";
+our \$GIT = "$GIT_EXEC_PATH/git";
+our \$projectroot = "$safe_pwd";
+our \$project_maxdepth = 8;
+our \$home_link_str = "projects";
+our \$site_name = "[localhost]";
+our \$site_header = "";
+our \$site_footer = "";
+our \$home_text = "indextext.html";
+our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css");
+our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png";
+our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png";
+our \$projects_list = "";
+our \$export_ok = "";
+our \$strict_export = "";
+
+1;
+__END__
+EOF
+
+cat >.git/description <<EOF
+$0 test repository
+EOF
+
+GITWEB_CONFIG="$(pwd)/gitweb_config.perl"
+export GITWEB_CONFIG
+
+# run tests
+
+test_external \
+	'test gitweb output' \
+	perl ../t9503/test.pl
+
+test_done
diff --git a/t/t9503/test.pl b/t/t9503/test.pl
new file mode 100755
index 0000000..3d72575
--- /dev/null
+++ b/t/t9503/test.pl
@@ -0,0 +1,128 @@
+#!/usr/bin/perl
+use lib (split(/:/, $ENV{GITPERLLIB}));
+
+use warnings;
+use strict;
+
+use Cwd qw(abs_path);
+use File::Spec;
+
+# We don't count properly when skipping, so no_plan is necessary.
+use Test::More qw(no_plan);
+use Test::WWW::Mechanize::CGI;
+
+my $long_tests = $ENV{GIT_TEST_LONG};
+
+eval { require HTML::Lint };
+my $use_lint = !$@;
+diag('HTML::Lint is not installed; no HTML validation tests')
+    unless $use_lint;
+
+my @revisions = map { substr $_, 0, 10 } split /\s/, `git-rev-list --first-parent HEAD`;
+my $head = $revisions[-1];
+
+my $gitweb = File::Spec->catfile('..','..','gitweb','gitweb.cgi');
+# the followin two lines of code are workaround for bug in
+# Test::WWW::Mechanize::CGI::cgi_application version up to 0.3
+# (http://rt.cpan.org/Ticket/Display.html?id=36654)
+# for pathnames with spaces (because of "trash directory")
+$gitweb = File::Spec->rel2abs($gitweb);
+$gitweb = Cwd::abs_path($gitweb);
+
+my $mech = new Test::WWW::Mechanize::CGI;
+$mech->cgi_application($gitweb);
+# On some systems(?) it's necessary to have %ENV here, otherwise the
+# CGI process won't get *any* of the current environment variables
+# (not even PATH, etc.)
+$mech->env(%ENV, GITWEB_CONFIG => $ENV{'GITWEB_CONFIG'}, $mech->env);
+
+# import config, predeclaring config variables
+our $site_name = '';
+require_ok($ENV{'GITWEB_CONFIG'})
+	or diag('Could not load gitweb config; some tests would fail');
+
+our %checked_pages;
+# Validate and spider the current page, if --long-tests (-l) is given.
+sub check_page {
+	my $uri = $mech->uri;
+	if (not $checked_pages{$uri}) {
+		$mech->html_lint_ok('validate') or return 0 if $long_tests && $use_lint;
+		$mech->page_links_ok("check links on $uri") if $long_tests;
+		$checked_pages{$uri} = 1;
+	}
+	return 1
+}
+
+our $baseurl = "http://localhost";
+our($params, $url, $pagedesc, $status);
+
+# test_page ( <params>, <page_description>, <expected_status> )
+# Example:
+# if (test_page '?p=.git;a=summary', 'repository summary') {
+#     $mech->...;
+#     $mech->...;
+# }
+#
+# Test that the page can be opened (and if --long-tests is given that
+# it validates and has valid links), and return true if it does.  Also
+# set the global variables $params, $pagedesc, and $url for use in the
+# if block.  Optionally pass a third parameter $status to test the
+# HTTP status code of the page (useful for error pages).
+sub test_page {
+	($params, $pagedesc, $status) = @_;
+	$url = "$baseurl$params";
+	if($status) {
+		$mech->get($url);
+	} else {
+		$mech->get_ok($url, "GET \"$params\" -- $pagedesc") or return 0;
+	}
+	check_page or return 0;
+	if($status) {
+		return is($mech->status, $status, "GET \"$params\" -- $pagedesc -- yields $status");
+	} else {
+		return 1;
+	}
+}
+
+if (test_page '', 'project list (implicit)') {
+	$mech->title_like(qr!$site_name!,
+		"title contains $site_name");
+	$mech->content_contains('./t9503-gitweb-Mechanize.sh test repository', 
+		'lists test repository (by description)');
+}
+
+# Test repository summary: implicit, implicit with pathinfo, explicit.
+for my $sumparams ('?p=.git', '/.git', '?p=.git;a=summary') {
+	if (test_page $sumparams, 'repository summary') {
+		$mech->title_like(qr!$site_name.*\.git/summary!,
+				  "title contains $site_name and \".git/summary\"");
+	}
+}
+
+# Search form (on summary page).
+$mech->get_ok('?p=.git', 'get repository summary');
+if ($mech->submit_form_ok( { form_number => 1,
+			     fields => { 's' => 'Initial' }
+			   }, "submit search form (default)")) {
+	check_page;
+	$mech->content_contains('Initial commit',
+				'content contains searched commit');
+}
+
+test_page('?p=non-existent.git', 'non-existent project', 404);
+test_page('?p=.git;a=commit;h=non-existent', 'non-existent commit', 404);
+
+# Summary page.
+
+# Check short log.  To do: Extract into separate test_short_log
+# function since the short log occurs on several pages.
+$mech->get_ok('?p=.git', 'get repository summary');
+for my $revision (@revisions[-3..-1]) {
+	for my $link_text qw( commit commitdiff tree snapshot ) {
+		ok( $mech->find_link(url_abs_regex => qr/h=$revision/, text => $link_text), "$link_text link for $revision" );
+	}
+}
+
+
+1;
+__END__
-- 
1.5.6.32.gad63a.dirty

^ permalink raw reply related

* Re: [PATCH 00/11] Build in merge
From: Junio C Hamano @ 2008-06-20  3:04 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git
In-Reply-To: <cover.1213917600.git.vmiklos@frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> writes:

> Changes since the previous series I sent out to the list:
>
> - get_octopus_merge_bases() now always does a cleanup
>
> - added a new test to make sure git-merge handles more than 25 refs
>
> As usual, comments are welcome. :-)

Thanks.

I take that last line of comment to mean "this is still RFC and not for
inclusion yet" ;-) I think the series is fine up to eighth patch (get
octopus merge base).

I'll queue the whole thing (still strictly as "test merge" basis) to 'pu';
I've fixed 3 "old-style C function definition" issues you have in the
tenth patch (build in merge), and I have some other issues with the ninth
one (filter independent).

^ permalink raw reply

* Re: [PATCH 09/11] Introduce filter_independent() in commit.c
From: Junio C Hamano @ 2008-06-20  3:03 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git
In-Reply-To: <0d95a099ad6e47c60894983ab7bfd94a3aeddce7.1213917600.git.vmiklos@frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> writes:

> This is similar to git-show-branch --independent: It filters out commits
> which are reachable from any other item from the input list.
>
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  commit.c |   16 ++++++++++++++++
>  commit.h |    1 +
>  2 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/commit.c b/commit.c
> index 6052ca3..0dbf4b7 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -705,3 +705,19 @@ int in_merge_bases(struct commit *commit, struct commit **reference, int num)
>  	free_commit_list(bases);
>  	return ret;
>  }
> +
> +struct commit_list *filter_independent(unsigned char *head,
> +	struct commit_list *heads)
> +{
> +	struct commit_list *i, *bases, *ret = NULL;
> +	struct commit_list **pptr = &ret;
> +
> +	commit_list_insert(lookup_commit(head), &heads);
> +
> +	bases = get_octopus_merge_bases(heads);
> +
> +	for (i = heads; i; i = i->next)
> +		if (!(i->item->object.flags & RESULT))
> +			pptr = &commit_list_insert(i->item, pptr)->next;

Hmm.  How well was this function tested?

Because RESULT is an implementation detail of merge_bases(), I do not
think we would want to expose it outside of it.

More worryingly, the flag is supposed to be cleaned from the objects after
get_merge_bases() returns.  I am not sure what you'll learn by looking at
the flag here.

^ permalink raw reply

* Re: [PATCH -resend] Add a helper script to send patches with Mozilla Thunderbird
From: Junio C Hamano @ 2008-06-20  2:58 UTC (permalink / raw)
  To: しらいしななこ
  Cc: Lukas Sandstrm, Git Mailing List
In-Reply-To: <20080620102212.6117@nanako3.lavabit.com>

しらいしななこ  <nanako3@lavabit.com> writes:

> Quoting Junio C Hamano <gitster@pobox.com>:
>
>> Lukas Sandström <lukass@etek.chalmers.se> writes:
>>
>>> The script appp.sh can be used with the External Editor extension for
>>> Mozilla Thunderbird in order to be able to send inline patches in an
>>> easy way.
>>>
>>> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
>>> ---
>>>
>>> Resending. It would be nice if this ended up in contrib/
>>>
>>> /Lukas
>>>
>>>  Documentation/SubmittingPatches          |    5 +++
>>>  contrib/thunderbird-patch-inline/README  |   20 +++++++++++
>>>  contrib/thunderbird-patch-inline/appp.sh |   55 +++++++++++++++++++++++++++
>>
>> A silly question.  What does "appp" stand for?  AppendPatch does not have
>> that many P's in it.
>
> Silly Junio (^_^).  Count them again.

*Blush*  Sorry for the noise.

^ permalink raw reply

* [PATCH 2/3] rebase-i: slight internal improvements
From: Stephan Beyer @ 2008-06-20  2:45 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Christian Couder, Stephan Beyer
In-Reply-To: <1213929935-15093-2-git-send-email-s-beyer@gmx.net>

Add commit_message function to get the commit message
from a commit and other slight internal improvements.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 git-rebase--interactive.sh |   61 +++++++++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 3f926d8..e8ac2ae 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -25,6 +25,7 @@ SQUASH_MSG="$DOTEST"/message-squash
 PRESERVE_MERGES=
 STRATEGY=
 VERBOSE=
+MARK_PREFIX='refs/rebase-marks'
 test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
 test -f "$DOTEST"/verbose && VERBOSE=t
 
@@ -33,7 +34,6 @@ mark the corrected paths with 'git add <paths>', and
 run 'git rebase --continue'"
 export GIT_CHERRY_PICK_HELP
 
-mark_prefix=refs/rebase-marks/
 
 warn () {
 	echo "$*" >&2
@@ -73,13 +73,18 @@ comment_for_reflog () {
 	esac
 }
 
+# Get commit message from commit $1
+commit_message () {
+	git cat-file commit "$1" | sed -e '1,/^$/d'
+}
+
 last_count=
 mark_action_done () {
-	sed -e 1q < "$TODO" >> "$DONE"
-	sed -e 1d < "$TODO" >> "$TODO".new
-	mv -f "$TODO".new "$TODO"
-	count=$(grep -c '^[^#]' < "$DONE")
-	total=$(($count+$(grep -c '^[^#]' < "$TODO")))
+	sed -e 1q "$TODO" >>"$DONE"
+	sed -e 1d "$TODO" >>"$TODO.new"
+	mv -f "$TODO.new" "$TODO"
+	count="$(grep -c '^[^#]' "$DONE")"
+	total="$(expr "$count" + "$(grep -c '^[^#]' "$TODO")")"
 	if test "$last_count" != "$count"
 	then
 		last_count=$count
@@ -88,16 +93,18 @@ mark_action_done () {
 	fi
 }
 
+# Generate message, patch and author script files
 make_patch () {
 	parent_sha1=$(git rev-parse --verify "$1"^) ||
 		die "Cannot get patch for $1^"
 	git diff-tree -p "$parent_sha1".."$1" > "$DOTEST"/patch
 	test -f "$DOTEST"/message ||
-		git cat-file commit "$1" | sed "1,/^$/d" > "$DOTEST"/message
+		commit_message "$1" >"$DOTEST"/message
 	test -f "$DOTEST"/author-script ||
 		get_author_ident_from_commit "$1" > "$DOTEST"/author-script
 }
 
+# Generate a patch and die
 die_with_patch () {
 	make_patch "$1"
 	git rerere
@@ -105,9 +112,9 @@ die_with_patch () {
 }
 
 cleanup_before_quit () {
-	for ref in $(git for-each-ref --format='%(refname)' "${mark_prefix%/}")
+	for ref in $(git for-each-ref --format='%(refname)' "$MARK_PREFIX")
 	do
-		git update-ref -d "$ref" "$ref" || return 1
+		git update-ref -d "$ref" "$ref" || return
 	done
 	rm -rf "$DOTEST"
 }
@@ -118,7 +125,7 @@ die_abort () {
 }
 
 has_action () {
-	grep '^[^#]' "$1" >/dev/null
+	grep -q '^[^#]' "$1"
 }
 
 redo_merge () {
@@ -126,7 +133,7 @@ redo_merge () {
 	shift
 
 	eval "$(get_author_ident_from_commit $rm_sha1)"
-	msg="$(git cat-file commit $rm_sha1 | sed -e '1,/^$/d')"
+	msg="$(commit_message "$rm_sha1")"
 
 	if ! GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" \
 		GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" \
@@ -167,37 +174,39 @@ nth_string () {
 }
 
 make_squash_message () {
-	if test -f "$SQUASH_MSG"; then
-		COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
-			< "$SQUASH_MSG" | sed -ne '$p')+1))
+	if test -f "$SQUASH_MSG"
+	then
+		count="$(($(sed -n -e 's/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p' \
+			"$SQUASH_MSG" | sed -n -e '$p')+1))"
 		echo "# This is a combination of $COUNT commits."
 		sed -e 1d -e '2,/^./{
 			/^$/d
-		}' <"$SQUASH_MSG"
+		}' "$SQUASH_MSG"
 	else
 		COUNT=2
 		echo "# This is a combination of two commits."
 		echo "# The first commit's message is:"
 		echo
-		git cat-file commit HEAD | sed -e '1,/^$/d'
+		commit_message HEAD
 	fi
 	echo
 	echo "# This is the $(nth_string $COUNT) commit message:"
 	echo
-	git cat-file commit $1 | sed -e '1,/^$/d'
+	commit_message "$1"
 }
 
 peek_next_command () {
-	sed -n "1s/ .*$//p" < "$TODO"
+	sed -n -e '1s/ .*$//p' "$TODO"
 }
 
+# If $1 is a mark, make a ref from it; otherwise keep it
 mark_to_ref () {
-	if expr "$1" : "^:[0-9][0-9]*$" >/dev/null
-	then
-		echo "$mark_prefix$(printf %d ${1#:})"
-	else
-		echo "$1"
-	fi
+	arg="$1"
+	ref="$(expr "$arg" : '^:0*\([0-9]\+\)$')"
+	test -n "$ref" &&
+		arg="$MARK_PREFIX/$ref"
+	printf '%s\n' "$arg"
+	unset arg ref
 }
 
 do_next () {
@@ -634,7 +643,7 @@ do
 		UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
 		test -z "$ONTO" && ONTO=$UPSTREAM
 
-		if test ! -z "$2"
+		if test -n "$2"
 		then
 			output git show-ref --verify --quiet "refs/heads/$2" ||
 				die "Invalid branchname: $2"
@@ -674,7 +683,7 @@ do
 				create_extended_todo_list
 		else
 			git rev-list --no-merges --reverse --pretty=oneline \
-				 $common_rev_list_opts | sed -n "s/^>/pick /p"
+				 $common_rev_list_opts | sed -n -e 's/^>/pick /p'
 		fi > "$TODO"
 
 		cat >> "$TODO" << EOF
-- 
1.5.5.1.561.gd8556

^ permalink raw reply related

* [PATCH 3/3] Make rebase--interactive use OPTIONS_SPEC
From: Stephan Beyer @ 2008-06-20  2:45 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Christian Couder, Stephan Beyer
In-Reply-To: <1213929935-15093-3-git-send-email-s-beyer@gmx.net>

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 git-rebase--interactive.sh |   58 ++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index e8ac2ae..aeb9628 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -10,10 +10,25 @@
 # The original idea comes from Eric W. Biederman, in
 # http://article.gmane.org/gmane.comp.version-control.git/22407
 
-USAGE='(--continue | --abort | --skip | [--preserve-merges] [--first-parent]
-	[--preserve-tags] [--verbose] [--onto <branch>] <upstream> [<branch>])'
+OPTIONS_KEEPDASHDASH=
+OPTIONS_SPEC='
+git-rebase -i [options] <upstream> [<branch>]
+git-rebase (--continue | --abort | --skip)
+--
+continue           Continue rebasing process
+abort              Abort rebasing process and restore original branch
+skip               Skip current patch and continue rebasing process
+p,preserve-merges  Try to recreate merges instead of ignoring
+t,preserve-tags    Update tags to the new commit object
+m,merge            Used anyways (no-op)
+i,interactive      Used anyways (no-op)
+onto=              Rebase onto given branch instead of upstream
+v,verbose          Display a diffstat of what changed upstream
+ When preserving merges:
+f,first-parent     Show only commits following the first parent of each commit
+s,strategy=        Use the given merge strategy
+'
 
-OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
 
@@ -25,6 +40,7 @@ SQUASH_MSG="$DOTEST"/message-squash
 PRESERVE_MERGES=
 STRATEGY=
 VERBOSE=
+ONTO=
 MARK_PREFIX='refs/rebase-marks'
 test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
 test -f "$DOTEST"/verbose && VERBOSE=t
@@ -584,7 +600,7 @@ do
 
 		output git reset --hard && do_rest
 		;;
-	-s|--strategy)
+	-s)
 		case "$#,$1" in
 		*,*=*)
 			STRATEGY="-s "$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
@@ -595,32 +611,36 @@ do
 			shift ;;
 		esac
 		;;
-	-m|--merge)
+	-m)
 		# we use merge anyway
 		;;
-	-C*)
-		die "Interactive rebase uses merge, so $1 does not make sense"
-		;;
-	-v|--verbose)
+	-v)
 		VERBOSE=t
 		;;
-	-p|--preserve-merges)
+	-p)
 		PRESERVE_MERGES=t
 		;;
-	-f|--first-parent)
+	-f)
 		FIRST_PARENT=t
 		PRESERVE_MERGES=t
 		;;
-	-t|--preserve-tags)
+	-t)
 		PRESERVE_TAGS=t
 		;;
-	-i|--interactive)
+	-i)
 		# yeah, we know
 		;;
+	--onto)
+		shift
+		ONTO=$(git rev-parse --verify "$1") ||
+			die "Does not point to a valid commit: $1"
+		;;
 	''|-h)
 		usage
 		;;
-	*)
+	--)
+		shift
+		test $# -eq 1 -o $# -eq 2 || usage
 		test -d "$DOTEST" &&
 			die "Interactive rebase already started"
 
@@ -629,15 +649,6 @@ do
 
 		comment_for_reflog start
 
-		ONTO=
-		case "$1" in
-		--onto)
-			ONTO=$(git rev-parse --verify "$2") ||
-				die "Does not point to a valid commit: $2"
-			shift; shift
-			;;
-		esac
-
 		require_clean_work_tree
 
 		UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
@@ -720,6 +731,7 @@ EOF
 			die_abort "Nothing to do"
 
 		output git checkout $ONTO && do_rest
+		exit 0
 		;;
 	esac
 	shift
-- 
1.5.5.1.561.gd8556

^ permalink raw reply related

* some small changes for rebase-i
From: Stephan Beyer @ 2008-06-20  2:45 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Christian Couder

Hi,

the following small patchset can be applied to "pu" (i.e. to
js/rebase-i-sequencer, which has been in "next" before it
has been rewound.)

The first adds some tests that seemed useful to me during early
sequencer prototype development,
the second is just one for the look and
the third makes rebase-i use OPTIONS_SPEC.

Regards,
  Stephan

^ permalink raw reply

* [PATCH 1/3] t3404: slight improvements
From: Stephan Beyer @ 2008-06-20  2:45 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Christian Couder, Stephan Beyer
In-Reply-To: <1213929935-15093-1-git-send-email-s-beyer@gmx.net>

This patch adds some extra checks into some
test cases and changes "! git ..." into
"test_must_fail git".

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 t/t3404-rebase-interactive.sh |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index e6f3fad..daba5fd 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -107,7 +107,8 @@ chmod a+x fake-editor.sh
 
 test_expect_success 'no changes are a nop' '
 	git rebase -i F &&
-	test $(git rev-parse I) = $(git rev-parse HEAD)
+	test $(git rev-parse I) = $(git rev-parse HEAD) &&
+	test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2"
 '
 
 test_expect_success 'test the [branch] option' '
@@ -115,7 +116,9 @@ test_expect_success 'test the [branch] option' '
 	git rm file6 &&
 	git commit -m "stop here" &&
 	git rebase -i F branch2 &&
-	test $(git rev-parse I) = $(git rev-parse HEAD)
+	test $(git rev-parse I) = $(git rev-parse branch2) &&
+	test $(git rev-parse I) = $(git rev-parse HEAD) &&
+	test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2"
 '
 
 test_expect_success 'rebase on top of a non-conflicting commit' '
@@ -123,7 +126,9 @@ test_expect_success 'rebase on top of a non-conflicting commit' '
 	git tag original-branch1 &&
 	git rebase -i branch2 &&
 	test file6 = $(git diff --name-only original-branch1) &&
-	test $(git rev-parse I) = $(git rev-parse HEAD~2)
+	test $(git rev-parse I) = $(git rev-parse branch2) &&
+	test $(git rev-parse I) = $(git rev-parse HEAD~2) &&
+	test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1"
 '
 
 test_expect_success 'reflog for the branch shows state before rebase' '
@@ -155,9 +160,12 @@ EOF
 
 test_expect_success 'stop on conflicting pick' '
 	git tag new-branch1 &&
-	! git rebase -i master &&
+	test_must_fail git rebase -i master &&
+	test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" &&
 	test_cmp expect .git/.dotest-merge/patch &&
 	test_cmp expect2 file1 &&
+	test "$(git-diff --name-status |
+		sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
 	test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
 	test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
 '
@@ -165,6 +173,7 @@ test_expect_success 'stop on conflicting pick' '
 test_expect_success 'abort' '
 	git rebase --abort &&
 	test $(git rev-parse new-branch1) = $(git rev-parse HEAD) &&
+	test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
 	! test -d .git/.dotest-merge
 '
 
@@ -331,7 +340,7 @@ test_expect_success 'interactive -t preserves tags' '
 test_expect_success '--continue tries to commit' '
 	git checkout to-be-rebased &&
 	test_tick &&
-	! git rebase -i --onto new-branch1 HEAD^ &&
+	test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
 	echo resolved > file1 &&
 	git add file1 &&
 	FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue &&
@@ -342,7 +351,7 @@ test_expect_success '--continue tries to commit' '
 test_expect_success 'verbose flag is heeded, even after --continue' '
 	git reset --hard HEAD@{1} &&
 	test_tick &&
-	! git rebase -v -i --onto new-branch1 HEAD^ &&
+	test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
 	echo resolved > file1 &&
 	git add file1 &&
 	git rebase --continue > output &&
@@ -380,7 +389,7 @@ test_expect_success 'interrupted squash works as expected' '
 	! FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
 	(echo one; echo two; echo four) > conflict &&
 	git add conflict &&
-	! git rebase --continue &&
+	test_must_fail git rebase --continue &&
 	echo resolved > conflict &&
 	git add conflict &&
 	git rebase --continue &&
@@ -398,10 +407,10 @@ test_expect_success 'interrupted squash works as expected (case 2)' '
 	! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
 	(echo one; echo four) > conflict &&
 	git add conflict &&
-	! git rebase --continue &&
+	test_must_fail git rebase --continue &&
 	(echo one; echo two; echo four) > conflict &&
 	git add conflict &&
-	! git rebase --continue &&
+	test_must_fail git rebase --continue &&
 	echo resolved > conflict &&
 	git add conflict &&
 	git rebase --continue &&
@@ -449,7 +458,7 @@ test_expect_success 'rebase a commit violating pre-commit' '
 	chmod a+x $PRE_COMMIT &&
 	echo "monde! " >> file1 &&
 	test_tick &&
-	! git commit -m doesnt-verify file1 &&
+	test_must_fail git commit -m doesnt-verify file1 &&
 	git commit -m doesnt-verify --no-verify file1 &&
 	test_tick &&
 	FAKE_LINES=2 git rebase -i HEAD~2
-- 
1.5.5.1.561.gd8556

^ permalink raw reply related

* [PATCH] gitweb: respect $GITPERLLIB
From: Lea Wiemann @ 2008-06-20  2:31 UTC (permalink / raw)
  To: git; +Cc: Lea Wiemann

gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
commands.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Junio C Hamano wrote in <http://mid.gmane.org/7vfxrwa008.fsf@gitster.siamese.dyndns.org>:
> The real fix to the issue [is] to fix the build
> procedure of gitweb/gitweb.perl so that the above script rewriting is also
> applied to it.

I've now implemented this, since it's becoming necessary for the
Mechanize tests.  However, I'm not totally confident that what I wrote
is (a) correct and (b) a good idea -- I simply copy-and-pasted from
the previous Makefile entry, since I'm not very proficient with sed.

Comments appreciated!

-- Lea

 Makefile |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index b003e3e..c5c6ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -1081,7 +1081,14 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
+	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-- 
1.5.6.31.gcbcff.dirty

^ permalink raw reply related

* Re: [PATCH -resend] Add a helper script to send patches with Mozilla Thunderbird
From: しらいしななこ @ 2008-06-20  1:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Lukas Sandstrm, Git Mailing List
In-Reply-To: <7vmylhq6lb.fsf@gitster.siamese.dyndns.org>

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

> Lukas Sandström <lukass@etek.chalmers.se> writes:
>
>> The script appp.sh can be used with the External Editor extension for
>> Mozilla Thunderbird in order to be able to send inline patches in an
>> easy way.
>>
>> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
>> ---
>>
>> Resending. It would be nice if this ended up in contrib/
>>
>> /Lukas
>>
>>  Documentation/SubmittingPatches          |    5 +++
>>  contrib/thunderbird-patch-inline/README  |   20 +++++++++++
>>  contrib/thunderbird-patch-inline/appp.sh |   55 +++++++++++++++++++++++++++
>
> A silly question.  What does "appp" stand for?  AppendPatch does not have
> that many P's in it.

Silly Junio (^_^).  Count them again.

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

^ permalink raw reply

* Re: [PATCH] git-push: add a --delete flag to allow branch deletion
From: Junio C Hamano @ 2008-06-20  0:51 UTC (permalink / raw)
  To: Pieter de Bie; +Cc: Git Mailinglist
In-Reply-To: <1213884787-24692-1-git-send-email-pdebie@ai.rug.nl>

Pieter de Bie <pdebie@ai.rug.nl> writes:

> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
> index 89e0049..6a772a5 100644
> --- a/Documentation/git-push.txt
> +++ b/Documentation/git-push.txt
> @@ -11,6 +11,8 @@ SYNOPSIS
>  [verse]
>  'git-push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
>             [--repo=all] [-f | --force] [-v | --verbose] [<repository> <refspec>...]
> +'git push' --delete <repository> <branchname> [<branch2> ...]
> +
>  
>  DESCRIPTION
>  -----------
> @@ -18,6 +20,8 @@ DESCRIPTION
>  Updates remote refs using local refs, while sending objects
>  necessary to complete the given refs.
>  
> +In the second form, deletes one or more branches on a given repository.
> +

Is this really about branches?  Is it usable to somehow delete tags, and
if so how?

What happens if you have a branch 'foo' and a tag 'foo' in the remote
repository and you say "git push --delete $there foo"?

> @@ -125,6 +146,18 @@ int cmd_push(int argc, const char **argv, const char *prefix)
>  
>  	argc = parse_options(argc, argv, options, push_usage, 0);
>  
> +	if (delete) {
> +		if (all || mirror || tags || force || repo)
> +			die("--delete cannot be used with --all, --mirror, --tags, --farce or --repo");

Nice try, but it is not so amusing.

^ permalink raw reply

* Re: [PATCH v3] gitweb: standarize HTTP status codes
From: Junio C Hamano @ 2008-06-20  0:48 UTC (permalink / raw)
  To: Lea Wiemann; +Cc: git, Jakub Narebski
In-Reply-To: <1213905801-2811-1-git-send-email-LeWiemann@gmail.com>

Thanks.  This will be part of 'next' as of tonight.

^ permalink raw reply

* Re: [PATCH -resend] Add a helper script to send patches with Mozilla Thunderbird
From: Junio C Hamano @ 2008-06-20  0:43 UTC (permalink / raw)
  To: Lukas Sandström; +Cc: Git Mailing List
In-Reply-To: <485AE9FD.8050508@etek.chalmers.se>

Lukas Sandström <lukass@etek.chalmers.se> writes:

> The script appp.sh can be used with the External Editor extension for
> Mozilla Thunderbird in order to be able to send inline patches in an
> easy way.
>
> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
> ---
>
> Resending. It would be nice if this ended up in contrib/
>
> /Lukas
>
>  Documentation/SubmittingPatches          |    5 +++
>  contrib/thunderbird-patch-inline/README  |   20 +++++++++++
>  contrib/thunderbird-patch-inline/appp.sh |   55 +++++++++++++++++++++++++++

A silly question.  What does "appp" stand for?  AppendPatch does not have
that many P's in it.

> diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh
> new file mode 100755
> index 0000000..cc518f3
> --- /dev/null
> +++ b/contrib/thunderbird-patch-inline/appp.sh
> @@ -0,0 +1,55 @@
> +#!/bin/bash
> +# Copyright 2008 Lukas Sandström <luksan@gmail.com>
> +#
> +# AppendPatch - A script to be used together with ExternalEditor
> +# for Mozilla Thunderbird to properly include pathes inline i e-mails.
> ...

Eh, pathes?

^ permalink raw reply

* Re: [BUG] git-gui loose object warning every hour
From: Michael Gebetsroither @ 2008-06-20  0:40 UTC (permalink / raw)
  To: git
In-Reply-To: <20080620003216.GR11793@spearce.org>

* Shawn O. Pearce <spearce@spearce.org> wrote:
> Michael Gebetsroither <gebi@sbox.tugraz.at> wrote:

>> The loose object warning from git-gui poped up 3 times in the last 4
>> hours (i've gc'ed the repo every time).
>
> This isn't a per-hour warning.  What's happening is there are loose
> objects which git-gc has not pruned away.  Try running git-prune in
> the repository to decrease the loose object count.

I've clicked yes (to remove the loose objects) on every popup of the
loose object warning dialog.

>> I've already set gc.auto=0 so i do _NOT_ want git to do anything
>> automatically.
>
> Hmm.  Maybe git-gui should look at this flag on startup and if set
> simply not perform the loose object count check.

That would be nice, yes.

cu,
michael
-- 
It's already too late!

^ permalink raw reply

* Re: [BUG] git-gui loose object warning every hour
From: Shawn O. Pearce @ 2008-06-20  0:32 UTC (permalink / raw)
  To: Michael Gebetsroither; +Cc: git
In-Reply-To: <g3et71$j8k$1@ger.gmane.org>

Michael Gebetsroither <gebi@sbox.tugraz.at> wrote:
> New git-gui does not honor gc.auto=0 setting for his loose object
> warning.
> 
> The loose object warning from git-gui poped up 3 times in the last 4
> hours (i've gc'ed the repo every time).

This isn't a per-hour warning.  What's happening is there are loose
objects which git-gc has not pruned away.  Try running git-prune in
the repository to decrease the loose object count.

> I've already set gc.auto=0 so i do _NOT_ want git to do anything
> automatically.

Hmm.  Maybe git-gui should look at this flag on startup and if set
simply not perform the loose object count check.

> On every new git release there are new automatism that i've to disable.
> Is there a way to just disable all this automatism in all git tools
> globaly?

No.

-- 
Shawn.

^ permalink raw reply

* [BUG] git-gui loose object warning every hour
From: Michael Gebetsroither @ 2008-06-20  0:21 UTC (permalink / raw)
  To: git

hi,

New git-gui does not honor gc.auto=0 setting for his loose object
warning.

The loose object warning from git-gui poped up 3 times in the last 4
hours (i've gc'ed the repo every time).

I've already set gc.auto=0 so i do _NOT_ want git to do anything
automatically.

On every new git release there are new automatism that i've to disable.
Is there a way to just disable all this automatism in all git tools
globaly?

cu,
michael
-- 
It's already too late!

^ permalink raw reply

* Re: [PATCH 2/2 v5] Git.pm: add test suite
From: Junio C Hamano @ 2008-06-19 23:55 UTC (permalink / raw)
  To: Lea Wiemann; +Cc: git, Jakub Narebski
In-Reply-To: <1213907569-6393-1-git-send-email-LeWiemann@gmail.com>

Thanks.

These two Perl-ish test patches will be part of 'next' tonight.

When sending further improvements, if necessary, please make them relative
to the copy there.

^ permalink raw reply

* git svn --use-log-author misbehavior?
From: Mircea Bardac @ 2008-06-19 23:51 UTC (permalink / raw)
  To: Git Mailing List

Hi,

According to the documentation, this parameter (--use-log-author) should 
  use the author from the From/Signed-off-by line. Unfortunately, I 
found this to be working only on the first git svn clone. Later rebasing 
made the commits use the old username@uuid format.

I am assuming the option is not being preserved in the Git repository 
metadata and it is only used on cloning/init. Is this the intended 
behavior?

Many thanks.

-- 
Mircea
http://mircea.bardac.net

^ permalink raw reply

* Re: [PATCH] Documentation: Simplify git-rev-parse's example
From: Junio C Hamano @ 2008-06-19 23:28 UTC (permalink / raw)
  To: Pieter de Bie; +Cc: Jon Loeliger, Git Mailinglist
In-Reply-To: <D6812FD2-F61D-4813-95B4-4FCCDE35C418@ai.rug.nl>

Pieter de Bie <pdebie@ai.rug.nl> writes:

> On 19 jun 2008, at 21:33, Junio C Hamano wrote:
>
>>> How is this a vast improvement?
>>>
>>> I could see that inverting it top-to-bottom would
>>> be more consistent with gitk or show-branch output.
>>> Your example doesn't have a 3-parent commit, though,
>>> and it isn't _that_ much simpler otherwise...
>>>
>>> So this is really better _how_?
>>>
>>> Oh, right, of course.  It removes my name.  Got it. :-)
>>
>> I agree that the patch should have just flipped the tree upside down
>> without changing the shape of the history the section talks about.
>
> I tried to make it less of a monster while still keeping examples of
> all possibilities, which is why I removed two of the nodes.

I do not care _that_ deeply myself, but judging from how often the word
Octopus comes up on this list (even though I do not think we would want to
especially encourage the practice), I think it is a disservice to drop an
octopus from the section that teaches how to name a commit in an ancestry
graph.

^ permalink raw reply

* Re: [PATCH] Add option to git-branch to set up automatic rebasing
From: Junio C Hamano @ 2008-06-19 23:24 UTC (permalink / raw)
  To: Pieter de Bie; +Cc: Björn Steinbrink, Johannes Schindelin, Git Mailinglist
In-Reply-To: <12AB50C8-6CBF-4D96-8FAB-90234A9006D0@ai.rug.nl>

Pieter de Bie <pdebie@ai.rug.nl> writes:

> That's why I suggested --auto-rebase, which is more verbose in what
> it does. Perhaps we should add it as an optional flag for --track, like
>
>   git branch --track --auto-rebase local remote/branch
>
> ? That is a bit long though.

That does not make _any_ sense unless you also have --auto-merge.  And
which part of rebasing is auto anyway?  "git checkout local" won't rebase
onto remote/branch for one thing.

> I don't think "--track=rebase" makes a lot of sense, since "track" is
> still a boolean in my head ;)

Well, track _is_ boolean.  You usually build and develop yourself, but if
you are following somebody else, you say "this is not really a pure
development but is used to trail somebody else (aka "track mode ON"), and
the way for this branch to follow that somebody else specifically is to
merge from it or rebase on top of it (aka "how it tracks")".

^ permalink raw reply

* [PATCH 01/11] Move split_cmdline() to alias.c
From: Miklos Vajna @ 2008-06-19 23:22 UTC (permalink / raw)
  To: git
In-Reply-To: <cover.1213917600.git.vmiklos@frugalware.org>

split_cmdline() is currently used for aliases only, but later it can be
useful for other builtins as well. Move it to alias.c for now,
indicating that originally it's for aliases, but we'll have it in libgit
this way.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 alias.c |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cache.h |    1 +
 git.c   |   53 -----------------------------------------------------
 3 files changed, 55 insertions(+), 53 deletions(-)

diff --git a/alias.c b/alias.c
index 995f3e6..ccb1108 100644
--- a/alias.c
+++ b/alias.c
@@ -21,3 +21,57 @@ char *alias_lookup(const char *alias)
 	git_config(alias_lookup_cb, NULL);
 	return alias_val;
 }
+
+int split_cmdline(char *cmdline, const char ***argv)
+{
+	int src, dst, count = 0, size = 16;
+	char quoted = 0;
+
+	*argv = xmalloc(sizeof(char*) * size);
+
+	/* split alias_string */
+	(*argv)[count++] = cmdline;
+	for (src = dst = 0; cmdline[src];) {
+		char c = cmdline[src];
+		if (!quoted && isspace(c)) {
+			cmdline[dst++] = 0;
+			while (cmdline[++src]
+					&& isspace(cmdline[src]))
+				; /* skip */
+			if (count >= size) {
+				size += 16;
+				*argv = xrealloc(*argv, sizeof(char*) * size);
+			}
+			(*argv)[count++] = cmdline + dst;
+		} else if (!quoted && (c == '\'' || c == '"')) {
+			quoted = c;
+			src++;
+		} else if (c == quoted) {
+			quoted = 0;
+			src++;
+		} else {
+			if (c == '\\' && quoted != '\'') {
+				src++;
+				c = cmdline[src];
+				if (!c) {
+					free(*argv);
+					*argv = NULL;
+					return error("cmdline ends with \\");
+				}
+			}
+			cmdline[dst++] = c;
+			src++;
+		}
+	}
+
+	cmdline[dst] = 0;
+
+	if (quoted) {
+		free(*argv);
+		*argv = NULL;
+		return error("unclosed quote");
+	}
+
+	return count;
+}
+
diff --git a/cache.h b/cache.h
index 81b7e17..26b2cad 100644
--- a/cache.h
+++ b/cache.h
@@ -827,5 +827,6 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
 void overlay_tree_on_cache(const char *tree_name, const char *prefix);
 
 char *alias_lookup(const char *alias);
+int split_cmdline(char *cmdline, const char ***argv);
 
 #endif /* CACHE_H */
diff --git a/git.c b/git.c
index 59f0fcc..2fbe96b 100644
--- a/git.c
+++ b/git.c
@@ -90,59 +90,6 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
 	return handled;
 }
 
-static int split_cmdline(char *cmdline, const char ***argv)
-{
-	int src, dst, count = 0, size = 16;
-	char quoted = 0;
-
-	*argv = xmalloc(sizeof(char*) * size);
-
-	/* split alias_string */
-	(*argv)[count++] = cmdline;
-	for (src = dst = 0; cmdline[src];) {
-		char c = cmdline[src];
-		if (!quoted && isspace(c)) {
-			cmdline[dst++] = 0;
-			while (cmdline[++src]
-					&& isspace(cmdline[src]))
-				; /* skip */
-			if (count >= size) {
-				size += 16;
-				*argv = xrealloc(*argv, sizeof(char*) * size);
-			}
-			(*argv)[count++] = cmdline + dst;
-		} else if(!quoted && (c == '\'' || c == '"')) {
-			quoted = c;
-			src++;
-		} else if (c == quoted) {
-			quoted = 0;
-			src++;
-		} else {
-			if (c == '\\' && quoted != '\'') {
-				src++;
-				c = cmdline[src];
-				if (!c) {
-					free(*argv);
-					*argv = NULL;
-					return error("cmdline ends with \\");
-				}
-			}
-			cmdline[dst++] = c;
-			src++;
-		}
-	}
-
-	cmdline[dst] = 0;
-
-	if (quoted) {
-		free(*argv);
-		*argv = NULL;
-		return error("unclosed quote");
-	}
-
-	return count;
-}
-
 static int handle_alias(int *argcp, const char ***argv)
 {
 	int envchanged = 0, ret = 0, saved_errno = errno;
-- 
1.5.6

^ 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