* Re: [PATCH RFC 6/6] send-email: Remove horrible mix of tabs and spaces
From: Andreas Ericsson @ 2009-04-07 22:10 UTC (permalink / raw)
To: Jeff King; +Cc: Michael Witten, demerphq, git
In-Reply-To: <20090407220048.GB18144@coredump.intra.peff.net>
Jeff King wrote:
> On Tue, Apr 07, 2009 at 04:42:36PM -0500, Michael Witten wrote:
>
>> I'll have to give that a try. However, I've been entertaining the idea
>> of rewriting the whole thing anyway; it's in need of much more than
>> reformatting.
>
> Just my two cents, but if you are considering re-writing send-email, I
> would suggest two things:
>
> 1. Make much heavier use of existing CPAN libraries. A lot of the ugly
> code is trying to handle corner cases in rfc2822 and mime parsing
> and generation. And I would not be surprised if there were still
> bugs in that ugly code.
>
> 2. Make a new command to compete with send-email instead of using the
> same name. This means that people who are really put off by
> CPAN dependencies from (1) above won't be negatively impacted. And
> you can drop any historical interface warts if you want to.
>
3. Make it capable of sending email directly from commits rather than
than having to generate them as files first. For bonus-points, use
git sequencer or some other "git rebase -i"-esque mangling thing
first, with capabilities of adding a cover-letter for patch-series.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* Re: [PATCH RFC 1/6] Re: send-email: Add --delay for separating emails
From: Andreas Ericsson @ 2009-04-07 22:17 UTC (permalink / raw)
To: Nicolas Sebrecht; +Cc: Jeff King, Michael Witten, git
In-Reply-To: <20090407220854.GA12908@vidovic>
Nicolas Sebrecht wrote:
> On Tue, Apr 07, 2009 at 05:51:43PM -0400, Jeff King wrote:
>
>>> When sending a patch series, the emails often arrive at the final
>>> destination out of order; though these emails should be chained
>>> via the In-Reply-To headers, some mail-viewing systems display
>>> by order of arrival instead.
>>>
>>> The --delay option provides a means for specifying that there
>>> should be a certain number of seconds of delay between sending
>>> emails, so that the arrival order can be controlled better.
>>>
>>> Signed-off-by: Michael Witten <mfwitten@gmail.com>
>
>> I think it may still be reasonable to implement a solution that only
>> covers some of the cases, but I what I am asking is if we know what
>> percentage of the cases that is. If we are preventing only 1% of
>> out-of-order deliveries with this, I question whether it is worth the
>> bother.
>
> IMHO, this improvement is broken by design. We try to fix a
> receiver-only issue by a sender side fix.
>
> If the receiver wants the patch series be in a good ordered _for sure_, he
> has to switch to a client mail supporting the In-Reply-To chains.
>
The biggest problem with in-reply-to chains is that they're absolutely
horrible for patch-series of more than five or so messages. The "worst"
one this week was a series of 14 patches, I believe. If any of the
deeper nested patches gets any sort of commentary, it usually eats so
much horizontal screen estate that it becomes hopeless to actually
find anything.
Besides that, most mua's I've worked with list emails in a thread
like this:
First
+------ second
| +------ third
| |
| +---- reply to second
| +
| |
| + reply to reply to second
|
+-- reply to first
etc. etc, but when asked for "next unread message in thread", they
jump to the *deepest* message in the thread first, so you end up
reading the replies to the patches in the wrong order anyway.
For those two reasons, I absolutely loathe deeply nested
in-reply-to chains.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* Re: [PATCH v2 10/14] difftool: add various git-difftool tests
From: David Aguilar @ 2009-04-07 22:38 UTC (permalink / raw)
To: Markus Heidelberg; +Cc: gitster, git, charles
In-Reply-To: <200904071952.21109.markus.heidelberg@web.de>
On 0, Markus Heidelberg <markus.heidelberg@web.de> wrote:
> David Aguilar, 07.04.2009:
> > t7800-difftool.sh tests the various command-line flags,
> > git-config variables, and environment settings supported by
> > git-difftool.
> >
> > Signed-off-by: David Aguilar <davvid@gmail.com>
> > ---
> >
> > The original broke the test suite on Mac OS.
> > Testing difftool.<path>.path is hard without internal support
> > for a fake tool.
>
> Mac OS doesn't have the "echo" command?
>
Hmmm maybe the thing that validates the merge tool isn't
using the $merge_tool_path when validating. All I know is that
it was failing so figured I could add it again later.
--
David
^ permalink raw reply
* [PATCH v4 14/14] difftool/mergetool: refactor commands to use git-mergetool--lib
From: David Aguilar @ 2009-04-07 23:00 UTC (permalink / raw)
To: gitster; +Cc: git, markus.heidelberg, charles, David Aguilar
This consolidates the common functionality from git-mergetool and
git-difftool--helper into a single git-mergetool--lib scriptlet.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Includes latest suggestions from Markus:
* Modify check_unchanged so that it doesn't check merge_mode
* Modify the way $tools is setup so that we fixup duplicated
spaces later
* Fix the status capturing for the custom tool in run_merge_tool
.gitignore | 1 +
Documentation/git-mergetool--lib.txt | 56 +++++
Makefile | 1 +
git-difftool--helper.sh | 186 +----------------
git-mergetool--lib.sh | 381 ++++++++++++++++++++++++++++++++++
git-mergetool.sh | 224 ++-------------------
6 files changed, 461 insertions(+), 388 deletions(-)
create mode 100644 Documentation/git-mergetool--lib.txt
create mode 100644 git-mergetool--lib.sh
diff --git a/.gitignore b/.gitignore
index a36da9d..757c7f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,7 @@ git-merge-recursive
git-merge-resolve
git-merge-subtree
git-mergetool
+git-mergetool--lib
git-mktag
git-mktree
git-name-rev
diff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt
new file mode 100644
index 0000000..3d57031
--- /dev/null
+++ b/Documentation/git-mergetool--lib.txt
@@ -0,0 +1,56 @@
+git-mergetool--lib(1)
+=====================
+
+NAME
+----
+git-mergetool--lib - Common git merge tool shell scriptlets
+
+SYNOPSIS
+--------
+'. "$(git --exec-path)/git-mergetool--lib"'
+
+DESCRIPTION
+-----------
+
+This is not a command the end user would want to run. Ever.
+This documentation is meant for people who are studying the
+Porcelain-ish scripts and/or are writing new ones.
+
+The 'git-mergetool--lib' scriptlet is designed to be sourced (using
+`.`) by other shell scripts to set up functions for working
+with git merge tools.
+
+Before sourcing it, your script should set up a few variables;
+`TOOL_MODE` is used to define the operation mode for various
+functions. 'diff' and 'merge' are valid values.
+
+FUNCTIONS
+---------
+get_merge_tool::
+ returns a merge tool
+
+get_merge_tool_cmd::
+ returns the custom command for a merge tool.
+
+get_merge_tool_path::
+ returns the custom path for a merge tool.
+
+run_merge_tool::
+ launches a merge tool given the tool name and a true/false
+ flag to indicate whether a merge base is present.
+ '$merge_tool', '$merge_tool_path', and for custom commands,
+ '$merge_tool_cmd', must be defined prior to calling
+ run_merge_tool. Additionally, '$MERGED', '$LOCAL', '$REMOTE',
+ and '$BASE' must be defined for use by the merge tool.
+
+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
diff --git a/Makefile b/Makefile
index a80055f..3e56274 100644
--- a/Makefile
+++ b/Makefile
@@ -284,6 +284,7 @@ SCRIPT_SH += git-merge-octopus.sh
SCRIPT_SH += git-merge-one-file.sh
SCRIPT_SH += git-merge-resolve.sh
SCRIPT_SH += git-mergetool.sh
+SCRIPT_SH += git-mergetool--lib.sh
SCRIPT_SH += git-parse-remote.sh
SCRIPT_SH += git-pull.sh
SCRIPT_SH += git-quiltimport.sh
diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
index f3c27d8..b450036 100755
--- a/git-difftool--helper.sh
+++ b/git-difftool--helper.sh
@@ -5,6 +5,10 @@
#
# Copyright (c) 2009 David Aguilar
+# Load common functions from git-mergetool--lib
+TOOL_MODE=diff
+. git-mergetool--lib
+
# difftool.prompt controls the default prompt/no-prompt behavior
# and is overridden with $GIT_DIFFTOOL*_PROMPT.
should_prompt () {
@@ -16,8 +20,7 @@ should_prompt () {
fi
}
-# This function prepares temporary files and launches the appropriate
-# merge tool.
+# Sets up shell variables and runs a merge tool
launch_merge_tool () {
# Merged is the filename as it appears in the work tree
# Local is the contents of a/filename
@@ -37,187 +40,16 @@ launch_merge_tool () {
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)" \
- "$LOCAL" "$REMOTE" \
- > /dev/null 2>&1
- ;;
-
- kompare)
- "$merge_tool_path" "$LOCAL" "$REMOTE"
- ;;
-
- tkdiff)
- "$merge_tool_path" "$LOCAL" "$REMOTE"
- ;;
-
- meld)
- "$merge_tool_path" "$LOCAL" "$REMOTE"
- ;;
-
- diffuse)
- "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
- ;;
-
- vimdiff)
- "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$REMOTE"
- ;;
-
- gvimdiff)
- "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$REMOTE"
- ;;
-
- xxdiff)
- "$merge_tool_path" \
- -R 'Accel.Search: "Ctrl+F"' \
- -R 'Accel.SearchForward: "Ctrl-G"' \
- "$LOCAL" "$REMOTE"
- ;;
-
- opendiff)
- "$merge_tool_path" "$LOCAL" "$REMOTE" | 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
-}
-
-# Verifies that (difftool|mergetool).<tool>.cmd exists
-valid_custom_tool() {
- merge_tool_cmd="$(git config difftool.$1.cmd)"
- test -z "$merge_tool_cmd" &&
- 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 | kompare | 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 difftool.<tool>.path configuration.
-# This also falls back to mergetool defaults.
-init_merge_tool_path() {
- merge_tool_path=$(git config difftool."$1".path)
- test -z "$merge_tool_path" &&
- merge_tool_path=$(git config mergetool."$1".path)
- if test -z "$merge_tool_path"; then
- case "$1" in
- vimdiff)
- merge_tool_path=vim
- ;;
- gvimdiff)
- merge_tool_path=gvim
- ;;
- emerge)
- merge_tool_path=emacs
- ;;
- *)
- merge_tool_path="$1"
- ;;
- esac
- fi
+ run_merge_tool "$merge_tool"
}
# Allow GIT_DIFF_TOOL and GIT_MERGE_TOOL to provide default values
test -n "$GIT_MERGE_TOOL" && merge_tool="$GIT_MERGE_TOOL"
test -n "$GIT_DIFF_TOOL" && merge_tool="$GIT_DIFF_TOOL"
-# If merge tool was not specified then use the diff.tool
-# configuration variable. If that's invalid then reset merge_tool.
-# Fallback to merge.tool.
-if test -z "$merge_tool"; then
- merge_tool=$(git config diff.tool)
- test -z "$merge_tool" &&
- merge_tool=$(git config merge.tool)
- if test -n "$merge_tool" && ! valid_tool "$merge_tool"; then
- echo >&2 "git config option diff.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
- # If gnome then prefer meld, otherwise, prefer kdiff3 or kompare
- if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
- merge_tool_candidates="meld kdiff3 kompare tkdiff xxdiff gvimdiff diffuse"
- else
- merge_tool_candidates="kdiff3 kompare tkdiff xxdiff meld gvimdiff diffuse"
- fi
- fi
- if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
- # $EDITOR is emacs so add emerge as a candidate
- merge_tool_candidates="$merge_tool_candidates emerge opendiff vimdiff"
- elif echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
- # $EDITOR is vim so add vimdiff as a candidate
- merge_tool_candidates="$merge_tool_candidates vimdiff opendiff emerge"
- else
- merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
- fi
- 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
-
+merge_tool=$(get_merge_tool "$merge_tool") || exit
+merge_tool_cmd="$(get_merge_tool_cmd "$merge_tool")"
+merge_tool_path="$(get_merge_tool_path "$merge_tool")" || exit
# Launch the merge tool on each path provided by 'git diff'
while test $# -gt 6
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
new file mode 100644
index 0000000..95cc355
--- /dev/null
+++ b/git-mergetool--lib.sh
@@ -0,0 +1,381 @@
+# git-mergetool--lib is a library for common merge tool functions
+diff_mode() {
+ test "$TOOL_MODE" = diff
+}
+
+merge_mode() {
+ test "$TOOL_MODE" = merge
+}
+
+translate_merge_tool_path () {
+ if test -n "$2"; then
+ echo "$2"
+ else
+ case "$1" in
+ vimdiff)
+ path=vim
+ ;;
+ gvimdiff)
+ path=gvim
+ ;;
+ emerge)
+ path=emacs
+ ;;
+ *)
+ path="$1"
+ ;;
+ esac
+ echo "$path"
+ fi
+}
+
+check_unchanged () {
+ if test "$MERGED" -nt "$BACKUP"; then
+ status=0
+ else
+ while true; do
+ echo "$MERGED seems unchanged."
+ printf "Was the merge successful? [y/n] "
+ read answer < /dev/tty
+ case "$answer" in
+ y*|Y*) status=0; break ;;
+ n*|N*) status=1; break ;;
+ esac
+ done
+ fi
+}
+
+valid_tool () {
+ case "$1" in
+ kdiff3 | tkdiff | xxdiff | meld | opendiff | \
+ emerge | vimdiff | gvimdiff | ecmerge | diffuse)
+ ;; # happy
+ tortoisemerge)
+ if ! merge_mode; then
+ return 1
+ fi
+ ;;
+ kompare)
+ if ! diff_mode; then
+ return 1
+ fi
+ ;;
+ *)
+ if test -z "$(get_merge_tool_cmd "$1")"; then
+ return 1
+ fi
+ ;;
+ esac
+}
+
+get_merge_tool_cmd () {
+ diff_mode &&
+ custom_cmd="$(git config difftool.$1.cmd)"
+ test -z "$custom_cmd" &&
+ custom_cmd="$(git config mergetool.$1.cmd)"
+ test -n "$custom_cmd" &&
+ echo "$custom_cmd"
+}
+
+run_merge_tool () {
+ base_present="$2"
+ status=0
+
+ case "$1" in
+ kdiff3)
+ if merge_mode; then
+ if $base_present; then
+ ("$merge_tool_path" --auto \
+ --L1 "$MERGED (Base)" \
+ --L2 "$MERGED (Local)" \
+ --L3 "$MERGED (Remote)" \
+ -o "$MERGED" \
+ "$BASE" "$LOCAL" "$REMOTE" \
+ > /dev/null 2>&1)
+ else
+ ("$merge_tool_path" --auto \
+ --L1 "$MERGED (Local)" \
+ --L2 "$MERGED (Remote)" \
+ -o "$MERGED" \
+ "$LOCAL" "$REMOTE" \
+ > /dev/null 2>&1)
+ fi
+ status=$?
+ else
+ ("$merge_tool_path" --auto \
+ --L1 "$MERGED (A)" \
+ --L2 "$MERGED (B)" "$LOCAL" "$REMOTE" \
+ > /dev/null 2>&1)
+ fi
+ ;;
+ kompare)
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ ;;
+ tkdiff)
+ if merge_mode; then
+ if $base_present; then
+ "$merge_tool_path" -a "$BASE" \
+ -o "$MERGED" "$LOCAL" "$REMOTE"
+ else
+ "$merge_tool_path" \
+ -o "$MERGED" "$LOCAL" "$REMOTE"
+ fi
+ status=$?
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ meld)
+ if merge_mode; then
+ touch "$BACKUP"
+ "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ diffuse)
+ if merge_mode; then
+ touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" \
+ "$LOCAL" "$MERGED" "$REMOTE" \
+ "$BASE" | cat
+ else
+ "$merge_tool_path" \
+ "$LOCAL" "$MERGED" "$REMOTE" | cat
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+ fi
+ ;;
+ vimdiff)
+ if merge_mode; then
+ touch "$BACKUP"
+ "$merge_tool_path" -d -c "wincmd l" \
+ "$LOCAL" "$MERGED" "$REMOTE"
+ check_unchanged
+ else
+ "$merge_tool_path" -d -c "wincmd l" \
+ "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ gvimdiff)
+ if merge_mode; then
+ touch "$BACKUP"
+ "$merge_tool_path" -d -c "wincmd l" -f \
+ "$LOCAL" "$MERGED" "$REMOTE"
+ check_unchanged
+ else
+ "$merge_tool_path" -d -c "wincmd l" -f \
+ "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ xxdiff)
+ if merge_mode; then
+ touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" -X --show-merged-pane \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$MERGED" \
+ "$LOCAL" "$BASE" "$REMOTE"
+ else
+ "$merge_tool_path" -X $extra \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$MERGED" \
+ "$LOCAL" "$REMOTE"
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ "$LOCAL" "$REMOTE"
+ fi
+ ;;
+ opendiff)
+ if merge_mode; then
+ touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ -ancestor "$BASE" \
+ -merge "$MERGED" | cat
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ -merge "$MERGED" | cat
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+ fi
+ ;;
+ ecmerge)
+ if merge_mode; then
+ touch "$BACKUP"
+ if $base_present; then
+ "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
+ --default --mode=merge3 --to="$MERGED"
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ --default --mode=merge2 --to="$MERGED"
+ fi
+ check_unchanged
+ else
+ "$merge_tool_path" "$LOCAL" "$REMOTE" \
+ --default --mode=merge2 --to="$MERGED"
+ fi
+ ;;
+ emerge)
+ if merge_mode; then
+ if $base_present; then
+ "$merge_tool_path" \
+ -f emerge-files-with-ancestor-command \
+ "$LOCAL" "$REMOTE" "$BASE" \
+ "$(basename "$MERGED")"
+ else
+ "$merge_tool_path" \
+ -f emerge-files-command \
+ "$LOCAL" "$REMOTE" \
+ "$(basename "$MERGED")"
+ fi
+ status=$?
+ else
+ "$merge_tool_path" -f emerge-files-command \
+ "$LOCAL" "$REMOTE" "$(basename "$MERGED")"
+ fi
+ ;;
+ tortoisemerge)
+ if $base_present; then
+ touch "$BACKUP"
+ "$merge_tool_path" \
+ -base:"$BASE" -mine:"$LOCAL" \
+ -theirs:"$REMOTE" -merged:"$MERGED"
+ check_unchanged
+ else
+ echo "TortoiseMerge cannot be used without a base" 1>&2
+ status=1
+ fi
+ ;;
+ *)
+ if test -z "$merge_tool_cmd"; then
+ if merge_mode; then
+ status=1
+ fi
+ break
+ fi
+ if merge_mode; then
+ if test "$merge_tool_trust_exit_code" = "false"; then
+ touch "$BACKUP"
+ ( eval $merge_tool_cmd )
+ check_unchanged
+ else
+ ( eval $merge_tool_cmd )
+ status=$?
+ fi
+ else
+ ( eval $merge_tool_cmd )
+ fi
+ ;;
+ esac
+ return $status
+}
+
+guess_merge_tool () {
+ tools="ecmerge"
+ if merge_mode; then
+ tools="$tools tortoisemerge"
+ else
+ kompare="kompare"
+ fi
+ if test -n "$DISPLAY"; then
+ if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
+ tools="meld opendiff kdiff3 $kompare tkdiff $tools"
+ tools="$tools xxdiff gvimdiff diffuse"
+ else
+ tools="opendiff kdiff3 $kompare tkdiff xxdiff $tools"
+ tools="$tools meld gvimdiff diffuse"
+ fi
+ fi
+ if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
+ # $EDITOR is emacs so add emerge as a candidate
+ tools="$tools emerge vimdiff"
+ elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then
+ # $EDITOR is vim so add vimdiff as a candidate
+ tools="$tools vimdiff emerge"
+ else
+ tools="$tools emerge vimdiff"
+ fi
+ tools="$(echo "$tools" | sed -e 's/ +/ /g')"
+ echo >&2 "merge tool candidates: $tools"
+
+ # Loop over each candidate and stop when a valid merge tool is found.
+ for i in $tools
+ do
+ merge_tool_path="$(translate_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 >&2 "No known merge resolution program available."
+ return 1
+ fi
+ echo "$merge_tool"
+}
+
+get_configured_merge_tool () {
+ # Diff mode first tries diff.tool and falls back to merge.tool.
+ # Merge mode only checks merge.tool
+ if diff_mode; then
+ tool=$(git config diff.tool)
+ fi
+ if test -z "$tool"; then
+ tool=$(git config merge.tool)
+ fi
+ if test -n "$merge_tool" && ! valid_tool "$merge_tool"; then
+ echo >&2 "git config option $TOOL_MODE.tool set to unknown tool: $merge_tool"
+ echo >&2 "Resetting to default..."
+ return 1
+ fi
+ echo "$tool"
+}
+
+get_merge_tool_path () {
+ # 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
+ if diff_mode; then
+ merge_tool_path=$(git config difftool."$merge_tool".path)
+ fi
+ if test -z "$merge_tool_path"; then
+ merge_tool_path=$(git config mergetool."$merge_tool".path)
+ fi
+ merge_tool_path="$(translate_merge_tool_path "$merge_tool" "$merge_tool_path")"
+ if test -z "$merge_tool_cmd" && ! type "$merge_tool_path" > /dev/null 2>&1; then
+ echo >&2 "The $TOOL_MODE tool $merge_tool is not available as '$merge_tool_path'"
+ exit 1
+ fi
+ echo "$merge_tool_path"
+}
+
+get_merge_tool () {
+ merge_tool="$1"
+ # Check if a merge tool has been configured
+ if test -z "$merge_tool"; then
+ merge_tool=$(get_configured_merge_tool)
+ fi
+ # Try to guess an appropriate merge tool if no tool has been set.
+ if test -z "$merge_tool"; then
+ merge_tool=$(guess_merge_tool) || exit
+ fi
+ echo "$merge_tool"
+}
diff --git a/git-mergetool.sh b/git-mergetool.sh
index cceebb7..efa31a2 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -11,7 +11,9 @@
USAGE='[--tool=tool] [-y|--no-prompt|--prompt] [file to merge] ...'
SUBDIRECTORY_OK=Yes
OPTIONS_SPEC=
+TOOL_MODE=merge
. git-sh-setup
+. git-mergetool--lib
require_work_tree
# Returns true if the mode reflects a symlink
@@ -110,22 +112,6 @@ resolve_deleted_merge () {
done
}
-check_unchanged () {
- if test "$MERGED" -nt "$BACKUP" ; then
- status=0;
- else
- while true; do
- echo "$MERGED seems unchanged."
- printf "Was the merge successful? [y/n] "
- read answer < /dev/tty
- case "$answer" in
- y*|Y*) status=0; break ;;
- n*|N*) status=1; break ;;
- esac
- done
- fi
-}
-
checkout_staged_file () {
tmpfile=$(expr "$(git checkout-index --temp --stage="$1" "$2")" : '\([^ ]*\) ')
@@ -188,107 +174,11 @@ merge_file () {
read ans
fi
- case "$merge_tool" in
- kdiff3)
- if base_present ; then
- ("$merge_tool_path" --auto --L1 "$MERGED (Base)" --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" \
- -o "$MERGED" "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
- else
- ("$merge_tool_path" --auto --L1 "$MERGED (Local)" --L2 "$MERGED (Remote)" \
- -o "$MERGED" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
- fi
- status=$?
- ;;
- tkdiff)
- if base_present ; then
- "$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"
- else
- "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
- fi
- status=$?
- ;;
- meld)
- touch "$BACKUP"
- "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
- check_unchanged
- ;;
- vimdiff)
- touch "$BACKUP"
- "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
- check_unchanged
- ;;
- gvimdiff)
- touch "$BACKUP"
- "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
- check_unchanged
- ;;
- xxdiff)
- touch "$BACKUP"
- if base_present ; then
- "$merge_tool_path" -X --show-merged-pane \
- -R 'Accel.SaveAsMerged: "Ctrl-S"' \
- -R 'Accel.Search: "Ctrl+F"' \
- -R 'Accel.SearchForward: "Ctrl-G"' \
- --merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
- else
- "$merge_tool_path" -X --show-merged-pane \
- -R 'Accel.SaveAsMerged: "Ctrl-S"' \
- -R 'Accel.Search: "Ctrl+F"' \
- -R 'Accel.SearchForward: "Ctrl-G"' \
- --merged-file "$MERGED" "$LOCAL" "$REMOTE"
- fi
- check_unchanged
- ;;
- opendiff)
- touch "$BACKUP"
- if base_present; then
- "$merge_tool_path" "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED" | cat
- else
- "$merge_tool_path" "$LOCAL" "$REMOTE" -merge "$MERGED" | cat
- fi
- check_unchanged
- ;;
- ecmerge)
- touch "$BACKUP"
- if base_present; then
- "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" --default --mode=merge3 --to="$MERGED"
- else
- "$merge_tool_path" "$LOCAL" "$REMOTE" --default --mode=merge2 --to="$MERGED"
- fi
- check_unchanged
- ;;
- emerge)
- if base_present ; then
- "$merge_tool_path" -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$(basename "$MERGED")"
- else
- "$merge_tool_path" -f emerge-files-command "$LOCAL" "$REMOTE" "$(basename "$MERGED")"
- fi
- status=$?
- ;;
- tortoisemerge)
- if base_present ; then
- touch "$BACKUP"
- "$merge_tool_path" -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"
- check_unchanged
- else
- echo "TortoiseMerge cannot be used without a base" 1>&2
- status=1
- fi
- ;;
- *)
- if test -n "$merge_tool_cmd"; then
- if test "$merge_tool_trust_exit_code" = "false"; then
- touch "$BACKUP"
- ( eval $merge_tool_cmd )
- check_unchanged
- else
- ( eval $merge_tool_cmd )
- status=$?
- fi
- fi
- ;;
- esac
- if test "$status" -ne 0; then
+ present=false
+ base_present &&
+ present=true
+
+ if ! run_merge_tool "$merge_tool" "$present"; then
echo "merge of $MERGED failed" 1>&2
mv -- "$BACKUP" "$MERGED"
@@ -347,44 +237,6 @@ do
shift
done
-valid_custom_tool()
-{
- merge_tool_cmd="$(git config mergetool.$1.cmd)"
- test -n "$merge_tool_cmd"
-}
-
-valid_tool() {
- case "$1" in
- kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge | tortoisemerge)
- ;; # happy
- *)
- if ! valid_custom_tool "$1"; then
- return 1
- fi
- ;;
- esac
-}
-
-init_merge_tool_path() {
- merge_tool_path=$(git config mergetool.$1.path)
- if test -z "$merge_tool_path" ; then
- case "$1" in
- vimdiff)
- merge_tool_path=vim
- ;;
- gvimdiff)
- merge_tool_path=gvim
- ;;
- emerge)
- merge_tool_path=emacs
- ;;
- *)
- merge_tool_path=$1
- ;;
- esac
- fi
-}
-
prompt_after_failed_merge() {
while true; do
printf "Continue merging other unresolved paths (y/n) ? "
@@ -402,62 +254,12 @@ prompt_after_failed_merge() {
done
}
-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
-
-if test -z "$merge_tool" ; then
- if test -n "$DISPLAY"; then
- if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
- merge_tool_candidates="meld kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse"
- else
- merge_tool_candidates="kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse"
- fi
- fi
- if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
- merge_tool_candidates="$merge_tool_candidates emerge opendiff vimdiff"
- elif echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
- merge_tool_candidates="$merge_tool_candidates vimdiff opendiff emerge"
- else
- merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
- fi
- echo "merge tool candidates: $merge_tool_candidates"
- 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
- if ! valid_tool "$merge_tool"; then
- echo >&2 "Unknown merge_tool $merge_tool"
- exit 1
- fi
-
- init_merge_tool_path "$merge_tool"
-
- merge_keep_backup="$(git config --bool merge.keepBackup || echo true)"
- merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
-
- 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
-
- if ! test -z "$merge_tool_cmd"; then
- merge_tool_trust_exit_code="$(git config --bool mergetool.$merge_tool.trustExitCode || echo false)"
- fi
-fi
+merge_tool=$(get_merge_tool "$merge_tool") || exit
+merge_tool_cmd="$(get_merge_tool_cmd "$merge_tool")"
+merge_tool_path="$(get_merge_tool_path "$merge_tool")" || exit
+merge_keep_backup="$(git config --bool merge.keepBackup || echo true)"
+merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
+merge_tool_trust_exit_code="$(git config --bool mergetool."$merge_tool".trustExitCode || echo false)"
last_status=0
rollup_status=0
--
1.6.1.3
^ permalink raw reply related
* Re: [PATCH RFC 1/6] send-email: Add --delay for separating emails
From: Junio C Hamano @ 2009-04-07 23:17 UTC (permalink / raw)
To: Michael Witten; +Cc: git
In-Reply-To: <1239139522-24118-1-git-send-email-mfwitten@gmail.com>
Michael Witten <mfwitten@gmail.com> writes:
> When sending a patch series, the emails often arrive at the final
> destination out of order; though these emails should be chained
> via the In-Reply-To headers, some mail-viewing systems display
> by order of arrival instead.
>
> The --delay option provides a means for specifying that there
> should be a certain number of seconds of delay between sending
> emails, so that the arrival order can be controlled better.
If you are trying to force the order of messages that the client MUA
physically receives the messages, I do not think giving N second
interval at the sending end would help much in the real world. Between
your submitting MUA (that's "git-send-email") and the client MUA, there
are many hops involved:
* Your outgoing MSA (typically your ISP's sendmail) your MUA hands
messages to;
* Your ISP's internal mail routing chain of MTAs that forward the
messages around;
* The recipient's ISP's incoming MTA that receives the messages from
your ISP's outgoing MTA;
* The recipient's ISP's internal mail routing chain of MTAs that
forward the messages around, until they reach...
* ... the mailbox at recipient's ISP that stores the messages until the
recipient picks them up;
* And finally the recipient's MUA that reads from the mailbox.
Messages your MUA sends out can take different paths in the above chain
even though the final destination (mailbox at the recipient's ISP) may
be the same, and different mailpaths can and do have different
latencies. Even if all the messages sent out by a single invocation of
your submitting MUA happened to take the same mailpath, any single hop
can batch the messages that arrive within a small time window before
passing them to the next hop, and it can reorder the messages when it
does so.
In short, the only thing your --delay can control is the arrival
interval at your outgoing MSA. The arrival interval and order of
messages are outside your control for later hops.
On the other hand, I think send-email already has hacks to timestamp the
messages at least one-second apart by shifting the Date: field, so that
the recipient MUA can sort by the departure timestamp if it wants to (and
if it can), instead of the arrival timestamp. Is it not working well for
you?
^ permalink raw reply
* Re: [PATCH RFC 2/6] send-email: --smtp-server-port should take an integer
From: Junio C Hamano @ 2009-04-07 23:20 UTC (permalink / raw)
To: Michael Witten; +Cc: git
In-Reply-To: <1239139522-24118-2-git-send-email-mfwitten@gmail.com>
I think this makes sense but you made it depend on your --delay patch, so
it won't apply without wiggling the patch by hand.
I can do that, but a good rule of thumb when preparing a series is to have
this kind of obvious clean-up first, leaving enhancement patches later in
the series.
^ permalink raw reply
* [PATCH v3 10/14] difftool: add various git-difftool tests
From: David Aguilar @ 2009-04-07 23:30 UTC (permalink / raw)
To: gitster; +Cc: git, markus.heidelberg, charles, David Aguilar
t7800-difftool.sh tests the various command-line flags,
git-config variables, and environment settings supported by
git-difftool.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
The original problem on Mac OS was that 'wc -l'
returned differently formatted results.
t/t7800-difftool.sh | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 147 insertions(+), 0 deletions(-)
create mode 100755 t/t7800-difftool.sh
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
new file mode 100755
index 0000000..2699226
--- /dev/null
+++ b/t/t7800-difftool.sh
@@ -0,0 +1,147 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 David Aguilar
+#
+
+test_description='git-difftool
+
+Testing basic diff tool invocation
+'
+
+. ./test-lib.sh
+
+remove_config_vars()
+{
+ # Unset all config variables used by git-difftool
+ git config --unset diff.tool
+ git config --unset difftool.test-tool.cmd
+ git config --unset merge.tool
+ git config --unset mergetool.test-tool.cmd
+ return 0
+}
+
+restore_test_defaults()
+{
+ # Restores the test defaults used by several tests
+ remove_config_vars
+ unset GIT_DIFF_TOOL
+ unset GIT_MERGE_TOOL
+ unset GIT_DIFFTOOL_NO_PROMPT
+ git config diff.tool test-tool &&
+ git config difftool.test-tool.cmd 'cat $LOCAL'
+}
+
+# Create a file on master and change it on branch
+test_expect_success 'setup' '
+ echo master >file &&
+ git add file &&
+ git commit -m "added file" &&
+
+ git checkout -b branch master &&
+ echo branch >file &&
+ git commit -a -m "branch changed file" &&
+ git checkout master
+'
+
+# Configure a custom difftool.<tool>.cmd and use it
+test_expect_success 'custom commands' '
+ restore_test_defaults &&
+ git config difftool.test-tool.cmd "cat \$REMOTE" &&
+
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "master" &&
+
+ restore_test_defaults &&
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch"
+'
+
+# Ensures that git-difftool ignores bogus --tool values
+test_expect_success 'difftool ignores bad --tool values' '
+ diff=$(git difftool --no-prompt --tool=bogus-tool branch)
+ test "$?" = 1 &&
+ test "$diff" = ""
+'
+
+# Specify the diff tool using $GIT_DIFF_TOOL
+test_expect_success 'GIT_DIFF_TOOL variable' '
+ git config --unset diff.tool
+ GIT_DIFF_TOOL=test-tool &&
+ export GIT_DIFF_TOOL &&
+
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch" &&
+
+ restore_test_defaults
+'
+
+# Test the $GIT_*_TOOL variables and ensure
+# that $GIT_DIFF_TOOL always wins unless --tool is specified
+test_expect_success 'GIT_DIFF_TOOL overrides' '
+ git config diff.tool bogus-tool &&
+ git config merge.tool bogus-tool &&
+
+ GIT_MERGE_TOOL=test-tool &&
+ export GIT_MERGE_TOOL &&
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch" &&
+ unset GIT_MERGE_TOOL &&
+
+ GIT_MERGE_TOOL=bogus-tool &&
+ GIT_DIFF_TOOL=test-tool &&
+ export GIT_MERGE_TOOL &&
+ export GIT_DIFF_TOOL &&
+
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch" &&
+
+ GIT_DIFF_TOOL=bogus-tool &&
+ export GIT_DIFF_TOOL &&
+
+ diff=$(git difftool --no-prompt --tool=test-tool branch) &&
+ test "$diff" = "branch" &&
+
+ restore_test_defaults
+'
+
+# Test that we don't have to pass --no-prompt to difftool
+# when $GIT_DIFFTOOL_NO_PROMPT is true
+test_expect_success 'GIT_DIFFTOOL_NO_PROMPT variable' '
+ GIT_DIFFTOOL_NO_PROMPT=true &&
+ export GIT_DIFFTOOL_NO_PROMPT &&
+
+ diff=$(git difftool branch) &&
+ test "$diff" = "branch" &&
+
+ restore_test_defaults
+'
+
+# git-difftool falls back to git-mergetool config variables
+# so test that behavior here
+test_expect_success 'difftool + mergetool config variables' '
+ remove_config_vars
+ git config merge.tool test-tool &&
+ git config mergetool.test-tool.cmd "cat \$LOCAL" &&
+
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch" &&
+
+ # set merge.tool to something bogus, diff.tool to test-tool
+ git config merge.tool bogus-tool &&
+ git config diff.tool test-tool &&
+
+ diff=$(git difftool --no-prompt branch) &&
+ test "$diff" = "branch" &&
+
+ restore_test_defaults
+'
+
+test_expect_success 'difftool.<tool>.path' '
+ git config difftool.tkdiff.path echo &&
+ diff=$(git difftool --tool=tkdiff --no-prompt branch) &&
+ git config --unset difftool.tkdiff.path &&
+ lines=$(echo "$diff" | grep file | wc -l) &&
+ test "$lines" -eq 1
+'
+
+test_done
--
1.6.1.3
^ permalink raw reply related
* Re: [PATCH v2 10/14] difftool: add various git-difftool tests
From: David Aguilar @ 2009-04-07 23:32 UTC (permalink / raw)
To: Markus Heidelberg; +Cc: gitster, git, charles
In-Reply-To: <200904071952.21109.markus.heidelberg@web.de>
On 0, Markus Heidelberg <markus.heidelberg@web.de> wrote:
> David Aguilar, 07.04.2009:
> > t7800-difftool.sh tests the various command-line flags,
> > git-config variables, and environment settings supported by
> > git-difftool.
> >
> > Signed-off-by: David Aguilar <davvid@gmail.com>
> > ---
> >
> > The original broke the test suite on Mac OS.
> > Testing difftool.<path>.path is hard without internal support
> > for a fake tool.
>
> Mac OS doesn't have the "echo" command?
>
I figured it out.
The test was using wc -l.
On Mac OS the results are formatted differently (leading spaces)
so I modified the test to be more robust.
See [PATCH v3 10/14].
--
David
^ permalink raw reply
* Re: [PATCH RFC 6/6] send-email: Remove horrible mix of tabs and spaces
From: Tomas Carnecky @ 2009-04-07 23:33 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Jeff King, Michael Witten, demerphq, git
In-Reply-To: <49DBCF5D.6070404@op5.se>
On Apr 8, 2009, at 12:10 AM, Andreas Ericsson wrote:
> 3. Make it capable of sending email directly from commits rather than
> than having to generate them as files first. For bonus-points, use
This is already possible:
git send-email [options] <file|directory|rev-list options>
You can pass it a rev-list and it will generate the patches on its own.
> git sequencer or some other "git rebase -i"-esque mangling thing
> first, with capabilities of adding a cover-letter for patch-series.
tom
^ permalink raw reply
* Re: [PATCH v2] git-pull.sh: better warning message for "git pull" on detached head.
From: Junio C Hamano @ 2009-04-08 0:43 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Finn Arne Gangstad, git
In-Reply-To: <vpqvdpgn19y.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> Grepping the source, "not on a branch" seems more widely used than
> "detached head" in the UI (including in another place of git-pull.sh),
> so, yes, something like this would be better:
Yeah, "not on a branch" sounds like the best wording.
^ permalink raw reply
* Re: [PATCH] mailmap: resurrect lower-casing of email addresses
From: A Large Angry SCM @ 2009-04-08 0:50 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0904071315460.6897@intel-tinevez-2-302>
[CC list trimmed since I don't Junio is that interested in what this
thread has morphed into.]
Johannes Schindelin wrote:
> Hi,
>
> On Mon, 6 Apr 2009, A Large Angry SCM wrote:
>
>> Johannes Schindelin wrote:
>>
>>> On Fri, 3 Apr 2009, A Large Angry SCM wrote:
>>>
>>>> Sorry, this is not a flame war (and as Peff already sent a response
>>>> that superior to my own) so I'll let Junio decide.
>>> Thanks for keeping a cool head where I failed. My sincere apologies.
>>>
>>>> However, to keep the peace (and as a thank you for all the hard work
>>>> to date, I'll say that I'm scheduled to be be Germany and Munich the
>>>> first 10 days in October and I'll buy the first $100 dollars in
>>>> drinks at any meet that participate in (as a thank you to all the
>>>> hard work for git that has been performed) that may happen that I
>>>> participate in).
>>> I'll take you up on that!
>> s/Germany and Munich/Berlin and Munich/
>
> Cool! Berlin is only 2 hours from my home, so let's meet there!
>
> We could even use the opportunity for a little informal German
> GitTogether... "Alles wird Git!"?
Could you translate that for the Deutsch-challenged among us?
According to the /current/ itinerary, the evenings I have free in Berlin
are Saturday Oct 3 and Monday Oct 5.
^ permalink raw reply
* Any way to edit the file in index directly?
From: Ping Yin @ 2009-04-08 1:03 UTC (permalink / raw)
To: git mailing list
There seems to be a patch for this ( add -e?), but i forget where to find it.
For a big change, instead of "add -p", it may be easier to edit the
index directly ( with the corresponding worktree file alongside)
Ping Yin
^ permalink raw reply
* [PATCH] Add a simple getpass() for MinGW
From: Johannes Schindelin @ 2009-04-08 1:30 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt, gitster
In-Reply-To: <cover.1239154140u.git.johannes.schindelin@gmx.de>
This should be replaced with a graphical getpass() at some stage.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
I saw it coming that I had to do this.
compat/mingw.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index d50186e..2ab5bbe 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1157,3 +1157,18 @@ int link(const char *oldpath, const char *newpath)
}
return 0;
}
+
+char *getpass(const char *prompt)
+{
+ struct strbuf buf = STRBUF_INIT;
+
+ fputs(prompt, stderr);
+ for (;;) {
+ char c = _getch();
+ if (c == '\r' || c == '\n')
+ break;
+ strbuf_addch(&buf, c);
+ }
+ fputs("\n", stderr);
+ return strbuf_detach(&buf, NULL);
+}
--
1.6.2.1.613.g25746
^ permalink raw reply related
* Re: [PATCH RFC 6/6] send-email: Remove horrible mix of tabs and spaces
From: Jeff King @ 2009-04-08 2:02 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Michael Witten, demerphq, git
In-Reply-To: <49DBCF5D.6070404@op5.se>
On Wed, Apr 08, 2009 at 12:10:37AM +0200, Andreas Ericsson wrote:
>> 2. Make a new command to compete with send-email instead of using the
>> same name. This means that people who are really put off by
>> CPAN dependencies from (1) above won't be negatively impacted. And
>> you can drop any historical interface warts if you want to.
>>
>
> 3. Make it capable of sending email directly from commits rather than
> than having to generate them as files first. For bonus-points, use
> git sequencer or some other "git rebase -i"-esque mangling thing
> first, with capabilities of adding a cover-letter for patch-series.
As Tomas noted, this is already possible (this was due to some patches
from Pierre a few months ago, I think). But IIRC, there are some corner
cases where send-email has to guess whether you mean rev-list options or
a file (or maybe there is some way to signal, I don't remember). And
that is exactly the sort of thing that you could clean up via (2) above.
-Peff
^ permalink raw reply
* Re: Any way to edit the file in index directly?
From: Jeff King @ 2009-04-08 2:10 UTC (permalink / raw)
To: Ping Yin; +Cc: git mailing list
In-Reply-To: <46dff0320904071803k68fddff4j226760392e0c5bcc@mail.gmail.com>
On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
> There seems to be a patch for this ( add -e?), but i forget where to
> find it.
"add -p" has an "e"dit option for editing the patch. I don't recall any
way of directly editing the content.
> For a big change, instead of "add -p", it may be easier to edit the
> index directly ( with the corresponding worktree file alongside)
I'm not sure what you mean by "alongside". If you mean "by editing a
temporary file that corresponds to the index file without munging your
worktree file", then you can do:
FILE=foo.c
git show :$FILE >$FILE.tmp
$EDITOR $FILE.tmp
object=`git hash-object -w $FILE.tmp`
git update-index --cacheinfo 100644 $object $FILE
And obviously you could make a script for that if you wanted (but at the
very least, you would need quotes to handle files with spaces, and
probably some magic to handle smudge/clean filters and CRLF properly for
the tempfile).
-Peff
^ permalink raw reply
* Re: [PATCH] git-svn: add fetch --parent option
From: Eric Wong @ 2009-04-08 2:14 UTC (permalink / raw)
To: Jason Merrill; +Cc: git
In-Reply-To: <49DA6827.9020204@redhat.com>
Jason Merrill <jason@redhat.com> wrote:
> Signed-off-by: Jason Merrill <jason@redhat.com>
> ---
> rebase fetches only the SVN parent of the current HEAD; it should
> be possible to do that with fetch as well, for instance to support
> rebasing with stg rebase rather than git rebase.
Hi Jason, the above should be in the commit message.
Otherwise, Acked-by: Eric Wong <normalperson@yhbt.net>
Thanks
> Documentation/git-svn.txt | 3 +++
> git-svn.perl | 18 ++++++++++++++----
> 2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index b7b1af8..85b2c8d 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -97,6 +97,9 @@ COMMANDS
> makes 'git-log' (even without --date=local) show the same times
> that `svn log` would in the local timezone.
>
> +--parent;;
> + Fetch only from the SVN parent of the current HEAD.
> +
> 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
> diff --git a/git-svn.perl b/git-svn.perl
> index d919798..cb718b8 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -63,7 +63,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
> my ($_stdin, $_help, $_edit,
> $_message, $_file,
> $_template, $_shared,
> - $_version, $_fetch_all, $_no_rebase,
> + $_version, $_fetch_all, $_no_rebase, $_fetch_parent,
> $_merge, $_strategy, $_dry_run, $_local,
> $_prefix, $_no_checkout, $_url, $_verbose,
> $_git_format, $_commit_url, $_tag);
> @@ -112,6 +112,7 @@ my %cmd = (
> fetch => [ \&cmd_fetch, "Download new revisions from SVN",
> { 'revision|r=s' => \$_revision,
> 'fetch-all|all' => \$_fetch_all,
> + 'parent|p' => \$_fetch_parent,
> %fc_opts } ],
> clone => [ \&cmd_clone, "Initialize and fetch revisions",
> { 'revision|r=s' => \$_revision,
> @@ -381,12 +382,21 @@ sub cmd_fetch {
> }
> my ($remote) = @_;
> if (@_ > 1) {
> - die "Usage: $0 fetch [--all] [svn-remote]\n";
> + die "Usage: $0 fetch [--all] [--parent] [svn-remote]\n";
> }
> - $remote ||= $Git::SVN::default_repo_id;
> - if ($_fetch_all) {
> + if ($_fetch_parent) {
> + my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
> + unless ($gs) {
> + die "Unable to determine upstream SVN information from ",
> + "working tree history\n";
> + }
> + # just fetch, don't checkout.
> + $_no_checkout = 'true';
> + $_fetch_all ? $gs->fetch_all : $gs->fetch;
> + } elsif ($_fetch_all) {
> cmd_multi_fetch();
> } else {
> + $remote ||= $Git::SVN::default_repo_id;
> Git::SVN::fetch_all($remote, Git::SVN::read_all_remotes());
> }
> }
> --
^ permalink raw reply
* Re: Any way to edit the file in index directly?
From: Jeff King @ 2009-04-08 2:16 UTC (permalink / raw)
To: Ping Yin; +Cc: git mailing list
In-Reply-To: <20090408021041.GB18244@coredump.intra.peff.net>
On Tue, Apr 07, 2009 at 10:10:41PM -0400, Jeff King wrote:
> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>
> > There seems to be a patch for this ( add -e?), but i forget where to
> > find it.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
Hmm, actually maybe you are thinking of:
http://article.gmane.org/gmane.comp.version-control.git/103389
which I even reviewed, but it doesn't seem to have gone anywhere after
that.
-Peff
^ permalink raw reply
* Re: [PATCH 1/3] git remote update: Report error for non-existing groups
From: Junio C Hamano @ 2009-04-08 2:16 UTC (permalink / raw)
To: Finn Arne Gangstad; +Cc: git
In-Reply-To: <1239025262-16960-2-git-send-email-finnag@pvv.org>
Finn Arne Gangstad <finnag@pvv.org> writes:
> @@ -1227,8 +1229,11 @@ static int update(int argc, const char **argv)
>
> remote_group.list = &list;
> for (i = 1; i < argc; i++) {
> + int groups_found = 0;
> remote_group.name = argv[i];
> - result = git_config(get_remote_group, NULL);
> + result = git_config(get_remote_group, &groups_found);
> + if (!groups_found && (i != 1 || strcmp(argv[1], "default")))
> + die("No such remote group: '%s'", argv[i]);
I think you are trying to be silent about the case where the caller feeds
you the default_argv[] array with this, but do we want to be more explicit
about this so that we do die when the end user explicitly says "default"
from the command line?
^ permalink raw reply
* Alles wird Git, was Re: [PATCH] mailmap: resurrect lower-casing of email addresses
From: Johannes Schindelin @ 2009-04-08 2:21 UTC (permalink / raw)
To: A Large Angry SCM; +Cc: git
In-Reply-To: <49DBF4C3.8080103@gmail.com>
Hi,
On Tue, 7 Apr 2009, A Large Angry SCM wrote:
> [CC list trimmed since I don't Junio is that interested in what this thread
> has morphed into.]
>
> Johannes Schindelin wrote:
>
> > We could even use the opportunity for a little informal German
> > GitTogether... "Alles wird Git!"?
>
> Could you translate that for the Deutsch-challenged among us?
No problem:
Everything is going to be alright.
(with the "alright" part misspelt so it reads "git" ;-)
> According to the /current/ itinerary, the evenings I have free in Berlin
> are Saturday Oct 3 and Monday Oct 5.
Sir, we have a date.
Ciao,
Dscho
^ permalink raw reply
* Re: Any way to edit the file in index directly?
From: Ping Yin @ 2009-04-08 2:27 UTC (permalink / raw)
To: Jeff King; +Cc: git mailing list
In-Reply-To: <20090408021620.GC18244@coredump.intra.peff.net>
Ping Yin
On Wed, Apr 8, 2009 at 10:16 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Apr 07, 2009 at 10:10:41PM -0400, Jeff King wrote:
>
>> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>>
>> > There seems to be a patch for this ( add -e?), but i forget where to
>> > find it.
>>
>> "add -p" has an "e"dit option for editing the patch. I don't recall any
>> way of directly editing the content.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
Sometimes by 'add -p', i can't get what i want (the patch will fail to
apply when exiting editor). And with 'add -p', i can't get a global
view of all changes together
> I'm not sure what you mean by "alongside".
By "aloneside" i mean i can open the index and worktree file in diff
mode side by side for easily editing.
> Hmm, actually maybe you are thinking of:
>
> http://article.gmane.org/gmane.comp.version-control.git/103389
>
> which I even reviewed, but it doesn't seem to have gone anywhere after
> that.
>
Thanks, That's what i want.
^ permalink raw reply
* Re: [PATCH 1/3] list-objects: add "void *data" parameter to show functions
From: Junio C Hamano @ 2009-04-08 2:29 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Johannes Schindelin
In-Reply-To: <20090407040854.4338.94304.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> The goal of this patch is to get rid of the "static struct rev_info
> revs" static variable in "builtin-rev-list.c".
Hmm. If it were a more library-ish file, a removal of such a static
variable might help you to make more than one calls to a library function,
but does it matter in files like builtin-rev-list.c? Its cmd_rev_list()
is like main() --- it is meant to run once and exit.
So if it is the only goal of this series, I am inclined to say that I do
not have a reason to look at the rest of the series, but as a side effect
does this removal make some other API better? Perhaps a more library-ish
function is in builtin-rev-list.c and this structure should really needs
to be passed around as a parameter, but I cannot tell solely by reading
the goal above, without reading the patches themselves.
> Anyway this makes the code more clean and more generic, so it
> should be a good thing in the long run.
I wouldn't disagree with that "long run" thing, but the answer to the
above question affects the placement of this series in my prioritized
queue.
^ permalink raw reply
* Re: [PATCH] Add a simple getpass() for MinGW
From: Junio C Hamano @ 2009-04-08 2:32 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Johannes Sixt, gitster
In-Reply-To: <7ba615a300fe2742e8d32f0313c6ee9a1a1aaed3.1239154140u.git.johannes.schindelin@gmx.de>
Thanks; should I take this directly or via Hannes's pull request?
^ permalink raw reply
* Re: Any way to edit the file in index directly?
From: Johannes Schindelin @ 2009-04-08 2:39 UTC (permalink / raw)
To: Jeff King; +Cc: Ping Yin, git mailing list
In-Reply-To: <20090408021041.GB18244@coredump.intra.peff.net>
Hi,
On Tue, 7 Apr 2009, Jeff King wrote:
> On Wed, Apr 08, 2009 at 09:03:03AM +0800, Ping Yin wrote:
>
> > There seems to be a patch for this ( add -e?), but i forget where to
> > find it.
>
> "add -p" has an "e"dit option for editing the patch. I don't recall any
> way of directly editing the content.
I posted a patch for "git add --edit", which allows you to edit the _diff_
between the working directory and the index, and which applies the result
using apply --recount.
But that has nothing to do with "editing the index directly".
But you might want to use a combination of "hash-object -w --stdin" and
"update-index --cacheinfo". IOW something like
sha1=$(echo Hello | git hash-object -w --stdin) &&
git update-index --cacheinfo 0644 $sha1 my-file
However, Ping, I _strongly_ suspect an X-Y problem here. IOW I think you
are asking about specifics of a certain _solution_, while we probably have
a better solution for your particular _problem_.
Hth,
Dscho
^ permalink raw reply
* Git for Windows 1.6.2.2
From: Johannes Schindelin @ 2009-04-08 2:46 UTC (permalink / raw)
To: msysgit, git
Hi,
this email tries to inform you that the Windows installer was updated to
the newest version of Git.
Changes since Git-1.6.2.1-preview20090322
New Features
- Comes with official git 1.6.2.2.
- Upgraded Tcl/Tk to 8.5.5.
- TortoiseMerge is supported by mergetool now (Thanks Markus Heidelberg).
- Uses pthreads (faster garbage collection on multi-core machines).
- The test suite passes!
Bugfixes
- Renaming was made more robust (due to Explorer or some virus scanners,
files could not be renamed at the first try, so we have to try multiple
times).
- Johannes Sixt made lots of changes to the test-suite to identify
properly which tests should pass, and which ones cannot pass due to
limitations of the platform.
- Support PAGERs with spaces in their filename.
- Quite a few changes were undone which we needed in the olden days of
msysGit.
- Fall back to / when HOME cannot be set to the real home directory due to
locale issues (works around Issue 108 for the moment).
Ciao,
Dscho "who really needs some sleep"
^ permalink raw reply
* Re: [PATCH] Add a simple getpass() for MinGW
From: Johannes Schindelin @ 2009-04-08 2:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Johannes Sixt
In-Reply-To: <7vfxgjub7c.fsf@gitster.siamese.dyndns.org>
Hi,
On Tue, 7 Apr 2009, Junio C Hamano wrote:
> Thanks; should I take this directly or via Hannes's pull request?
Thanks for asking; Maybe Hannes has some alternative solution, so I'd like
to have his take on things first.
Ciao,
Dscho "who really, really needs to sleep now"
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox