Git development
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into  submodules
From: Lars Hjemli @ 2009-01-18 22:46 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0901182244310.3586@pacific.mpi-cbg.de>

On Sun, Jan 18, 2009 at 22:55, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Sun, 18 Jan 2009, Lars Hjemli wrote:
>
>> So, would you rather have something like `git archive --submodules=foo
>> --submodules=bar HEAD` to explicitly tell which submodule paths to
>> include in the archive when executed in a bare repo?
>
> That does not quite say what you tried to do, does it?  You tried to
> traverse submodules whose commit can be found in the object database.
>
> Setting aside the fact that we usually try to avoid accessing unreachable
> objects, which your handling does not do, our "git submodule" does not do
> that either; it only handles submodules that are checked out.
>
> Now, this behavior might be wanted, in bare as well as in non-bare
> repositories, but I think it should be triggered by an option, such as
> "--submodules=look-in-superprojects-odb".

Sorry, but if your concern is whether to traverse a submodule in a
bare repo when the submodule isn't checked out (yeah, contradiction in
terms), I just don't see the point.

For non-bare repositories the policy has always been to ignore
submodules which isn't checked out, but for bare repositories there is
no obvious way (for me, at least) to apply the same policy. Therefore
I proposed to traverse all submodules where the linked commit is
reachable, but as you pointed out this would be wrong for non-bare
repositories.

I then modified my proposal to include a check on
is_bare_repository(): If we're not in a bare repository,
read_tree_recursive() is only allowed to recurse into checked out
submodules. But if we're in a bare repository, read_tree_recursive()
is allowed to recurse into any submodule with a reachable commit.

Now then, if `--submodules=look-in-superprojects-odb` should be
required to trigger the latter behavior, running `git archive
--submodules HEAD` in a bare repository would always produce identical
output as `git archive HEAD` and this is why I don't understand the
gain of 'look-in-superprojects-odb' (I thought you wanted to limit
which of the reachable submodules to recurse into).

--
larsh

^ permalink raw reply

* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Sverre Rabbelier @ 2009-01-19  0:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, Ray Chuan, git
In-Reply-To: <7vvdscthmq.fsf@gitster.siamese.dyndns.org>

On Sun, Jan 18, 2009 at 22:43, Junio C Hamano <gitster@pobox.com> wrote:
> If "slow" is a problem, why are you using http to begin with ;-)?

Because http might be the only available protocol?

> I'd take slow but reliable any day over fast and mostly works but
> unreliable.

Yes, but if we want, say, git support at code.google.com (which I do,
I totally detest having to use svn because of this), it would be nice
to not dismiss http as "being slow anyway, so who cares about not
making it faster"?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* [PATCH v2] contrib: add 'git-difftool' for launching common diff tools
From: David Aguilar @ 2009-01-19  0:25 UTC (permalink / raw)
  To: git; +Cc: gitster, markus.heidelberg, David Aguilar
In-Reply-To: <200901182025.24045.markus.heidelberg@web.de>

'git-difftool' is a git command that allows you to compare and edit files
between revisions using common merge tools.  'git-difftool' does what
'git-mergetool' does but its use is for non-merge situations such as
when preparing commits or comparing changes against the index.
It uses the same configuration variables as 'git-mergetool' and
provides the same command-line interface as 'git-diff'.

Signed-off-by: David Aguilar <davvid@gmail.com>
---

This newer version addresses the feedback from Markus Heidelberg.
difftool is now more consistent with mergetool and it includes
Markus's vimdiff enhancements for positioning the cursor at startup.

 contrib/difftool/git-difftool        |   73 ++++++++++
 contrib/difftool/git-difftool-helper |  244 ++++++++++++++++++++++++++++++++++
 contrib/difftool/git-difftool.txt    |  104 ++++++++++++++
 3 files changed, 421 insertions(+), 0 deletions(-)
 create mode 100755 contrib/difftool/git-difftool
 create mode 100755 contrib/difftool/git-difftool-helper
 create mode 100644 contrib/difftool/git-difftool.txt

diff --git a/contrib/difftool/git-difftool b/contrib/difftool/git-difftool
new file mode 100755
index 0000000..0cda3d2
--- /dev/null
+++ b/contrib/difftool/git-difftool
@@ -0,0 +1,73 @@
+#!/usr/bin/env perl
+# Copyright (c) 2009 David Aguilar
+#
+# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
+# git-difftool-helper script.  This script exports
+# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
+# GIT_DIFFTOOL_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
+# Any arguments that are unknown to this script are forwarded to 'git diff'.
+
+use strict;
+use warnings;
+use Cwd qw(abs_path);
+use File::Basename qw(dirname);
+
+my $DIR = abs_path(dirname($0));
+
+
+sub usage
+{
+	print << 'USAGE';
+usage: git difftool [--tool=<tool>] [--no-prompt] ["git diff" options]
+USAGE
+	exit 1;
+}
+
+sub setup_environment
+{
+	$ENV{PATH} = "$DIR:$ENV{PATH}";
+	$ENV{GIT_PAGER} = '';
+	$ENV{GIT_EXTERNAL_DIFF} = 'git-difftool-helper';
+}
+
+sub exe
+{
+	my $exe = shift;
+	return defined $ENV{COMSPEC} ? "$exe.exe" : $exe;
+}
+
+sub generate_command
+{
+	my @command = (exe('git'), 'diff');
+	my $skip_next = 0;
+	my $idx = -1;
+	for my $arg (@ARGV) {
+		$idx++;
+		if ($skip_next) {
+			$skip_next = 0;
+			next;
+		}
+		if ($arg eq '-t' or $arg eq '--tool') {
+			usage() if $#ARGV <= $idx;
+			$ENV{GIT_MERGE_TOOL} = $ARGV[$idx + 1];
+			$skip_next = 1;
+			next;
+		}
+		if ($arg =~ /^--tool=/) {
+			$ENV{GIT_MERGE_TOOL} = substr($arg, 7);
+			next;
+		}
+		if ($arg eq '--no-prompt') {
+			$ENV{GIT_DIFFTOOL_NO_PROMPT} = 'true';
+			next;
+		}
+		if ($arg eq '-h' or $arg eq '--help') {
+			usage();
+		}
+		push @command, $arg;
+	}
+	return @command
+}
+
+setup_environment();
+exec(generate_command());
diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
new file mode 100755
index 0000000..a6f862f
--- /dev/null
+++ b/contrib/difftool/git-difftool-helper
@@ -0,0 +1,244 @@
+#!/bin/sh
+# git-difftool-helper is a GIT_EXTERNAL_DIFF-compatible diff tool launcher.
+# It supports kdiff3, tkdiff, xxdiff, meld, opendiff, emerge, ecmerge,
+# vimdiff, gvimdiff, and custom user-configurable tools.
+# This script is typically launched by using the 'git difftool'
+# convenience command.
+#
+# Copyright (c) 2009 David Aguilar
+
+# Set GIT_DIFFTOOL_NO_PROMPT to bypass the per-file prompt.
+should_prompt () {
+	! test -n "$GIT_DIFFTOOL_NO_PROMPT"
+}
+
+# Should we keep the backup .orig file?
+keep_backup_mode="$(git config --bool merge.keepBackup || echo true)"
+keep_backup () {
+	test "$keep_backup_mode" = "true"
+}
+
+# This function manages the backup .orig file.
+# A backup $MERGED.orig file is created if changes are detected.
+cleanup_temp_files () {
+	if test -n "$MERGED"; then
+		if keep_backup && test "$MERGED" -nt "$BACKUP"; then
+			test -f "$BACKUP" && mv -- "$BACKUP" "$MERGED.orig"
+		else
+			rm -f -- "$BACKUP"
+		fi
+	fi
+}
+
+# This is called when users Ctrl-C out of git-difftool-helper
+sigint_handler () {
+	echo
+	cleanup_temp_files
+	exit 1
+}
+
+# This function prepares temporary files and launches the appropriate
+# merge tool.
+launch_merge_tool () {
+	# Merged is the filename as it appears in the work tree
+	# Local is the contents of a/filename
+	# Remote is the contents of b/filename
+	# Custom merge tool commands might use $BASE so we provide it
+	MERGED="$1"
+	LOCAL="$2"
+	REMOTE="$3"
+	BASE="$1"
+	ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
+	BACKUP="$MERGED.BACKUP.$ext"
+
+	# Create and ensure that we clean up $BACKUP
+	test -f "$MERGED" && cp -- "$MERGED" "$BACKUP"
+	trap sigint_handler SIGINT
+
+	# $LOCAL and $REMOTE are temporary files so prompt
+	# the user with the real $MERGED name before launching $merge_tool.
+	if should_prompt; then
+		printf "\nViewing: '$MERGED'\n"
+		printf "Hit return to launch '%s': " "$merge_tool"
+		read ans
+	fi
+
+	# Run the appropriate merge tool command
+	case "$merge_tool" in
+	kdiff3)
+		basename=$(basename "$MERGED")
+		"$merge_tool_path" --auto \
+			--L1 "$basename (A)" \
+			--L2 "$basename (B)" \
+			-o "$MERGED" "$LOCAL" "$REMOTE" \
+			> /dev/null 2>&1
+		;;
+
+	tkdiff)
+		"$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
+		;;
+
+	meld)
+		"$merge_tool_path" "$LOCAL" "$REMOTE"
+		;;
+
+	vimdiff)
+		"$merge_tool_path" -c "wincmd r" "$LOCAL" "$REMOTE"
+		;;
+
+	gvimdiff)
+		"$merge_tool_path" -c "wincmd r" -f "$LOCAL" "$REMOTE"
+		;;
+
+	xxdiff)
+		"$merge_tool_path" \
+			-X \
+			-R 'Accel.SaveAsMerged: "Ctrl-S"' \
+			-R 'Accel.Search: "Ctrl+F"' \
+			-R 'Accel.SearchForward: "Ctrl-G"' \
+			--merged-file "$MERGED" \
+			"$LOCAL" "$REMOTE"
+		;;
+
+	opendiff)
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			-merge "$MERGED" | cat
+		;;
+
+	ecmerge)
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			--default --mode=merge2 --to="$MERGED"
+		;;
+
+	emerge)
+		"$merge_tool_path" -f emerge-files-command \
+			"$LOCAL" "$REMOTE" "$(basename "$MERGED")"
+		;;
+
+	*)
+		if test -n "$merge_tool_cmd"; then
+			( eval $merge_tool_cmd )
+		fi
+		;;
+	esac
+
+	cleanup_temp_files
+}
+
+# Verifies that mergetool.<tool>.cmd exists
+valid_custom_tool() {
+	merge_tool_cmd="$(git config mergetool.$1.cmd)"
+	test -n "$merge_tool_cmd"
+}
+
+# Verifies that the chosen merge tool is properly setup.
+# Built-in merge tools are always valid.
+valid_tool() {
+	case "$1" in
+	kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge)
+		;; # happy
+	*)
+		if ! valid_custom_tool "$1"
+		then
+			return 1
+		fi
+		;;
+	esac
+}
+
+# Sets up the merge_tool_path variable.
+# This handles the mergetool.<tool>.path configuration.
+init_merge_tool_path() {
+	merge_tool_path=$(git config mergetool."$1".path)
+	if test -z "$merge_tool_path"; then
+		case "$1" in
+		emerge)
+			merge_tool_path=emacs
+			;;
+		*)
+			merge_tool_path="$1"
+			;;
+		esac
+	fi
+}
+
+# Allow the GIT_MERGE_TOOL variable to provide a default value
+test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
+
+# If not merge tool was specified then use the merge.tool
+# configuration variable.  If that's invalid then reset merge_tool.
+if test -z "$merge_tool"; then
+	merge_tool=$(git config merge.tool)
+	if test -n "$merge_tool" && ! valid_tool "$merge_tool"; then
+		echo >&2 "git config option merge.tool set to unknown tool: $merge_tool"
+		echo >&2 "Resetting to default..."
+		unset merge_tool
+	fi
+fi
+
+# Try to guess an appropriate merge tool if no tool has been set.
+if test -z "$merge_tool"; then
+
+	# We have a $DISPLAY so try some common UNIX merge tools
+	if test -n "$DISPLAY"; then
+		merge_tool_candidates="kdiff3 tkdiff xxdiff meld gvimdiff"
+		# If gnome then prefer meld
+		if test -n "$GNOME_DESKTOP_SESSION_ID"; then
+			merge_tool_candidates="meld $merge_tool_candidates"
+		fi
+		# If KDE then prefer kdiff3
+		if test "$KDE_FULL_SESSION" = "true"; then
+			merge_tool_candidates="kdiff3 $merge_tool_candidates"
+		fi
+	fi
+
+	# $EDITOR is emacs so add emerge as a candidate
+	if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
+		merge_tool_candidates="$merge_tool_candidates emerge"
+	fi
+
+	# $EDITOR is vim so add vimdiff as a candidate
+	if echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
+		merge_tool_candidates="$merge_tool_candidates vimdiff"
+	fi
+
+	merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
+	echo "merge tool candidates: $merge_tool_candidates"
+
+	# Loop over each candidate and stop when a valid merge tool is found.
+	for i in $merge_tool_candidates
+	do
+		init_merge_tool_path $i
+		if type "$merge_tool_path" > /dev/null 2>&1; then
+			merge_tool=$i
+			break
+		fi
+	done
+
+	if test -z "$merge_tool" ; then
+		echo "No known merge resolution program available."
+		exit 1
+	fi
+
+else
+	# A merge tool has been set, so verify that it's valid.
+	if ! valid_tool "$merge_tool"; then
+		echo >&2 "Unknown merge tool $merge_tool"
+		exit 1
+	fi
+
+	init_merge_tool_path "$merge_tool"
+
+	if test -z "$merge_tool_cmd" && ! type "$merge_tool_path" > /dev/null 2>&1; then
+		echo "The merge tool $merge_tool is not available as '$merge_tool_path'"
+		exit 1
+	fi
+fi
+
+
+# Launch the merge tool on each path provided by 'git diff'
+while test $# -gt 6
+do
+	launch_merge_tool "$1" "$2" "$5"
+	shift 7
+done
diff --git a/contrib/difftool/git-difftool.txt b/contrib/difftool/git-difftool.txt
new file mode 100644
index 0000000..ca3dbd2
--- /dev/null
+++ b/contrib/difftool/git-difftool.txt
@@ -0,0 +1,104 @@
+git-difftool(1)
+===============
+
+NAME
+----
+git-difftool - compare changes using common merge tools
+
+SYNOPSIS
+--------
+'git difftool' [--tool=<tool>] [--no-prompt] ['git diff' options]
+
+DESCRIPTION
+-----------
+'git-difftool' is a git command that allows you to compare and edit files
+between revisions using common merge tools.  At its most basic level,
+'git-difftool' does what 'git-mergetool' does but its use is for non-merge
+situations such as when preparing commits or comparing changes against
+the index.
+
+'git difftool' is a frontend to 'git diff' and accepts the same
+arguments and options.
+
+See linkgit:git-diff[1] for the full list of supported options.
+
+OPTIONS
+-------
+-t <tool>::
+--tool=<tool>::
+	Use the merge resolution program specified by <tool>.
+	Valid merge tools are:
+	kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
++
+If a merge resolution program is not specified, 'git-difftool'
+will use the configuration variable `merge.tool`.  If the
+configuration variable `merge.tool` is not set, 'git difftool'
+will pick a suitable default.
++
+You can explicitly provide a full path to the tool by setting the
+configuration variable `mergetool.<tool>.path`. For example, you
+can configure the absolute path to kdiff3 by setting
+`mergetool.kdiff3.path`. Otherwise, 'git-difftool' assumes the
+tool is available in PATH.
++
+Instead of running one of the known merge tool programs,
+'git-difftool' can be customized to run an alternative program
+by specifying the command line to invoke in a configuration
+variable `mergetool.<tool>.cmd`.
++
+When 'git-difftool' is invoked with this tool (either through the
+`-t` or `--tool` option or the `merge.tool` configuration variable)
+the configured command line will be invoked with the following
+variables available: `$LOCAL` is set to the name of the temporary
+file containing the contents of the diff pre-image and `$REMOTE`
+is set to the name of the temporary file containing the contents
+of the diff post-image.  `$BASE` is provided for compatibility
+with custom merge tool commands and has the same value as `$LOCAL`.
+
+--no-prompt::
+	Do not prompt before launching a diff tool.
+
+CONFIG VARIABLES
+----------------
+merge.tool::
+	The default merge tool to use.
++
+See the `--tool=<tool>` option above for more details.
+
+merge.keepBackup::
+	The original, unedited file content can be saved to a file with
+	a `.orig` extension.  Defaults to `true` (i.e. keep the backup files).
+
+mergetool.<tool>.path::
+	Override the path for the given tool.  This is useful in case
+	your tool is not in the PATH.
+
+mergetool.<tool>.cmd::
+	Specify the command to invoke the specified merge tool.
++
+See the `--tool=<tool>` option above for more details.
+
+
+SEE ALSO
+--------
+linkgit:git-diff[1]::
+	 Show changes between commits, commit and working tree, etc
+
+linkgit:git-mergetool[1]::
+	Run merge conflict resolution tools to resolve merge conflicts
+
+linkgit:git-config[1]::
+	 Get and set repository or global options
+
+
+AUTHOR
+------
+Written by David Aguilar <davvid@gmail.com>.
+
+Documentation
+--------------
+Documentation by David Aguilar and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the linkgit:git[1] suite
-- 
1.6.1.149.g7bbd8

^ permalink raw reply related

* Re: [PATCH] contrib: add 'git difftool' for launching common merge  tools
From: David Aguilar @ 2009-01-19  0:34 UTC (permalink / raw)
  To: markus.heidelberg; +Cc: Git mailing list
In-Reply-To: <200901182025.24045.markus.heidelberg@web.de>

On Sun, Jan 18, 2009 at 11:25 AM, Markus Heidelberg
<markus.heidelberg@web.de> wrote:
> David Aguilar, 16.01.2009:
>
>> +# git-difftool-helper script.  This script exports
>> +# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
>> +# GIT_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
>
> GIT_DIFFTOOL_NO_PROMPT

Thanks for catching that.


>> +sub usage
>> +{
>> +     print << 'USAGE';
>> +
>
> Why the leading empty line?

Fixed.


>> +usage: git difftool [--no-prompt] [--tool=tool] ["git diff" options]
>
> --tool=<tool>
>
> Swap the order of --no-prompt and --tool for consistency with
> git-difftool.txt and git-mergetool.

Done.


>> +     meld|vimdiff)
>> +             "$merge_tool_path" "$LOCAL" "$REMOTE"
>> +             ;;
>> +
>> +     gvimdiff)
>> +             "$merge_tool_path" -f "$LOCAL" "$REMOTE"
>> +             ;;
>
> Maybe use '-c "wincmd l"' for Vim as in my patch for git-mergetool to
> automatically place the cursor in the editable file? Useful for editing,
> if git-difftool is used to diff a file from the working tree.
>
> See http://thread.gmane.org/gmane.comp.version-control.git/106109


Very cool.  When you have unstaged changes git diff sends the local
filename as the 2nd argument so I changed the vim command to "wincmd
r" so that vim places the cursor on the right hand side.


> You have deleted all the '-' chars from git-command, but when using it as the
> name I think it's the preferred method, only when used as command then without
> slash.

I was wondering about that.  I think I tried to follow the lead from
the git-diff.txt documentation, but "diff" is a builtin and thus
doesn't have an actual git-diff, so I see why they should be
different.

I've changed the docs as you suggested -- 'git-difftool' is used to
name the script while 'git difftool' is used in the SYNOPSIS section.



>> +SEE ALSO
>> +--------
>> +linkgit:git-diff[7]::
>
> [1]
>
>> +      Show changes between commits, commit and working tree, etc
>> +
>> +linkgit:git-mergetool[1]::
>> +     Run merge conflict resolution tools to resolve merge conflicts
>> +
>> +linkgit:git-config[7]::
>
> [1]

Oops, I don't know how that happened.


>
> Works fine for me, thanks.
>
> Markus
>

Thanks again for your help.

-- 
    David

^ permalink raw reply

* Re: [PATCH v2] git-svn: Add --localtime option to "fetch"
From: Eric Wong @ 2009-01-19  0:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pete Harlan, Git mailing list
In-Reply-To: <4972ABA6.7060207@pcharlan.com>

Pete Harlan <pgit@pcharlan.com> wrote:
> By default git-svn stores timestamps of fetched commits in
> Subversion's UTC format.  Passing --localtime to fetch will convert
> them to the timezone of the server on which git-svn is run.
> 
> This makes the timestamps of a resulting "git log" agree with what
> "svn log" shows for the same repository.
> 
> Signed-off-by: Pete Harlan <pgit@pcharlan.com>

Thanks Peter,

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
> 
> Changes to v2 after feedback from Eric Wong:
> 
> 1. "--convert-timezones" renamed to "--localtime".
> 
> 2. Removed warnings about breaking interoperability with Subversion,
>    because the option doesn't do that.  Instead warn about
>    interoperability with other git-svn users cloning from the same
>    repository if they don't all use or not use --localtime.
> 
> 3. Move config variable into Git::SVN namespace.
> 
> 4. Better conformance to coding guidelines.
> 
>  Documentation/git-svn.txt              |   11 ++++++
>  contrib/completion/git-completion.bash |    2 +-
>  git-svn.perl                           |   54 ++++++++++++++++++++++++++++++-
>  3 files changed, 64 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 8d0c421..63d2f5e 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -92,6 +92,17 @@ COMMANDS
>  	.git/config file may be specified as an optional command-line
>  	argument.
> 
> +--localtime;;
> +	Store Git commit times in the local timezone instead of UTC.  This
> +	makes 'git-log' (even without --date=local) show the same times
> +	that `svn log` would in the local timezone.
> +
> +This doesn't interfere with interoperating with the Subversion
> +repository you cloned from, but if you wish for your local Git
> +repository to be able to interoperate with someone else's local Git
> +repository, either don't use this option or you should both use it in
> +the same local timezone.
> +
>  'clone'::
>  	Runs 'init' and 'fetch'.  It will automatically create a
>  	directory based on the basename of the URL passed to it;
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index f8b845a..c9d2c02 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1575,7 +1575,7 @@ _git_svn ()
>  			--follow-parent --authors-file= --repack=
>  			--no-metadata --use-svm-props --use-svnsync-props
>  			--log-window-size= --no-checkout --quiet
> -			--repack-flags --user-log-author $remote_opts
> +			--repack-flags --user-log-author --localtime $remote_opts
>  			"
>  		local init_opts="
>  			--template= --shared= --trunk= --tags=
> diff --git a/git-svn.perl b/git-svn.perl
> index ad01e18..0adc8db 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -84,6 +84,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
>  		   \$Git::SVN::_repack_flags,
>  		'use-log-author' => \$Git::SVN::_use_log_author,
>  		'add-author-from' => \$Git::SVN::_add_author_from,
> +		'localtime' => \$Git::SVN::_localtime,
>  		%remote_opts );
> 
>  my ($_trunk, $_tags, $_branches, $_stdlayout);
> @@ -1364,7 +1365,7 @@ use constant rev_map_fmt => 'NH40';
>  use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
>              $_repack $_repack_flags $_use_svm_props $_head
>              $_use_svnsync_props $no_reuse_existing $_minimize_url
> -	    $_use_log_author $_add_author_from/;
> +	    $_use_log_author $_add_author_from $_localtime/;
>  use Carp qw/croak/;
>  use File::Path qw/mkpath/;
>  use File::Copy qw/copy/;
> @@ -2526,12 +2527,61 @@ sub get_untracked {
>  	\@out;
>  }
> 
> +# parse_svn_date(DATE)
> +# --------------------
> +# Given a date (in UTC) from Subversion, return a string in the format
> +# "<TZ Offset> <local date/time>" that Git will use.
> +#
> +# By default the parsed date will be in UTC; if $Git::SVN::_localtime
> +# is true we'll convert it to the local timezone instead.
>  sub parse_svn_date {
>  	my $date = shift || return '+0000 1970-01-01 00:00:00';
>  	my ($Y,$m,$d,$H,$M,$S) = ($date =~ /^(\d{4})\-(\d\d)\-(\d\d)T
>  	                                    (\d\d)\:(\d\d)\:(\d\d).\d+Z$/x) or
>  	                                 croak "Unable to parse date: $date\n";
> -	"+0000 $Y-$m-$d $H:$M:$S";
> +	my $parsed_date;    # Set next.
> +
> +	if ($Git::SVN::_localtime) {
> +		# Translate the Subversion datetime to an epoch time.
> +		# Begin by switching ourselves to $date's timezone, UTC.
> +		my $old_env_TZ = $ENV{TZ};
> +		$ENV{TZ} = 'UTC';
> +
> +		my $epoch_in_UTC =
> +		    POSIX::strftime('%s', $S, $M, $H, $d, $m - 1, $Y - 1900);
> +
> +		# Determine our local timezone (including DST) at the
> +		# time of $epoch_in_UTC.  $Git::SVN::Log::TZ stored the
> +		# value of TZ, if any, at the time we were run.
> +		if (defined $Git::SVN::Log::TZ) {
> +			$ENV{TZ} = $Git::SVN::Log::TZ;
> +		} else {
> +			delete $ENV{TZ};
> +		}
> +
> +		my $our_TZ =
> +		    POSIX::strftime('%Z', $S, $M, $H, $d, $m - 1, $Y - 1900);
> +
> +		# This converts $epoch_in_UTC into our local timezone.
> +		my ($sec, $min, $hour, $mday, $mon, $year,
> +		    $wday, $yday, $isdst) = localtime($epoch_in_UTC);
> +
> +		$parsed_date = sprintf('%s %04d-%02d-%02d %02d:%02d:%02d',
> +				       $our_TZ, $year + 1900, $mon + 1,
> +				       $mday, $hour, $min, $sec);
> +
> +		# Reset us to the timezone in effect when we entered
> +		# this routine.
> +		if (defined $old_env_TZ) {
> +			$ENV{TZ} = $old_env_TZ;
> +		} else {
> +			delete $ENV{TZ};
> +		}
> +	} else {
> +		$parsed_date = "+0000 $Y-$m-$d $H:$M:$S";
> +	}
> +
> +	return $parsed_date;
>  }
> 
>  sub check_author {
> -- 
> 1.6.1.77.g953e7

^ permalink raw reply

* [PATCH] git-svn: fix SVN 1.1.x compatibility
From: Eric Wong @ 2009-01-19  0:45 UTC (permalink / raw)
  To: Tom G. Christensen; +Cc: git
In-Reply-To: <20090117105811.GB15801@dcvr.yhbt.net>

The get_log() function in the Perl SVN API introduced the limit
parameter in 1.2.0.  However, this got discarded in our SVN::Ra
compatibility layer when used with SVN 1.1.x.  We now emulate
the limit functionality in older SVN versions by preventing the
original callback from being called if the given limit has been
reached.  This emulation is less bandwidth efficient, but SVN
1.1.x is becoming rarer now.

Additionally, the --limit parameter in svn(1) uses the
aforementioned get_log() functionality change in SVN 1.2.x.
t9129 no longer depends on --limit to work and instead uses
Perl to parse out the commit message.

Thanks to Tom G. Christensen for the bug report.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---

 Hi Tom, this should fix things for you.  I've tested this in an old
 Debian Sarge chroot running SVN 1.1.4

 git-svn.perl                           |   15 ++++++++++++++-
 t/t9129-git-svn-i18n-commitencoding.sh |   13 +++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index e3e125b..71b8ef4 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4130,10 +4130,23 @@ sub DESTROY {
 	# do not call the real DESTROY since we store ourselves in $RA
 }
 
+# get_log(paths, start, end, limit,
+#         discover_changed_paths, strict_node_history, receiver)
 sub get_log {
 	my ($self, @args) = @_;
 	my $pool = SVN::Pool->new;
-	splice(@args, 3, 1) if ($SVN::Core::VERSION le '1.2.0');
+
+	# the limit parameter was not supported in SVN 1.1.x, so we
+	# drop it.  Therefore, the receiver callback passed to it
+	# is made aware of this limitation by being wrapped if
+	# the limit passed to is being wrapped.
+	if ($SVN::Core::VERSION le '1.2.0') {
+		my $limit = splice(@args, 3, 1);
+		if ($limit > 0) {
+			my $receiver = pop @args;
+			push(@args, sub { &$receiver(@_) if (--$limit >= 0) });
+		}
+	}
 	my $ret = $self->SUPER::get_log(@args, $pool);
 	$pool->clear;
 	$ret;
diff --git a/t/t9129-git-svn-i18n-commitencoding.sh b/t/t9129-git-svn-i18n-commitencoding.sh
index 8a9dde4..9c7b1ad 100755
--- a/t/t9129-git-svn-i18n-commitencoding.sh
+++ b/t/t9129-git-svn-i18n-commitencoding.sh
@@ -15,8 +15,17 @@ compare_git_head_with () {
 }
 
 compare_svn_head_with () {
-	LC_ALL=en_US.UTF-8 svn log --limit 1 `git svn info --url` | \
-		sed -e 1,3d -e "/^-\{1,\}\$/d" >current &&
+	# extract just the log message and strip out committer info.
+	# don't use --limit here since svn 1.1.x doesn't have it,
+	LC_ALL=en_US.UTF-8 svn log `git svn info --url` | perl -w -e '
+		use bytes;
+		$/ = ("-"x72) . "\n";
+		my @x = <STDIN>;
+		@x = split(/\n/, $x[1]);
+		splice(@x, 0, 2);
+		$x[-1] = "";
+		print join("\n", @x);
+	' > current &&
 	test_cmp current "$1"
 }
 
-- 
Eric Wong

^ permalink raw reply related

* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into  submodules
From: Johannes Schindelin @ 2009-01-19  1:24 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: Junio C Hamano, git
In-Reply-To: <8c5c35580901181446n3c36a345m5d8e78764a85c123@mail.gmail.com>

Hi,

On Sun, 18 Jan 2009, Lars Hjemli wrote:

> Sorry, but if your concern is whether to traverse a submodule in a bare 
> repo when the submodule isn't checked out (yeah, contradiction in 
> terms), I just don't see the point.

Obviously.

> For non-bare repositories the policy has always been to ignore
> submodules which isn't checked out, but for bare repositories there is
> no obvious way (for me, at least) to apply the same policy.

There is one:  we never traverse them in bare repositories.

Never.

You are introducing that contradicts that on purpose.  Which I do not 
like at all.

Sure, what you want is a nifty feature, but you'll have to do it right.

For example, your handling for bare repositories precludes everybody from 
specifying -- just for this particular call to git archive -- what 
submodules they want to include.  And you preclude anybody from excluding 
-- just for this particular call to git archive -- certain submodules 
whose commits just so happen to be present in the superproject.

For me, that is a sign of a bad user interface design.

Ciao,
Dscho

P.S.: if you still don't get the point, I will just shut up, until the 
question crops up, and redirect every person confused by that behavior to 
you.  Be prepared.

^ permalink raw reply

* how to track multiple upstreams in one repository
From: david @ 2009-01-19  2:58 UTC (permalink / raw)
  To: git

for linux I want to track both the linus tree and the -stable tree. 
Ideally I want to be able to do a checkout of tags from either tree from 
the same directory (along with diffs between items in both trees, etc)

I have found documentation on how to clone from each of them, but I 
haven't found any simple documentation on how to work with both of them.

David Lang

^ permalink raw reply

* [PATCH/RFC v1 1/1] bug fix, diff whitespace ignore options
From: Keith Cascio @ 2009-01-19  2:01 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Junio C Hamano
In-Reply-To: <alpine.DEB.1.00.0901190218470.3586@pacific.mpi-cbg.de>

  Fixed bug in diff whitespace ignore options.
  It is now OK to specify more than one whitespace ignore option
  on the command line. In unit test 4015, expect success rather
  than failure for 4 cases.
  Note: I do not fully understand why this fix works, but it passes
  all 68 t4???-* diff test scripts.

The semantics of the three whitespace ignore flags
{ -w, -b, --ignore-space-at-eol }
obey a relation of transitive implication, i.e. the stronger
options imply the weaker options:
-w                    implies the other two
-b                    implies --ignore-space-at-eol
--ignore-space-at-eol implies only itself

Therefore it is never necessary to specify more than one of these
on the command line.  Yet we imagine scenarios where software
wrappers (e.g. GUIs, etc) generate command lines that switch on
more than one of these flags simultaneously.  It is unreasonable
to prohibit specifying more than one, since a new user might not
immediately discern the implication relation.  Now we call such
a command line valid and legal.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---
  t/t4015-diff-whitespace.sh |    8 ++++----
  xdiff/xutils.c             |   22 ++++++++++++----------
  2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index dbb608c..6d13da3 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -99,11 +99,11 @@ EOF
  git diff -w > out
  test_expect_success 'another test, with -w' 'test_cmp expect out'
  git diff -w -b > out
-test_expect_failure 'another test, with -w -b' 'test_cmp expect out'
+test_expect_success 'another test, with -w -b' 'test_cmp expect out'
  git diff -w --ignore-space-at-eol > out
-test_expect_failure 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -w --ignore-space-at-eol' 'test_cmp expect out'
  git diff -w -b --ignore-space-at-eol > out
-test_expect_failure 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -w -b --ignore-space-at-eol' 'test_cmp expect out'

  tr 'Q' '\015' << EOF > expect
  diff --git a/x b/x
@@ -123,7 +123,7 @@ EOF
  git diff -b > out
  test_expect_success 'another test, with -b' 'test_cmp expect out'
  git diff -b --ignore-space-at-eol > out
-test_expect_failure 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'
+test_expect_success 'another test, with -b --ignore-space-at-eol' 'test_cmp expect out'

  tr 'Q' '\015' << EOF > expect
  diff --git a/x b/x
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index d7974d1..b9bda86 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
@@ -245,17 +245,19 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
  			while (ptr + 1 < top && isspace(ptr[1])
  					&& ptr[1] != '\n')
  				ptr++;
-			if (flags & XDF_IGNORE_WHITESPACE_CHANGE
-					&& ptr[1] != '\n') {
-				ha += (ha << 5);
-				ha ^= (unsigned long) ' ';
-			}
-			if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
-					&& ptr[1] != '\n') {
-				while (ptr2 != ptr + 1) {
+			if( ! (          flags & XDF_IGNORE_WHITESPACE       )){
+				if(      flags & XDF_IGNORE_WHITESPACE_CHANGE
+						&& ptr[1] != '\n') {
  					ha += (ha << 5);
-					ha ^= (unsigned long) *ptr2;
-					ptr2++;
+					ha ^= (unsigned long) ' ';
+				}
+				else if( flags & XDF_IGNORE_WHITESPACE_AT_EOL
+						&& ptr[1] != '\n') {
+					while (ptr2 != ptr + 1) {
+						ha += (ha << 5);
+						ha ^= (unsigned long) *ptr2;
+						ptr2++;
+					}
  				}
  			}
  			continue;
-- 
1.6.1.203.ga83c8.dirty

^ permalink raw reply related

* [PATCH] git-svn: Show UUID in svn info for added directories with svn 1.5.5
From: Marcel Koeppen @ 2009-01-19  2:02 UTC (permalink / raw)
  To: git; +Cc: normalperson

In svn 1.5.5 the output of "svn info" for added directories was changed
and now shows the repository UUID. This patch implements the same
behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
svn 1.5.5 is used.

Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
---
 git-svn.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index ad01e18..2f16a4e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -911,7 +911,8 @@ sub cmd_info {
 	if ($@) {
 		$result .= "Repository Root: (offline)\n";
 	}
-	$result .= "Repository UUID: $uuid\n" unless $diff_status eq "A";
+	$result .= "Repository UUID: $uuid\n" unless $diff_status eq "A" &&
+		($SVN::Core::VERSION le '1.5.4' || $file_type ne "dir");
 	$result .= "Revision: " . ($diff_status eq "A" ? 0 : $rev) . "\n";
 
 	$result .= "Node Kind: " .
-- 
1.6.1.142.g76f25

^ permalink raw reply related

* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: SZEDER Gábor @ 2009-01-19  2:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>

On Sun, Jan 18, 2009 at 01:27:44PM -0800, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > I think (1) the solution (almost) makes sense, (2) the patch needs to be
> > explained a lot better as you mentioned in your two messages, and (3) if
> > it does not affect any other case than when you are in a subdirectory of
> > the .git/ directory, then you are doing something funny anyway and
> > performance issue Dscho mentions, if any, is not a concern.
> >
> > My "(almost)" in (1) above is because the patch uses this new behaviour
> > even when you are inside the .git/ directory itself (or at the root of a
> > bare repository), which is a very common case that we do not have to nor
> > want to change the behaviour.  It also invalidates the precondition of (3)
> > above.
> 
> And this is a trivial follow-up on top of Szeder's patch.

Thanks.  In the meantime I was working on a patch that sets relative
path in this case, too.  I got it almost working: all tests passed
except '.git/objects/: is-bare-repository' in 't1500-rev-parse'.  I
couldn't figure it out why this test failed, however.

In case somebody might be interested for such an uncommon case, the
patch is below.


Best,
Gábor


 setup.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/setup.c b/setup.c
index 6b277b6..b4d37d7 100644
--- a/setup.c
+++ b/setup.c
@@ -375,7 +375,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 	static char cwd[PATH_MAX+1];
 	const char *gitdirenv;
 	const char *gitfile_dir;
-	int len, offset, ceil_offset;
+	int len, offset, ceil_offset, cdup_count = 0;
 
 	/*
 	 * Let's assume that we are in a git repository.
@@ -453,10 +453,22 @@ const char *setup_git_directory_gently(int *nongit_ok)
 		if (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))
 			break;
 		if (is_git_directory(".")) {
+			char gd_rel_path[PATH_MAX];
 			inside_git_dir = 1;
 			if (!work_tree_env)
 				inside_work_tree = 0;
-			setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+			if (cdup_count) {
+				char *p = gd_rel_path;
+				while (cdup_count-- > 1) {
+					*p++ = '.'; *p++ = '.'; *p++ = '/';
+				}
+				*p++ = '.'; *p++ = '.';
+				*p = '\0';
+			} else {
+				gd_rel_path[0] = '.';
+				gd_rel_path[1] = '\0';
+			}
+			setenv(GIT_DIR_ENVIRONMENT, gd_rel_path, 1);
 			check_repository_format_gently(nongit_ok);
 			return NULL;
 		}
@@ -472,6 +484,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
 		}
 		if (chdir(".."))
 			die("Cannot change to %s/..: %s", cwd, strerror(errno));
+		cdup_count++;
 	}
 
 	inside_git_dir = 0;

^ permalink raw reply related

* [PATCH] t1500: extend with tests of 'git rev-parse --git-dir'
From: SZEDER Gábor @ 2009-01-19  2:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, Johannes Schindelin, git
In-Reply-To: <7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---

  These will pass with Junio's follow-up.


 t/t1500-rev-parse.sh |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 85da4ca..48ee077 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -26,21 +26,28 @@ test_rev_parse() {
 	"test '$1' = \"\$(git rev-parse --show-prefix)\""
 	shift
 	[ $# -eq 0 ] && return
+
+	test_expect_success "$name: git-dir" \
+	"test '$1' = \"\$(git rev-parse --git-dir)\""
+	shift
+	[ $# -eq 0 ] && return
 }
 
-# label is-bare is-inside-git is-inside-work prefix
+# label is-bare is-inside-git is-inside-work prefix git-dir
+
+ROOT=$(pwd)
 
-test_rev_parse toplevel false false true ''
+test_rev_parse toplevel false false true '' .git
 
 cd .git || exit 1
-test_rev_parse .git/ false true false ''
+test_rev_parse .git/ false true false '' .
 cd objects || exit 1
-test_rev_parse .git/objects/ false true false ''
+test_rev_parse .git/objects/ false true false '' "$ROOT/.git"
 cd ../.. || exit 1
 
 mkdir -p sub/dir || exit 1
 cd sub/dir || exit 1
-test_rev_parse subdirectory false false true sub/dir/
+test_rev_parse subdirectory false false true sub/dir/ "$ROOT/.git"
 cd ../.. || exit 1
 
 git config core.bare true
-- 
1.6.1.201.g0e7e.dirty

^ permalink raw reply related

* Re: how to track multiple upstreams in one repository
From: A Large Angry SCM @ 2009-01-19  2:18 UTC (permalink / raw)
  To: david; +Cc: git
In-Reply-To: <alpine.DEB.1.10.0901181855400.20741@asgard.lang.hm>

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

david@lang.hm wrote:
> for linux I want to track both the linus tree and the -stable tree. 
> Ideally I want to be able to do a checkout of tags from either tree from 
> the same directory (along with diffs between items in both trees, etc)
> 
> I have found documentation on how to clone from each of them, but I 
> haven't found any simple documentation on how to work with both of them.

Attached are what I use. It's not pretty but it's works for me; YMMV.

[-- Attachment #2: fred.sh --]
[-- Type: application/x-shellscript, Size: 432 bytes --]

[-- Attachment #3: fred_history --]
[-- Type: text/plain, Size: 2334 bytes --]

export GIT_COMMITTER_NAME="@"
export GIT_AUTHOR_NAME="@"

./fred.sh git://git.kernel.org/pub/scm/git/git.git git/git

./fred.sh git://git.kernel.org/pub/scm/gitk/gitk.git gitk/gitk

./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/sparse.git torvalds/sparse

./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git torvalds/linux-2.6

./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.11.y.git stable/linux-2.6.11.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.12.y.git stable/linux-2.6.12.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.13.y.git stable/linux-2.6.13.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.14.y.git stable/linux-2.6.14.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.15.y.git stable/linux-2.6.15.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.16.y.git stable/linux-2.6.16.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.17.y.git stable/linux-2.6.17.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.18.y.git stable/linux-2.6.18.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.19.y.git stable/linux-2.6.19.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.git stable/linux-2.6.20.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git stable/linux-2.6.21.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.22.y.git stable/linux-2.6.22.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.23.y.git stable/linux-2.6.23.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.24.y.git stable/linux-2.6.24.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.25.y.git stable/linux-2.6.25.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.26.y.git stable/linux-2.6.26.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.27.y.git stable/linux-2.6.27.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.28.y.git stable/linux-2.6.28.y

./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git tglx/history


^ permalink raw reply

* Re: how to track multiple upstreams in one repository
From: Bryan Donlan @ 2009-01-19  2:14 UTC (permalink / raw)
  To: david; +Cc: git
In-Reply-To: <alpine.DEB.1.10.0901181855400.20741@asgard.lang.hm>

On Sun, Jan 18, 2009 at 06:58:06PM -0800, david@lang.hm wrote:
> for linux I want to track both the linus tree and the -stable tree.  
> Ideally I want to be able to do a checkout of tags from either tree from  
> the same directory (along with diffs between items in both trees, etc)
>
> I have found documentation on how to clone from each of them, but I  
> haven't found any simple documentation on how to work with both of them.

After cloning from one:
git remote add remotename git://...
git fetch remotename

You will now have the other repository fetched into your local
repository; tags from both will be replicated to your local tags.

^ permalink raw reply

* Re: git-svn: File was not found in commit
From: Eric Wong @ 2009-01-19  2:41 UTC (permalink / raw)
  To: Morgan Christiansson; +Cc: git
In-Reply-To: <496B497F.30109@mog.se>

Morgan Christiansson <git@mog.se> wrote:
> Eric Wong wrote:
>> Eric Wong <normalperson@yhbt.net> wrote:
>>   
>>> Morgan Christiansson <git@mog.se> wrote:
>>>     
>>>> The "Ignoring path" message appears to be coming from git which is  
>>>> refusing to commit the .git directory. Which leads to git-svn being 
>>>>  unaware of the files being ignored and giving an error when it 
>>>> can't  find them.
>>>>       I'm personally fine with these files being ignored by git, 
>>>> but git-svn  needs to be aware that they are not added to the 
>>>> repository.
>>>>       
>>> Hi Morgan,
>>> Can you try the following rough patch and see it it fixes things
>>> for you?  Thanks!
>>>     
>>
>> Actually, I think this patch is broken (my quickly put together test
>> case was insufficient)...
>>   
>
> Yes it was. apply_textdelta() is never called for my repo so it has no  
> effect.
>
> I've attached an updated and simplified version of the testcase you sent  
> that correctly triggers the bug i reported.
>
> I'm not a native perl coder though so I don't think I would be able to  
> provide a clean fix for this. But I've traced through enough of the  
> program to see that the .git directories should be filtered out as early  
> as possible to mimick the behaviour of git.

Hi Morgan, the following patch should fix your problem.

>From b03a71a660d15d76b63d7d3c5205b896f89f34b5 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sun, 11 Jan 2009 18:23:38 -0800
Subject: [PATCH] git-svn: avoid importing nested git repos

Some SVN repositories contain git repositories within them
(hopefully accidentally checked in).  Since git refuses to track
nested ".git" repositories, this can be a problem when fetching
updates from SVN.

Thanks to Morgan Christiansson for the report and testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl                       |   34 +++++++++++--
 t/t9133-git-svn-nested-git-repo.sh |  101 ++++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+), 4 deletions(-)
 create mode 100755 t/t9133-git-svn-nested-git-repo.sh

diff --git a/git-svn.perl b/git-svn.perl
index 71b8ef4..55c4dfb 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3291,6 +3291,11 @@ sub _mark_empty_symlinks {
 	\%ret;
 }
 
+# returns true if a given path is inside a ".git" directory
+sub in_dot_git {
+	$_[0] =~ m{(?:^|/)\.git(?:/|$)};
+}
+
 sub set_path_strip {
 	my ($self, $path) = @_;
 	$self->{path_strip} = qr/^\Q$path\E(\/|$)/ if length $path;
@@ -3316,6 +3321,7 @@ sub git_path {
 
 sub delete_entry {
 	my ($self, $path, $rev, $pb) = @_;
+	return undef if in_dot_git($path);
 
 	my $gpath = $self->git_path($path);
 	return undef if ($gpath eq '');
@@ -3343,8 +3349,12 @@ sub delete_entry {
 
 sub open_file {
 	my ($self, $path, $pb, $rev) = @_;
+	my ($mode, $blob);
+
+	goto out if in_dot_git($path);
+
 	my $gpath = $self->git_path($path);
-	my ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)
+	($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)
 	                     =~ /^(\d{6}) blob ([a-f\d]{40})\t/);
 	unless (defined $mode && defined $blob) {
 		die "$path was not found in commit $self->{c} (r$rev)\n";
@@ -3352,20 +3362,27 @@ sub open_file {
 	if ($mode eq '100644' && $self->{empty_symlinks}->{$path}) {
 		$mode = '120000';
 	}
+out:
 	{ path => $path, mode_a => $mode, mode_b => $mode, blob => $blob,
 	  pool => SVN::Pool->new, action => 'M' };
 }
 
 sub add_file {
 	my ($self, $path, $pb, $cp_path, $cp_rev) = @_;
-	my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
-	delete $self->{empty}->{$dir};
-	{ path => $path, mode_a => 100644, mode_b => 100644,
+	my $mode;
+
+	if (!in_dot_git($path)) {
+		my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
+		delete $self->{empty}->{$dir};
+		$mode = '100644';
+	}
+	{ path => $path, mode_a => $mode, mode_b => $mode,
 	  pool => SVN::Pool->new, action => 'A' };
 }
 
 sub add_directory {
 	my ($self, $path, $cp_path, $cp_rev) = @_;
+	goto out if in_dot_git($path);
 	my $gpath = $self->git_path($path);
 	if ($gpath eq '') {
 		my ($ls, $ctx) = command_output_pipe(qw/ls-tree
@@ -3383,11 +3400,13 @@ sub add_directory {
 	my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
 	delete $self->{empty}->{$dir};
 	$self->{empty}->{$path} = 1;
+out:
 	{ path => $path };
 }
 
 sub change_dir_prop {
 	my ($self, $db, $prop, $value) = @_;
+	return undef if in_dot_git($db->{path});
 	$self->{dir_prop}->{$db->{path}} ||= {};
 	$self->{dir_prop}->{$db->{path}}->{$prop} = $value;
 	undef;
@@ -3395,6 +3414,7 @@ sub change_dir_prop {
 
 sub absent_directory {
 	my ($self, $path, $pb) = @_;
+	return undef if in_dot_git($pb->{path});
 	$self->{absent_dir}->{$pb->{path}} ||= [];
 	push @{$self->{absent_dir}->{$pb->{path}}}, $path;
 	undef;
@@ -3402,6 +3422,7 @@ sub absent_directory {
 
 sub absent_file {
 	my ($self, $path, $pb) = @_;
+	return undef if in_dot_git($pb->{path});
 	$self->{absent_file}->{$pb->{path}} ||= [];
 	push @{$self->{absent_file}->{$pb->{path}}}, $path;
 	undef;
@@ -3409,6 +3430,7 @@ sub absent_file {
 
 sub change_file_prop {
 	my ($self, $fb, $prop, $value) = @_;
+	return undef if in_dot_git($fb->{path});
 	if ($prop eq 'svn:executable') {
 		if ($fb->{mode_b} != 120000) {
 			$fb->{mode_b} = defined $value ? 100755 : 100644;
@@ -3424,11 +3446,13 @@ sub change_file_prop {
 
 sub apply_textdelta {
 	my ($self, $fb, $exp) = @_;
+	return undef if (in_dot_git($fb->{path}));
 	my $fh = $::_repository->temp_acquire('svn_delta');
 	# $fh gets auto-closed() by SVN::TxDelta::apply(),
 	# (but $base does not,) so dup() it for reading in close_file
 	open my $dup, '<&', $fh or croak $!;
 	my $base = $::_repository->temp_acquire('git_blob');
+
 	if ($fb->{blob}) {
 		my ($base_is_link, $size);
 
@@ -3469,6 +3493,8 @@ sub apply_textdelta {
 
 sub close_file {
 	my ($self, $fb, $exp) = @_;
+	return undef if (in_dot_git($fb->{path}));
+
 	my $hash;
 	my $path = $self->git_path($fb->{path});
 	if (my $fh = $fb->{fh}) {
diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh
new file mode 100755
index 0000000..893f57e
--- /dev/null
+++ b/t/t9133-git-svn-nested-git-repo.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Eric Wong
+#
+
+test_description='git svn property tests'
+. ./lib-git-svn.sh
+
+test_expect_success 'setup repo with a git repo inside it' '
+	svn co "$svnrepo" s &&
+	(
+		cd s &&
+		git init &&
+		test -f .git/HEAD &&
+		> .git/a &&
+		echo a > a &&
+		svn add .git a &&
+		svn commit -m "create a nested git repo" &&
+		svn up &&
+		echo hi >> .git/a &&
+		svn commit -m "modify .git/a" &&
+		svn up
+	)
+'
+
+test_expect_success 'clone an SVN repo containing a git repo' '
+	git svn clone "$svnrepo" g &&
+	echo a > expect &&
+	test_cmp expect g/a
+'
+
+test_expect_success 'SVN-side change outside of .git' '
+	(
+		cd s &&
+		echo b >> a &&
+		svn commit -m "SVN-side change outside of .git" &&
+		svn up &&
+		svn log -v | fgrep "SVN-side change outside of .git"
+	)
+'
+
+test_expect_success 'update git svn-cloned repo' '
+	(
+		cd g &&
+		git svn rebase &&
+		echo a > expect &&
+		echo b >> expect &&
+		test_cmp a expect &&
+		rm expect
+	)
+'
+
+test_expect_success 'SVN-side change inside of .git' '
+	(
+		cd s &&
+		git add a &&
+		git commit -m "add a inside an SVN repo" &&
+		git log &&
+		svn add --force .git &&
+		svn commit -m "SVN-side change inside of .git" &&
+		svn up &&
+		svn log -v | fgrep "SVN-side change inside of .git"
+	)
+'
+
+test_expect_success 'update git svn-cloned repo' '
+	(
+		cd g &&
+		git svn rebase &&
+		echo a > expect &&
+		echo b >> expect &&
+		test_cmp a expect &&
+		rm expect
+	)
+'
+
+test_expect_success 'SVN-side change in and out of .git' '
+	(
+		cd s &&
+		echo c >> a &&
+		git add a &&
+		git commit -m "add a inside an SVN repo" &&
+		svn commit -m "SVN-side change in and out of .git" &&
+		svn up &&
+		svn log -v | fgrep "SVN-side change in and out of .git"
+	)
+'
+
+test_expect_success 'update git svn-cloned repo again' '
+	(
+		cd g &&
+		git svn rebase &&
+		echo a > expect &&
+		echo b >> expect &&
+		echo c >> expect &&
+		test_cmp a expect &&
+		rm expect
+	)
+'
+
+test_done
-- 
Eric Wong

^ permalink raw reply related

* Re: how to track multiple upstreams in one repository
From: david @ 2009-01-19  3:58 UTC (permalink / raw)
  To: Bryan Donlan; +Cc: git
In-Reply-To: <20090119021426.GA21999@shion.is.fushizen.net>

On Sun, 18 Jan 2009, Bryan Donlan wrote:

> On Sun, Jan 18, 2009 at 06:58:06PM -0800, david@lang.hm wrote:
>> for linux I want to track both the linus tree and the -stable tree.
>> Ideally I want to be able to do a checkout of tags from either tree from
>> the same directory (along with diffs between items in both trees, etc)
>>
>> I have found documentation on how to clone from each of them, but I
>> haven't found any simple documentation on how to work with both of them.
>
> After cloning from one:
> git remote add remotename git://...
> git fetch remotename
>
> You will now have the other repository fetched into your local
> repository; tags from both will be replicated to your local tags.

thanks, given the nature of git I figured it was something really simple, 
but I just wasn't able to find it.

I've forwarded this to the kernel.org webmaster to update the 'how to 
follow linux development' page

David Lang

^ permalink raw reply

* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into  submodules
From: Junio C Hamano @ 2009-01-19  3:02 UTC (permalink / raw)
  To: Lars Hjemli; +Cc: Johannes Schindelin, git
In-Reply-To: <8c5c35580901180945u17a69140vff2736765ee6073@mail.gmail.com>

Lars Hjemli <hjemli@gmail.com> writes:

> On Sun, Jan 18, 2009 at 16:48, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> ...
>> Seems you want to fall back to look in the superproject's object database.
>> But I think that is wrong, as I have a superproject with many platform
>> dependent submodules, only one of which is checked out, and for
>> convenience, the submodules all live in the superproject's repository.
>
> Actually, I want this to work for bare repositories by specifying the
> submodule odbs in the alternates file. So if the current submodule odb
> wasn't found my plan was to check if the commit object was accessible
> anyways but don't die() if it wasn't.

The current submodule design is "do not recurse into them by default
without being told" throughout the Porcelain.  We can think of various
ways for the users to tell which submodules are of interest and which are
uninteresting.

The most general solution would be to give a list of submodules you are
interested in recursing into from the command line, something like:

    $ git command --with-submodule=path1 --with-submodule=path2...

That approach would work equally "well" with a bare repository or with a
non-bare repository, but if you have N submodules, you need to give up to
N extra options, which may be cumbersome (meaning, "works equally well"
above actually may mean "works equally awkwardly").  One way to solve
awkwardness may be to support a mechanism that allows you to use
configuration variables to name a group of submodules.

In addition to such configuration variables, you already have one default
group of submodules, defined by the way you set up your work tree, when
your superproject does have a work tree.  Some submodules have
repositories cloned in the work tree, while some don't, and the ones
without clones can be defined as "uninteresting ones" (to the work tree
owner) that are outside the default group.  For many work tree oriented
operations, it may even make sense to allow that group to be used with a
single "git command --with-submodule" (i.e. when you do not say which
submodule you mean, that can default to "cloned" group).

I do not know "has an entry in the superproject's alternate list that
points to its object store" is a good basis to define another default
group useful especially in a bare repository setting; you seem to be
suggesting that, and you might be correct.

For "git archive", however, I suspect the "default group based on work
tree checkout state" may make the least sense.  "git archive HEAD" is
expected to give a reproducible dump of the state recorded by the HEAD
commit no matter who runs it in what repository, and I think there should
be a conscious and explicit instruction from the end user that says "Here
is a dump from this commit in the superproject, *BUT* it was made together
with contents from this and that submodule".  Command line options that
list "this and that submodule" is explicit enough, and a configured
nickname given to a known group of submodules from the command line may be
so as well, but the group based on the checkout state feels a bit too
implicit and magical to my taste.  The group based on the "has an entry in
superproject's alternates" criterion is not much better in this regard,
methinks.

Another worrysome thing about "git archive" is that it marks the resulting
archive with the commit object name the tarball was taken from.  If you
allow recursing into an arbitrary subset of submodule, a project with N
submodules can produce 2^N different varieties of archive, all marked with
the same commit object name from the superproject.  That might be a bit
too confusing.

^ permalink raw reply

* Re: [PATCH] git-svn: Show UUID in svn info for added directories with svn 1.5.5
From: Eric Wong @ 2009-01-19  3:04 UTC (permalink / raw)
  To: Marcel Koeppen; +Cc: git
In-Reply-To: <1232330521-50197-1-git-send-email-git-dev@marzelpan.de>

Marcel Koeppen <git-dev@marzelpan.de> wrote:
> In svn 1.5.5 the output of "svn info" for added directories was changed
> and now shows the repository UUID. This patch implements the same
> behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
> svn 1.5.5 is used.
> 
> Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>

Thanks Marcel,
Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
>  git-svn.perl |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index ad01e18..2f16a4e 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -911,7 +911,8 @@ sub cmd_info {
>  	if ($@) {
>  		$result .= "Repository Root: (offline)\n";
>  	}
> -	$result .= "Repository UUID: $uuid\n" unless $diff_status eq "A";
> +	$result .= "Repository UUID: $uuid\n" unless $diff_status eq "A" &&
> +		($SVN::Core::VERSION le '1.5.4' || $file_type ne "dir");
>  	$result .= "Revision: " . ($diff_status eq "A" ? 0 : $rev) . "\n";
>  
>  	$result .= "Node Kind: " .
> -- 

^ permalink raw reply

* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Junio C Hamano @ 2009-01-19  3:07 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Johannes Schindelin, Ray Chuan, git
In-Reply-To: <bd6139dc0901181612p5181c36eub337a339cd777da0@mail.gmail.com>

"Sverre Rabbelier" <srabbelier@gmail.com> writes:

> I totally detest having to use svn because of this), it would be nice
> to not dismiss http as "being slow anyway, so who cares about not
> making it faster"?

Nobody is arguing for "keeping it slow at all costs".

But "replace put && move with a single put, and we do not care if that
corrupts the resulting repository if it gets interrupted" is a different
story.

^ permalink raw reply

* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: Junio C Hamano @ 2009-01-19  3:15 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: Johannes Sixt, Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <20090119020311.GA8753@neumann>

SZEDER Gábor <szeder@fzi.de> writes:

> Thanks.  In the meantime I was working on a patch that sets relative
> path in this case, too.

Does it make sense to use relative path in such a case?

If it is for "rev-parse --git-dir", the calling script may learn the
correct location of the GIT_DIR with either relative or absolute, but if
it is for the internal consumption of git process itself and any
subprocess forked from us that look at GIT_DIR we export, the process
already runs at the repository root (because you do not chdir back) and
using relative path does not make much sense.  Exported GIT_DIR has to be
either "."  or the full path from the root to make sense to such a user, I
think.

^ permalink raw reply

* Re: [PATCH/RFC] git-am: Make it easier to see which patch failed
From: Junio C Hamano @ 2009-01-19  3:38 UTC (permalink / raw)
  To: Jeff King; +Cc: Stephan Beyer, Jonas Flodén, git, Johannes Schindelin
In-Reply-To: <20090118153928.GA16664@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> Yes, I'm surprised Junio doesn't remember the mass conversions we already had
> to do (4b7cc26a and 293623ed). But looking at the date, I guess it _has_
> been a year and a half. :)

Ok, I forgot, sue me ;-).

Anyway, thanks for spotting.  I'll fix it up like this.

-- >8 --
Subject: git-am: re-fix the diag message printing

The $FIRSTLINE variable is from the user's commit and can contain
arbitrary backslash escapes that may be (mis)interpreted when given to
"echo", depending on the implementation.  Use "printf" to work around the
issue.

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

diff --git a/git-am.sh b/git-am.sh
index ae2fe56..cf3d4a7 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -501,7 +501,7 @@ do
 	fi
 	if test $apply_status != 0
 	then
-		echo "Patch failed at $msgnum $FIRSTLINE"
+		printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
 		stop_here_user_resolve $this
 	fi
 
-- 
1.6.1.245.gdd9f9

^ permalink raw reply related

* parent-filter loses my merged branch -- what am I doing wrong?
From: Ask Bjørn Hansen @ 2009-01-19  3:45 UTC (permalink / raw)
  To: git

Hi everyone,

I'm converting another svn repository to git (yay).  It's only about  
1000 commits, but over more than 7 years and a cvs->svn conversion.

On Sam Villain's recommendation I'm spending a bit of time cleaning up  
the branches and merges with git filter-branch, but I don't think I'm  
quite understanding how it's supposed to work.

I put the repository up here (about 1MB):
	git clone git://git.develooper.com/qpsmtpd.git

I started out making a temporary tag for each svn commit, to have  
easier to use reference points:

for c in `git rev-list --all --date-order --timestamp | sort -n | awk  
'{print $2}'`; do
   svnid=`git show -s $c | tail -1 | sed 's/.*svn.perl.org\/qpsmtpd 
\///' | sed 's/\ .*//' | sed 's/^branches\///'`
   git tag -f $svnid $c
done

Then I tried getting the first merge adjusted to show both parents.     
The commit tagged v010@56 should be the second parent for trunk@57  
(the original/other parent for trunk@57 is trunk@20).

I tried using:

git filter-branch --tag-name-filter cat --parent-filter '
                  if test $GIT_COMMIT = $(git rev-parse trunk@57)
                  then
                     echo "-p $(git rev-parse trunk@20) -p $(git rev- 
parse v010@56)"
                  else
                     cat
                  fi
         ' \
master

...  but that seems to just basically throw away the "v010" branch!   
What did I do wrong?  (Some of the other problems with this repository  
is that we moved the branches around with "svn mv", so some of the  
branches don't even have the branch point as a parent; but I'll get  
back to that when I get this simple case working).

(The script also loses all the temporary tags I added; I thought "-- 
tag-name-filter cat" would preserve them?)


  - ask

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

^ permalink raw reply

* Re: [PATCH 3/4] Documentation: mention branches rather than heads
From: Junio C Hamano @ 2009-01-19  3:46 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: git
In-Reply-To: <1232289418-25627-4-git-send-email-mail@cup.kalibalik.dk>

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

> Most of the git push page talks about branches, so make it consistent
> also in this paragraph.

> Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
> ---
>  Documentation/git-push.txt |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
> index 6d3c711..a7a6f4c 100644
> --- a/Documentation/git-push.txt
> +++ b/Documentation/git-push.txt
> @@ -57,8 +57,8 @@ Pushing an empty <src> allows you to delete the <dst> ref from
>  the remote repository.
>  +
>  The special refspec `:` (or `+:` to allow non-fast forward updates)
> -directs git to push "matching" heads: for every head that exists on
> -the local side, the remote side is updated if a head of the same name
> +directs git to push "matching" branches: for every branch that exists on
> +the local side, the remote side is updated if a branch of the same name
>  already exists on the remote side.  This is the default operation mode
>  if no explicit refspec is found (that is neither on the command line
>  nor in any Push line of the corresponding remotes file---see below).

Consistency is good, and I agree "head" may be suboptimal here as this
part tries to give formal semantics to what various refspecs do.

I first thought it would make more sense to say "ref" instead, just like
the previous paragraph that talks about :<dst> form explains it is a way
to remove a "ref".  But we do only matching branches with : syntax these
days since 098e711 ("git-push $URL" without refspecs pushes only matching
branches, 2007-07-01); I agree with the updated text for that reason, but
I think the commit log message is wrong.

Thanks.

^ permalink raw reply

* Re: [PATCH v2] git-svn: Add --localtime option to "fetch"
From: Junio C Hamano @ 2009-01-19  3:46 UTC (permalink / raw)
  To: Eric Wong; +Cc: Pete Harlan, Git mailing list
In-Reply-To: <20090119004318.GA5128@untitled>

Thanks, both.

^ permalink raw reply

* Re: [PATCH/RFC v1 1/1] bug fix, diff whitespace ignore options
From: Johannes Schindelin @ 2009-01-19  3:53 UTC (permalink / raw)
  To: Keith Cascio; +Cc: git, Junio C Hamano
In-Reply-To: <alpine.GSO.2.00.0901181754190.9333@kiwi.cs.ucla.edu>

Hi,

On Sun, 18 Jan 2009, Keith Cascio wrote:

>  Fixed bug in diff whitespace ignore options.
>  It is now OK to specify more than one whitespace ignore option
>  on the command line. In unit test 4015, expect success rather
>  than failure for 4 cases.
>  Note: I do not fully understand why this fix works, but it passes
>  all 68 t4???-* diff test scripts.
> 
> The semantics of the three whitespace ignore flags
> { -w, -b, --ignore-space-at-eol }
> obey a relation of transitive implication, i.e. the stronger
> options imply the weaker options:
> -w                    implies the other two
> -b                    implies --ignore-space-at-eol
> --ignore-space-at-eol implies only itself
> 
> Therefore it is never necessary to specify more than one of these
> on the command line.  Yet we imagine scenarios where software
> wrappers (e.g. GUIs, etc) generate command lines that switch on
> more than one of these flags simultaneously.  It is unreasonable
> to prohibit specifying more than one, since a new user might not
> immediately discern the implication relation.  Now we call such
> a command line valid and legal.
> 
> Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
> ---

This does not really look all that similar to other commit messages.

For example, "Note: I do not fully understand why this fix works, but it 
passes all 68 t4???-* diff test scripts." is rather discouraging.  If you 
are not convinced, how should we be?

However, I almost can excuse that, but...

>  t/t4015-diff-whitespace.sh |    8 ++++----
>  xdiff/xutils.c             |   22 ++++++++++++----------
>  2 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/xdiff/xutils.c b/xdiff/xutils.c
> index d7974d1..b9bda86 100644
> --- a/xdiff/xutils.c
> +++ b/xdiff/xutils.c
> @@ -245,17 +245,19 @@ static unsigned long
> xdl_hash_record_with_whitespace(char const **data,
>  			while (ptr + 1 < top && isspace(ptr[1])
>  					&& ptr[1] != '\n')
>  				ptr++;
> -			if (flags & XDF_IGNORE_WHITESPACE_CHANGE
> -					&& ptr[1] != '\n') {
> -				ha += (ha << 5);
> -				ha ^= (unsigned long) ' ';
> -			}
> -			if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
> -					&& ptr[1] != '\n') {
> -				while (ptr2 != ptr + 1) {
> +			if( ! (          flags & XDF_IGNORE_WHITESPACE

... this is just plain ugly, not to mention breaking the coding style of 
the surrounding code in a rather blatant way.

> )){
> +				if(      flags & XDF_IGNORE_WHITESPACE_CHANGE
> +						&& ptr[1] != '\n') {
>  					ha += (ha << 5);
> -					ha ^= (unsigned long) *ptr2;
> -					ptr2++;
> +					ha ^= (unsigned long) ' ';
> +				}
> +				else if( flags & XDF_IGNORE_WHITESPACE_AT_EOL
> +						&& ptr[1] != '\n') {
> +					while (ptr2 != ptr + 1) {
> +						ha += (ha << 5);
> +						ha ^= (unsigned long) *ptr2;
> +						ptr2++;
> +					}

Besides, I think what you actually wanted is

		if (flags & XDF_IGNORE_WHITESPACE)
			; /* already handled */
		else if (flags & XDF_IGNORE_WHITESPACE_CHANGE)
			...
		else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL)
			...

for improved readability both of the code and the patch.

Ciao,
Dscho

^ 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