* Re: [PATCH] Don't fflush(stdout) when it's not helpful
From: Linus Torvalds @ 2007-06-29 23:43 UTC (permalink / raw)
To: Theodore Tso
Cc: Junio C Hamano, Jeff King, Frank Lichtenheld, Jim Meyering, git
In-Reply-To: <20070629174046.GC16268@thunk.org>
On Fri, 29 Jun 2007, Theodore Tso wrote:
>
> Comments?
Looks ok to me.
This should probably be paired up with the change to git.c (in "next") to
do the "fflush()" before the "ferror()" too, in case the error is pending.
Linus
^ permalink raw reply
* [PATCH (2nd try)] Add git-stash script
From: しらいしななこ @ 2007-06-30 1:29 UTC (permalink / raw)
To: GIT; +Cc: Junio C Hamano
When my boss has something to show me and I have to update, for some
reason I am always in the middle of doing something else, and git pull
command refuses to work in such a case.
I wrote this little script to save the changes I made, perform the
update, and then come back to where I was, but on top of the updated
commit.
This is how you would use the script:
$ git stash
$ git pull
$ git stash apply
Signed-off-by: Nanako Shiraishi <nanako3@bluebottle.com>
---
Here is an updated script.
Unfortunately I haven't managed to get the suggestion to use
"export GITHEAD_xxxx=NicerName" from Johannes Schindelin working
yet.
git-stash.sh | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 153 insertions(+), 0 deletions(-)
create mode 100755 git-stash.sh
diff --git a/git-stash.sh b/git-stash.sh
new file mode 100755
index 0000000..8bf83c1
--- /dev/null
+++ b/git-stash.sh
@@ -0,0 +1,153 @@
+#!/bin/sh
+# Copyright (c) 2007, Nanako Shiraishi
+
+USAGE='[ | list | show | apply | clear]'
+
+. git-sh-setup
+require_work_tree
+
+TMP="$GIT_DIR/.git-stash.$$"
+trap 'rm -f "$TMP-*"' 0
+
+ref_stash=refs/stash
+
+no_changes () {
+ git-diff-index --quiet --cached HEAD &&
+ git-diff-files --quiet
+}
+
+clear_stash () {
+ logfile="$GIT_DIR/logs/$ref_stash" &&
+ mkdir -p "$(dirname "$logfile")" &&
+ : >"$logfile"
+}
+
+save_stash () {
+ if no_changes
+ then
+ echo >&2 'No local changes to save'
+ exit 0
+ fi
+ test -f "$GIT_DIR/logs/refs/stash" ||
+ clear_stash || die "Cannot initialize stash"
+
+ # state of the base commit
+ if b_commit=$(git-rev-parse --verify HEAD)
+ then
+ head=$(git-log --abbrev-commit --pretty=oneline -n 1 HEAD)
+ else
+ die "You do not have the initial commit yet"
+ fi
+
+ if branch=$(git-symbolic-ref -q HEAD)
+ then
+ branch=${branch#refs/heads/}
+ else
+ branch='(no branch)'
+ fi
+ msg=$(printf '%s: %s' "$branch" "$head")
+
+ # state of the index
+ i_tree=$(git-write-tree) &&
+ i_commit=$(printf 'index on %s' "$msg" |
+ git-commit-tree $i_tree -p $b_commit) ||
+ die "Cannot save the current index state"
+
+ # state of the working tree
+ w_tree=$( (
+ GIT_INDEX_FILE="$TMP-index" &&
+ export GIT_INDEX_FILE &&
+
+ rm -f "$TMP-index" &&
+ git-read-tree $i_tree &&
+ git-add -u &&
+ git-write-tree &&
+ rm -f "$TMP-index"
+ ) ) ||
+ die "Cannot save the current worktree state"
+
+ # create the stash
+ w_commit=$(printf 'WIP on %s' "$msg" |
+ git-commit-tree $w_tree -p $b_commit -p $i_commit) ||
+ die "Cannot record working tree state"
+
+ git-update-ref -m "$msg" $ref_stash $w_commit ||
+ die "Cannot save the current status"
+ printf >&2 'Saved WIP on %s\n' "$msg"
+}
+
+list_stash () {
+ git-log --pretty=oneline -g "$@" $ref_stash |
+ sed -n -e 's/^[.0-9a-f]* refs\///p'
+}
+
+show_stash () {
+ flags=$(git-rev-parse --no-revs --flags "$@")
+ if test -z "$flags"
+ then
+ flags=--stat
+ fi
+ s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@")
+
+ w_commit=$(git-rev-parse --verify "$s") &&
+ b_commit=$(git-rev-parse --verify "$s^") &&
+ git-diff $flags $b_commit $w_commit
+}
+
+apply_stash () {
+ git-diff-files --quiet ||
+ die 'Cannot restore on top of a dirty state'
+
+ # current index state
+ c_tree=$(git-write-tree) ||
+ die 'Cannot apply a stash in the middle of a merge'
+
+ s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
+ w_tree=$(git-rev-parse --verify "$s:") &&
+ b_tree=$(git-rev-parse --verify "$s^:") ||
+ die "$*: no valid stashed state found"
+
+ if git-merge-recursive $b_tree -- $c_tree $w_tree
+ then
+ # No conflict
+ a="$TMP-added" &&
+ git-diff --cached --name-only --diff-filter=A $c_tree >"$a" &&
+ git-read-tree --reset $c_tree &&
+ git-update-index --add --stdin <"$a" ||
+ die "Cannot unstage modified files"
+ git-status
+ rm -f "$a"
+ else
+ # Merge conflict
+ exit 1
+ fi
+}
+
+# Main command set
+case "$1" in
+list)
+ shift
+ if test $# = 0
+ then
+ set x -n 10
+ shift
+ fi
+ list_stash "$@"
+ ;;
+show)
+ shift
+ show_stash "$@"
+ ;;
+apply)
+ shift
+ apply_stash "$@"
+ ;;
+clear)
+ clear_stash
+ ;;
+'')
+ save_stash && git-reset --hard
+ ;;
+*)
+ usage
+esac
--
1.5.2
----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com
^ permalink raw reply related
* Re: [PATCH (2nd try)] Add git-stash script
From: Johannes Schindelin @ 2007-06-30 2:05 UTC (permalink / raw)
To: しらいしななこ
Cc: GIT, Junio C Hamano
In-Reply-To: <200706300126.l5U1QPdb021795@mi1.bluebottle.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 306 bytes --]
Hi,
On Sat, 30 Jun 2007, しらいしななこ wrote:
> Unfortunately I haven't managed to get the suggestion to use "export
> GITHEAD_xxxx=NicerName" from Johannes Schindelin working yet.
If you provide a test script (see t/t[0-9]*.sh), I'll gladly provide the
support for GITHEAD_xxxx.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Don't fflush(stdout) when it's not helpful
From: Junio C Hamano @ 2007-06-30 2:15 UTC (permalink / raw)
To: Linus Torvalds
Cc: Theodore Tso, Jeff King, Frank Lichtenheld, Jim Meyering, git
In-Reply-To: <alpine.LFD.0.98.0706291641590.8675@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Fri, 29 Jun 2007, Theodore Tso wrote:
>>
>> Comments?
>
> Looks ok to me.
>
> This should probably be paired up with the change to git.c (in "next") to
> do the "fflush()" before the "ferror()" too, in case the error is pending.
Do you mean this part?
+ /* Somebody closed stdout? */
+ if (fstat(fileno(stdout), &st))
+ return 0;
+ /* Ignore write errors for pipes and sockets.. */
+ if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode))
+ return 0;
+
+ /* Check for ENOSPC and EIO errors.. */
+ if (ferror(stdout))
+ die("write failure on standard output");
+ if (fflush(stdout) || fclose(stdout))
+ die("write failure on standard output: %s", strerror(errno));
+
+ return 0;
+}
I was planning to push this out to 'master' this weekend.
^ permalink raw reply
* Re: [PATCH (2nd try)] Add git-stash script
From: Junio C Hamano @ 2007-06-30 2:23 UTC (permalink / raw)
To: しらいしななこ; +Cc: GIT
In-Reply-To: <200706300126.l5U1QPda021795@mi1.bluebottle.com>
しらいしななこ <nanako3@bluebottle.com> writes:
> Unfortunately I haven't managed to get the suggestion to use
> "export GITHEAD_xxxx=NicerName" from Johannes Schindelin working
> yet.
I'd drop hints below, but first...
> git-stash.sh | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 153 insertions(+), 0 deletions(-)
> create mode 100755 git-stash.sh
... we would want an entry in .gitignore and Makefile as well ;-)
> diff --git a/git-stash.sh b/git-stash.sh
> new file mode 100755
> index 0000000..8bf83c1
> --- /dev/null
> +++ b/git-stash.sh
> ...
> +apply_stash () {
> + git-diff-files --quiet ||
> + die 'Cannot restore on top of a dirty state'
> +
> + # current index state
> + c_tree=$(git-write-tree) ||
> + die 'Cannot apply a stash in the middle of a merge'
> +
> + s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
> + w_tree=$(git-rev-parse --verify "$s:") &&
> + b_tree=$(git-rev-parse --verify "$s^:") ||
> + die "$*: no valid stashed state found"
At this point, you would say:
eval "
GITHEAD_$w_tree='Stashed changes' &&
GITHEAD_$c_tree='Updated upstream' &&
GITHEAD_$b_tree='Version stash was based on'
" &&
export GITHEAD_$w_tree GITHEAD_$c_tree GITHEAD_$b_tree
I suspect you did not use eval and got syntax errors from
variable assignment from the shell?
VAR_$iable='Assign ment'
is a syntax error, while
export VAR_$iable
is not. Don't ask me why.
^ permalink raw reply
* Re: Alternative git logo and favicon
From: Dan Chokola @ 2007-06-30 4:10 UTC (permalink / raw)
To: Henrik Nyh; +Cc: git
In-Reply-To: <e8965c600706290054w43f896f3jaba176974938752d@mail.gmail.com>
On 6/29/07, Henrik Nyh <henrik@nyh.se> wrote:
> I came up with an alternative logo/favicon to use with my gitweb:
> http://henrik.nyh.se/2007/06/alternative-git-logo-and-favicon.
>
> Thought I'd sent it to the list in case someone else likes them.
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Clever logo! I would be interested in using it in my gitweb
replacement, Wit. (http://dan.chokola.com/software/wit.rhtml)
-Daniel "Puzzles" Chokola
^ permalink raw reply
* Re: Applying patches in a directory that isn't a repository
From: Geoff Russell @ 2007-06-30 4:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3b0bi88r.fsf@assigned-by-dhcp.pobox.com>
On 6/29/07, Junio C Hamano <gitster@pobox.com> wrote:
> "Geoff Russell" <geoffrey.russell@gmail.com> writes:
>
> > But "git am" needs (AFAIK) a full repository. Is there a way to apply
> > a patch without
> > .git being present?
>
> If the recipient does not have a git repository, there is no
> point using "git am", as it is about making commits out of
> e-mails.
>
> git-apply acts as a plain "patch applicator".
For some reason I thought git-apply also needed a repository --- but it doesn't
and I've just tested it and, bingo, it is perfect for my needs. Many thanks.
Cheers,
Geoff
^ permalink raw reply
* Re: [PATCH] Don't fflush(stdout) when it's not helpful
From: Linus Torvalds @ 2007-06-30 4:24 UTC (permalink / raw)
To: Junio C Hamano
Cc: Theodore Tso, Jeff King, Frank Lichtenheld, Jim Meyering, git
In-Reply-To: <7vlke2dw6w.fsf@assigned-by-dhcp.pobox.com>
On Fri, 29 Jun 2007, Junio C Hamano wrote:
>
> Do you mean this part?
>
> + /* Somebody closed stdout? */
> + if (fstat(fileno(stdout), &st))
> + return 0;
> + /* Ignore write errors for pipes and sockets.. */
> + if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode))
> + return 0;
> +
> + /* Check for ENOSPC and EIO errors.. */
> + if (ferror(stdout))
> + die("write failure on standard output");
> + if (fflush(stdout) || fclose(stdout))
> + die("write failure on standard output: %s", strerror(errno));
> +
> + return 0;
> +}
>
> I was planning to push this out to 'master' this weekend.
I think that code is fine, but switching the order around could probably
make it less likely that stdio loses the errno for us.
So doing the last part in a different order, and making it say
/* Check for ENOSPC and EIO errors.. */
if (fflush(stdout))
die("write failure on standard output: %s", strerror(errno));
if (ferror(stdout))
die("unknown write failure on standard output");
if (fclose(stdout))
die("close failed on standard output: %s", strerror(errno));
return 0;
may recover at least non-transient errors.
It's still not perfect. As I've been harping on, stdio simply isn't very
good for error reporting. For example, if an IO error happened, you'd want
to see EIO, wouldn't you? And yes, that's what the kernel would return.
However, with buffered stdio (and flushing outside of our control), what
would likely happen is that some intermediate error return _does_ return
EIO, but then the kernel might decide to re-mount the filesystem read-only
due to the error, and the actual *report* for us might be
"write failure on standard output: read-only filesystem"
which lost the EIO.
But even worse, if the output happened to be buffer-aligned, stdio will
have thrown the error out entirely, and the "fflush()" will return 0, and
then we end up with that "unknown write failure" after all.
Or we might have had a ENOSPC at some point, but removed a temp-file, and
the final fflush() doesn't error out at all, so now the incomplete write
got done (with one or more buffer chunks missing), and we get "unknown
write failure" again, because we again lost the ENOSPC.
So you basically cannot get "perfect" with stdio. It's impossible. But the
above re-ordering will at least get you _closer_, and *most* of the time
you'll get exactly the error you'd expect.
(I'm not a huge fan of "most of the time it works", but that's stdio for
you).
Linus
^ permalink raw reply
* [PATCH (3rd try)] Add git-stash script
From: しらいしななこ @ 2007-06-30 5:37 UTC (permalink / raw)
To: GIT; +Cc: Johannes Schindelin, Junio C Hamano
In-Reply-To: <Pine.LNX.4.64.0706300304480.4438@racer.site>
When my boss has something to show me and I have to update, for some
reason I am always in the middle of doing something else, and git pull
command refuses to work in such a case.
I wrote this little script to save the changes I made, perform the
update, and then come back to where I was, but on top of the updated
commit.
This is how you would use the script:
$ git stash
$ git pull
$ git stash apply
Signed-off-by: Nanako Shiraishi <nanako3@bluebottle.com>
---
Thank you for the hint for labeling the conflict blocks.
I also added an entry to gitignore and Makefile as requested.
.gitignore | 1 +
Makefile | 3 +-
git-stash.sh | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 163 insertions(+), 1 deletions(-)
create mode 100755 git-stash.sh
diff --git a/.gitignore b/.gitignore
index e8b060c..02d9b04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -123,6 +123,7 @@ git-ssh-fetch
git-ssh-pull
git-ssh-push
git-ssh-upload
+git-stash
git-status
git-stripspace
git-submodule
diff --git a/Makefile b/Makefile
index a98e27a..05b1fc0 100644
--- a/Makefile
+++ b/Makefile
@@ -212,7 +212,8 @@ SCRIPT_SH = \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
git-merge-resolve.sh git-merge-ours.sh \
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
- git-filter-branch.sh
+ git-filter-branch.sh \
+ git-stash.sh
SCRIPT_PERL = \
git-add--interactive.perl \
diff --git a/git-stash.sh b/git-stash.sh
new file mode 100755
index 0000000..05ca3a6
--- /dev/null
+++ b/git-stash.sh
@@ -0,0 +1,160 @@
+#!/bin/sh
+# Copyright (c) 2007, Nanako Shiraishi
+
+USAGE='[ | list | show | apply | clear]'
+
+. git-sh-setup
+require_work_tree
+
+TMP="$GIT_DIR/.git-stash.$$"
+trap 'rm -f "$TMP-*"' 0
+
+ref_stash=refs/stash
+
+no_changes () {
+ git-diff-index --quiet --cached HEAD &&
+ git-diff-files --quiet
+}
+
+clear_stash () {
+ logfile="$GIT_DIR/logs/$ref_stash" &&
+ mkdir -p "$(dirname "$logfile")" &&
+ : >"$logfile"
+}
+
+save_stash () {
+ if no_changes
+ then
+ echo >&2 'No local changes to save'
+ exit 0
+ fi
+ test -f "$GIT_DIR/logs/refs/stash" ||
+ clear_stash || die "Cannot initialize stash"
+
+ # state of the base commit
+ if b_commit=$(git-rev-parse --verify HEAD)
+ then
+ head=$(git-log --abbrev-commit --pretty=oneline -n 1 HEAD)
+ else
+ die "You do not have the initial commit yet"
+ fi
+
+ if branch=$(git-symbolic-ref -q HEAD)
+ then
+ branch=${branch#refs/heads/}
+ else
+ branch='(no branch)'
+ fi
+ msg=$(printf '%s: %s' "$branch" "$head")
+
+ # state of the index
+ i_tree=$(git-write-tree) &&
+ i_commit=$(printf 'index on %s' "$msg" |
+ git-commit-tree $i_tree -p $b_commit) ||
+ die "Cannot save the current index state"
+
+ # state of the working tree
+ w_tree=$( (
+ GIT_INDEX_FILE="$TMP-index" &&
+ export GIT_INDEX_FILE &&
+
+ rm -f "$TMP-index" &&
+ git-read-tree $i_tree &&
+ git-add -u &&
+ git-write-tree &&
+ rm -f "$TMP-index"
+ ) ) ||
+ die "Cannot save the current worktree state"
+
+ # create the stash
+ w_commit=$(printf 'WIP on %s' "$msg" |
+ git-commit-tree $w_tree -p $b_commit -p $i_commit) ||
+ die "Cannot record working tree state"
+
+ git-update-ref -m "$msg" $ref_stash $w_commit ||
+ die "Cannot save the current status"
+ printf >&2 'Saved WIP on %s\n' "$msg"
+}
+
+list_stash () {
+ git-log --pretty=oneline -g "$@" $ref_stash |
+ sed -n -e 's/^[.0-9a-f]* refs\///p'
+}
+
+show_stash () {
+ flags=$(git-rev-parse --no-revs --flags "$@")
+ if test -z "$flags"
+ then
+ flags=--stat
+ fi
+ s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@")
+
+ w_commit=$(git-rev-parse --verify "$s") &&
+ b_commit=$(git-rev-parse --verify "$s^") &&
+ git-diff $flags $b_commit $w_commit
+}
+
+apply_stash () {
+ git-diff-files --quiet ||
+ die 'Cannot restore on top of a dirty state'
+
+ # current index state
+ c_tree=$(git-write-tree) ||
+ die 'Cannot apply a stash in the middle of a merge'
+
+ s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
+ w_tree=$(git-rev-parse --verify "$s:") &&
+ b_tree=$(git-rev-parse --verify "$s^:") ||
+ die "$*: no valid stashed state found"
+
+ eval "
+ GITHEAD_$w_tree='Stashed changes' &&
+ GITHEAD_$c_tree='Updated upstream' &&
+ GITHEAD_$b_tree='Version stash was based on' &&
+ export GITHEAD_$w_tree GITHEAD_$c_tree GITHEAD_$b_tree
+ "
+
+ if git-merge-recursive $b_tree -- $c_tree $w_tree
+ then
+ # No conflict
+ a="$TMP-added" &&
+ git-diff --cached --name-only --diff-filter=A $c_tree >"$a" &&
+ git-read-tree --reset $c_tree &&
+ git-update-index --add --stdin <"$a" ||
+ die "Cannot unstage modified files"
+ git-status
+ rm -f "$a"
+ else
+ # Merge conflict
+ exit 1
+ fi
+}
+
+# Main command set
+case "$1" in
+list)
+ shift
+ if test $# = 0
+ then
+ set x -n 10
+ shift
+ fi
+ list_stash "$@"
+ ;;
+show)
+ shift
+ show_stash "$@"
+ ;;
+apply)
+ shift
+ apply_stash "$@"
+ ;;
+clear)
+ clear_stash
+ ;;
+'')
+ save_stash && git-reset --hard
+ ;;
+*)
+ usage
+esac
--
1.5.2
----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com
^ permalink raw reply related
* Re: [PATCH] git-tag: Fix the main while loop exit condition.
From: Sam Vilain @ 2007-06-30 6:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alexandre Vassalotti, git
In-Reply-To: <7vy7i3mxw3.fsf@assigned-by-dhcp.pobox.com>
Junio C Hamano wrote:
> Thanks.
>
> I think you would need something like this on top if you want to
> really fix it, though.
>
> I also suspect that we should error out on:
>
> $ git tag -l foo bar
>
> but that will be left as an exercise to the readers ;-)
More is required...
diff --git a/git-tag.sh b/git-tag.sh
index 48b54a1..480d16d 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -82,7 +82,9 @@ do
if test "$#" = "0"; then
die "error: option -m needs an argument"
else
+ message="$1"
message_given=1
+ shift
fi
;;
-F)
@@ -93,13 +95,19 @@ do
else
message="$(cat "$1")"
message_given=1
+ shift
fi
;;
-u)
annotate=1
signed=1
shift
- username="$1"
+ if test "$#" = "0"; then
+ die "error: option -u needs an argument"
+ else
+ username="$1"
+ shift
+ fi
;;
-d)
shift
^ permalink raw reply related
* Re: [PATCH (3rd try)] Add git-stash script
From: Jeff King @ 2007-06-30 6:12 UTC (permalink / raw)
To: しらいしななこ
Cc: GIT, Johannes Schindelin, Junio C Hamano
In-Reply-To: <200706300539.l5U5dHLh003989@mi1.bluebottle.com>
On Sat, Jun 30, 2007 at 02:37:09PM +0900, しらいしななこ wrote:
> +ref_stash=refs/stash
[...]
> +save_stash () {
> + if no_changes
> + then
> + echo >&2 'No local changes to save'
> + exit 0
> + fi
> + test -f "$GIT_DIR/logs/refs/stash" ||
> + clear_stash || die "Cannot initialize stash"
Nit: this should be .../logs/$ref_stash
-Peff
^ permalink raw reply
* Re: [PATCH (3rd try)] Add git-stash script
From: Junio C Hamano @ 2007-06-30 6:25 UTC (permalink / raw)
To: Jeff King
Cc: しらいしななこ, GIT,
Johannes Schindelin
In-Reply-To: <20070630061237.GA14344@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> On Sat, Jun 30, 2007 at 02:37:09PM +0900, しらいしななこ wrote:
>
>> +ref_stash=refs/stash
> [...]
>> +save_stash () {
>> + if no_changes
>> + then
>> + echo >&2 'No local changes to save'
>> + exit 0
>> + fi
>> + test -f "$GIT_DIR/logs/refs/stash" ||
>> + clear_stash || die "Cannot initialize stash"
>
> Nit: this should be .../logs/$ref_stash
Sharp eyes.
I'll take a look and possibly comment on it later, but from a
cursory look I do not see major problems, so if I decide to
apply it I'll try to remember fixing this up when I do so...
^ permalink raw reply
* [PATCH] Correct usages of sed in git-tag for Mac OS X
From: Shawn O. Pearce @ 2007-06-30 6:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Both `git-tag -l` and `git tag -v` fail on Mac OS X due to their
non-standard uses of sed. Actually `git tag -v` fails because the
underlying git-tag-verify uses a non-standard sed command.
We now stick to only standard sed, which does make our sed scripts
slightly more complicated, but we can actually list tags with more
than 0 lines of additional context and we can verify signed tags
with gpg. These major Git functions are much more important than
saving two or three lines of a simple sed script.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Boy, it would sure be nice if git-tag was written in a more portable
programming language, such as C. No more worries about sed working
on one platform and not another. ;-)
t7004-tag.sh now passes all 65 tests here.
git-tag.sh | 16 ++++++++++------
git-verify-tag.sh | 7 ++++---
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/git-tag.sh b/git-tag.sh
index c840439..3917cd8 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -51,12 +51,16 @@ do
[ "$LINES" -le 0 ] && { echo "$TAG"; continue ;}
OBJTYPE=$(git cat-file -t "$TAG")
case $OBJTYPE in
- tag) ANNOTATION=$(git cat-file tag "$TAG" |
- sed -e '1,/^$/d' \
- -e '/^-----BEGIN PGP SIGNATURE-----$/Q' )
- printf "%-15s %s\n" "$TAG" "$ANNOTATION" |
- sed -e '2,$s/^/ /' \
- -e "${LINES}q"
+ tag)
+ ANNOTATION=$(git cat-file tag "$TAG" |
+ sed -e '1,/^$/d' |
+ sed -n -e "
+ /^-----BEGIN PGP SIGNATURE-----\$/q
+ 2,\$s/^/ /
+ p
+ ${LINES}q
+ ")
+ printf "%-15s %s\n" "$TAG" "$ANNOTATION"
;;
*) echo "$TAG"
;;
diff --git a/git-verify-tag.sh b/git-verify-tag.sh
index f2d5597..a54fd48 100755
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -37,8 +37,9 @@ esac
trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0
git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1
-
-cat "$GIT_DIR/.tmp-vtag" |
-sed '/-----BEGIN PGP/Q' |
+sed -n -e '
+ /^-----BEGIN PGP SIGNATURE-----$/q
+ p
+ ' <"$GIT_DIR/.tmp-vtag" |
gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
rm -f "$GIT_DIR/.tmp-vtag"
--
1.5.2.2.1414.g1e7d-dirty
^ permalink raw reply related
* Re: [PATCH] Correct usages of sed in git-tag for Mac OS X
From: Junio C Hamano @ 2007-06-30 7:00 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20070630064247.GA18041@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> These major Git functions are much more important than
> saving two or three lines of a simple sed script.
The size of the script does not worry me. The number of sed
processes originally did, but the old code also had two
invocations of sed, and I do not think you can implement the
"strip the header, and then emit ${LINES} lines" behaviour
without doing them in separate sed anyway, so I think this is
fine. But it makes me wonder why we are not using awk ;-)
^ permalink raw reply
* Re: [PATCH] Correct usages of sed in git-tag for Mac OS X
From: Shawn O. Pearce @ 2007-06-30 7:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vzm2ic4g8.fsf@assigned-by-dhcp.pobox.com>
Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
> > These major Git functions are much more important than
> > saving two or three lines of a simple sed script.
>
> The size of the script does not worry me. The number of sed
> processes originally did, but the old code also had two
> invocations of sed, and I do not think you can implement the
> "strip the header, and then emit ${LINES} lines" behaviour
> without doing them in separate sed anyway, so I think this is
> fine. But it makes me wonder why we are not using awk ;-)
Or perl. ;-)
But the patch I just sent is sane. And it all will hopefully go
away when Carlos has his C version complete and passing the very
large test suite he recently contributed. So not really worth
worrying about now that its working properly.
But yea, I changed the script the way I did to keep the number of sed
processes per tag equal to what we had before. Its not any better,
but its also not any worse and it at least runs on more systems.
--
Shawn.
^ permalink raw reply
* [PATCH] GIT-VERSION-GEN: don't convert - delimiter to .'s
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain
In-Reply-To: <11831937823184-git-send-email-sam.vilain@catalyst.net.nz>
Otherwise, a custom "v1.5.2.42.gb1ff" is considered newer than a
"v1.5.2.1.69.gcafe"
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
GIT-VERSION-GEN | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 06c360b..ac6a062 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -18,7 +18,7 @@ elif test -d .git &&
v[0-9]*) : happy ;;
esac
then
- VN=$(echo "$VN" | sed -e 's/-/./g');
+ :;
else
VN="$DEF_VER"
fi
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-remote: document -n
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain, Sam Vilain
In-Reply-To: <11831937823982-git-send-email-sam.vilain@catalyst.net.nz>
From: Sam Vilain <sam@vilain.net>
The 'show' and 'prune' commands accept an option '-n'; document what
it does.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/git-remote.txt | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index ab232c2..61a6022 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -49,6 +49,9 @@ branch the `HEAD` at the remote repository actually points at.
'show'::
Gives some information about the remote <name>.
++
+With `-n` option, the remote heads are not queried first with
+`git ls-remote <name>`; cached information is used instead.
'prune'::
@@ -56,6 +59,10 @@ Deletes all stale tracking branches under <name>.
These stale branches have already been removed from the remote repository
referenced by <name>, but are still locally available in
"remotes/<name>".
++
+With `-n` option, the remote heads are not confirmed first with `git
+ls-remote <name>`; cached information is used instead. Use with
+caution.
'update'::
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-remote: allow 'git-remote fetch' as a synonym for 'git fetch'
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain, Sam Vilain
In-Reply-To: <1183193782172-git-send-email-sam.vilain@catalyst.net.nz>
From: Sam Vilain <sam@vilain.net>
I found myself typing this when doing remote-like things. Perhaps
other people will find this useful
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/git-remote.txt | 4 ++++
git-remote.perl | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 61a6022..b462ccd 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -64,6 +64,10 @@ With `-n` option, the remote heads are not confirmed first with `git
ls-remote <name>`; cached information is used instead. Use with
caution.
+'fetch'::
+
+Synonym for `git fetch <name>`, and accepts all the same options.
+
'update'::
Fetch updates for a named set of remotes in the repository as defined by
diff --git a/git-remote.perl b/git-remote.perl
index b59cafd..2c60cae 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -404,11 +404,15 @@ elsif ($ARGV[0] eq 'add') {
}
add_remote($ARGV[1], $ARGV[2], \%opts);
}
+elsif ($ARGV[0] eq 'fetch') {
+ exec("git-fetch", @ARGV[1..$#ARGV]);
+}
else {
print STDERR "Usage: git remote\n";
print STDERR " git remote add <name> <url>\n";
print STDERR " git remote show <name>\n";
print STDERR " git remote prune <name>\n";
print STDERR " git remote update [group]\n";
+ print STDERR " git remote fetch <fetch-options> <repository> <refspec>...\n";
exit(1);
}
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-svn: cache max revision in rev_db databases
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain, Sam Vilain
In-Reply-To: <11831937822346-git-send-email-sam.vilain@catalyst.net.nz>
From: Sam Vilain <sam@vilain.net>
Cache the maximum revision for each rev_db URL rather than looking it
up each time. This saves a lot of time when rebuilding indexes on a
freshly cloned repository.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
git-svn.perl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 556cd7d..a8b6669 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -801,6 +801,7 @@ sub working_head_info {
my ($head, $refs) = @_;
my ($fh, $ctx) = command_output_pipe('log', $head);
my $hash;
+ my %max;
while (<$fh>) {
if ( m{^commit ($::sha1)$} ) {
unshift @$refs, $hash if $hash and $refs;
@@ -810,11 +811,14 @@ sub working_head_info {
next unless s{^\s*(git-svn-id:)}{$1};
my ($url, $rev, $uuid) = extract_metadata($_);
if (defined $url && defined $rev) {
+ next if $max{$url} and $max{$url} < $rev;
if (my $gs = Git::SVN->find_by_url($url)) {
my $c = $gs->rev_db_get($rev);
if ($c && $c eq $hash) {
close $fh; # break the pipe
return ($url, $rev, $uuid, $gs);
+ } else {
+ $max{$url} ||= $gs->rev_db_max;
}
}
}
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-svn: use git-log rather than rev-list | xargs cat-file
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain, Sam Vilain
In-Reply-To: <11831937813223-git-send-email-sam.vilain@catalyst.net.nz>
From: Sam Vilain <sam@vilain.net>
This saves a bit of time when rebuilding the git-svn index.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
git-svn.perl | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 3033b50..556cd7d 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -782,12 +782,12 @@ sub read_repo_config {
sub extract_metadata {
my $id = shift or return (undef, undef, undef);
- my ($url, $rev, $uuid) = ($id =~ /^git-svn-id:\s(\S+?)\@(\d+)
+ my ($url, $rev, $uuid) = ($id =~ /^\s*git-svn-id:\s+(.*)\@(\d+)
\s([a-f\d\-]+)$/x);
if (!defined $rev || !$uuid || !$url) {
# some of the original repositories I made had
# identifiers like this:
- ($rev, $uuid) = ($id =~/^git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
+ ($rev, $uuid) = ($id =~/^\s*git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
}
return ($url, $rev, $uuid);
}
@@ -799,10 +799,16 @@ sub cmt_metadata {
sub working_head_info {
my ($head, $refs) = @_;
- my ($fh, $ctx) = command_output_pipe('rev-list', $head);
- while (my $hash = <$fh>) {
- chomp($hash);
- my ($url, $rev, $uuid) = cmt_metadata($hash);
+ my ($fh, $ctx) = command_output_pipe('log', $head);
+ my $hash;
+ while (<$fh>) {
+ if ( m{^commit ($::sha1)$} ) {
+ unshift @$refs, $hash if $hash and $refs;
+ $hash = $1;
+ next;
+ }
+ next unless s{^\s*(git-svn-id:)}{$1};
+ my ($url, $rev, $uuid) = extract_metadata($_);
if (defined $url && defined $rev) {
if (my $gs = Git::SVN->find_by_url($url)) {
my $c = $gs->rev_db_get($rev);
@@ -812,7 +818,6 @@ sub working_head_info {
}
}
}
- unshift @$refs, $hash if $refs;
}
command_close_pipe($fh, $ctx);
(undef, undef, undef, undef);
@@ -2019,16 +2024,19 @@ sub rebuild {
return;
}
print "Rebuilding $db_path ...\n";
- my ($rev_list, $ctx) = command_output_pipe("rev-list", $self->refname);
+ my ($log, $ctx) = command_output_pipe("log", $self->refname);
my $latest;
my $full_url = $self->full_url;
remove_username($full_url);
my $svn_uuid;
- while (<$rev_list>) {
- chomp;
- my $c = $_;
- die "Non-SHA1: $c\n" unless $c =~ /^$::sha1$/o;
- my ($url, $rev, $uuid) = ::cmt_metadata($c);
+ my $c;
+ while (<$log>) {
+ if ( m{^commit ($::sha1)$} ) {
+ $c = $1;
+ next;
+ }
+ next unless s{^\s*(git-svn-id:)}{$1};
+ my ($url, $rev, $uuid) = ::extract_metadata($_);
remove_username($url);
# ignore merges (from set-tree)
@@ -2046,7 +2054,7 @@ sub rebuild {
$self->rev_db_set($rev, $c);
print "r$rev = $c\n";
}
- command_close_pipe($rev_list, $ctx);
+ command_close_pipe($log, $ctx);
print "Done rebuilding $db_path\n";
}
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] repack: improve documentation on -a option
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain
In-Reply-To: <1183193781941-git-send-email-sam.vilain@catalyst.net.nz>
Some minor enhancements to the git-repack manual page.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/git-repack.txt | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index c33a512..be8e5f8 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -14,7 +14,8 @@ DESCRIPTION
-----------
This script is used to combine all objects that do not currently
-reside in a "pack", into a pack.
+reside in a "pack", into a pack. It can also be used to re-organise
+existing packs into a single, more efficient pack.
A pack is a collection of objects, individually compressed, with
delta compression applied, stored in a single file, with an
@@ -28,11 +29,13 @@ OPTIONS
-a::
Instead of incrementally packing the unpacked objects,
- pack everything available into a single pack.
+ pack everything referenced into a single pack.
Especially useful when packing a repository that is used
- for private development and there is no need to worry
- about people fetching via dumb file transfer protocols
- from it. Use with '-d'.
+ for private development and there no need to worry
+ about people fetching via dumb protocols from it. Use
+ with '-d'. This will clean up the objects that `git prune`
+ leaves behind, but `git fsck-objects --full` shows as
+ dangling.
-d::
After packing, if the newly created packs make some
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-merge-ff: fast-forward only merge
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain
In-Reply-To: <11831937822249-git-send-email-sam.vilain@catalyst.net.nz>
This is primarily so that there is an easy switch to 'git-pull' to
be sure to fast forward only.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/merge-strategies.txt | 5 +++++
Makefile | 2 +-
git-merge-ff.sh | 8 ++++++++
git-merge.sh | 4 ++--
4 files changed, 16 insertions(+), 3 deletions(-)
create mode 100644 git-merge-ff.sh
diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt
index 7df0266..00739bc 100644
--- a/Documentation/merge-strategies.txt
+++ b/Documentation/merge-strategies.txt
@@ -33,3 +33,8 @@ ours::
merge is always the current branch head. It is meant to
be used to supersede old development history of side
branches.
+
+ff::
+ This is a degenerate merge strategy that always fails, which
+ means that the only time the target branch will change is if
+ there was no merge ("fast-forward" merge only).
diff --git a/Makefile b/Makefile
index 4ea5e45..7fa8fe3 100644
--- a/Makefile
+++ b/Makefile
@@ -210,7 +210,7 @@ SCRIPT_SH = \
git-tag.sh git-verify-tag.sh \
git-am.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
- git-merge-resolve.sh git-merge-ours.sh \
+ git-merge-resolve.sh git-merge-ours.sh git-merge-ff.sh \
git-lost-found.sh git-quiltimport.sh git-submodule.sh \
git-filter-branch.sh
diff --git a/git-merge-ff.sh b/git-merge-ff.sh
new file mode 100644
index 0000000..b0e0f85
--- /dev/null
+++ b/git-merge-ff.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Sam Vilain
+#
+# A degenerate merge strategy that only allows fast-forwarding.
+#
+
+exit 1;
diff --git a/git-merge.sh b/git-merge.sh
index 981d69d..63aa374 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -16,10 +16,10 @@ test -z "$(git ls-files -u)" ||
LF='
'
-all_strategies='recur recursive octopus resolve stupid ours subtree'
+all_strategies='recur recursive octopus resolve stupid ours subtree ff'
default_twohead_strategies='recursive'
default_octopus_strategies='octopus'
-no_trivial_merge_strategies='ours subtree'
+no_trivial_merge_strategies='ours subtree ff'
use_strategies=
index_merge=t
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] contrib/hooks: add post-update hook for updating working copy
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain
In-Reply-To: <11831937822950-git-send-email-sam.vilain@catalyst.net.nz>
Many users want 'git push' to work like 'git pull'; that is, after the
transfer of the new objects, the working copy is updated, too. This
hook tries to be paranoid and never lose any information, as well as
being able to be safely just chmod +x'ed without destroying anything
it shouldn't.
Also allude to this potential feature on the man page for git-push.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/git-push.txt | 4 ++-
templates/hooks--post-update | 78 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 77 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 665f6dc..9f5fbc7 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -20,7 +20,9 @@ necessary to complete the given refs.
You can make interesting things happen to a repository
every time you push into it, by setting up 'hooks' there. See
-documentation for gitlink:git-receive-pack[1].
+documentation for gitlink:git-receive-pack[1]. One commonly
+requested feature, updating the working copy of the target
+repository, must be enabled in this way.
OPTIONS
diff --git a/templates/hooks--post-update b/templates/hooks--post-update
index bcba893..b5d490c 100644
--- a/templates/hooks--post-update
+++ b/templates/hooks--post-update
@@ -1,8 +1,78 @@
#!/bin/sh
#
-# An example hook script to prepare a packed repository for use over
-# dumb transports.
+# This hook does two things:
#
-# To enable this hook, make this file executable by "chmod +x post-update".
+# 1. update the "info" files that allow the list of references to be
+# queries over dumb transports such as http
+#
+# 2. if this repository looks like it is a non-bare repository, and
+# the checked-out branch is pushed to, then update the working copy.
+# This makes "push" and "pull" symmetric operations, as in darcs and
+# bzr.
+
+git-update-server-info
+
+export GIT_DIR=`cd $GIT_DIR; pwd`
+[ `expr "$GIT_DIR" : '.*/\.git'` = 0 ] && exit 0
+
+tree_in_revlog() {
+ ref=$1
+ tree=$2
+ found=$(
+ tail logs/$ref | while read commit rubbish
+ do
+ this_tree=`git-rev-parse commit $commit^{tree}`
+ if [ "$this_tree" = "$tree" ]
+ then
+ echo $commit
+ fi
+ done
+ )
+ [ -n "$found" ] && true
+}
+
+for ref
+do
+active=`git-symbolic-ref HEAD`
+if [ "$ref" = "$active" ]
+then
+ echo "Pushing to checked out branch - updating working copy" >&2
+ success=
+ if ! (cd ..; git-diff-files) | grep -q .
+ then
+ # save the current index just in case
+ current_tree=`git-write-tree`
+ if tree_in_revlog $ref $current_tree
+ then
+ cd ..
+ if git-diff-index -R --name-status HEAD >&2 &&
+ git-diff-index -z --name-only --diff-filter=A HEAD | xargs -0r rm &&
+ git-reset --hard HEAD
+ then
+ success=1
+ else
+ echo "E:unexpected error during update" >&2
+ fi
+ else
+ echo "E:uncommitted, staged changes found" >&2
+ fi
+ else
+ echo "E:unstaged changes found" >&2
+ fi
-exec git-update-server-info
+ if [ -z "$success" ]
+ then
+ (
+ echo "Non-bare repository checkout is not clean - not updating it"
+ echo "However I AM going to update the index. Any half-staged commit"
+ echo "in that checkout will be thrown away, but on the bright side"
+ echo "this is probably the least confusing thing for us to do and at"
+ echo "least we're not throwing any files somebody has changed away"
+ git-reset --mixed HEAD
+ echo
+ echo "This is the new status of the upstream working copy:"
+ git-status
+ ) >&2
+ fi
+fi
+done
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* [PATCH] git-mergetool: add support for ediff
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Sam Vilain
In-Reply-To: <11831937823756-git-send-email-sam.vilain@catalyst.net.nz>
There was emerge already but I much prefer this mode.
Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
---
Documentation/config.txt | 3 ++-
Documentation/git-mergetool.txt | 3 ++-
git-mergetool.sh | 19 ++++++++++++++-----
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 50503e8..4661e24 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -550,7 +550,8 @@ merge.summary::
merge.tool::
Controls which merge resolution program is used by
gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
- "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and "opendiff".
+ "meld", "xxdiff", "emerge", "ediff", "vimdiff", "gvimdiff", and
+ "opendiff".
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index 6c32c6d..1efe6e4 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -25,7 +25,8 @@ OPTIONS
-t or --tool=<tool>::
Use the merge resolution program specified by <tool>.
Valid merge tools are:
- kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, and opendiff
+ kdiff3, tkdiff, meld, xxdiff, emerge, ediff, vimdiff, gvimdiff,
+ and opendiff
+
If a merge resolution program is not specified, 'git mergetool'
will use the configuration variable merge.tool. If the
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 7b66309..6fda8af 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -258,6 +258,15 @@ merge_file () {
status=$?
save_backup
;;
+ ediff)
+ if base_present ; then
+ emacs --eval "(ediff-merge-files-with-ancestor \"$LOCAL\" \"$REMOTE\" \"$BASE\" nil \"$path\")"
+ else
+ emacs --eval "(ediff-merge-files \"$LOCAL\" \"$REMOTE\" nil \"$path\")"
+ fi
+ status=$?
+ save_backup
+ ;;
esac
if test "$status" -ne 0; then
echo "merge of $path failed" 1>&2
@@ -299,7 +308,7 @@ done
if test -z "$merge_tool"; then
merge_tool=`git-config merge.tool`
case "$merge_tool" in
- kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | "")
+ kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | ediff | vimdiff | gvimdiff | "")
;; # happy
*)
echo >&2 "git config option merge.tool set to unknown tool: $merge_tool"
@@ -320,15 +329,15 @@ if test -z "$merge_tool" ; then
fi
fi
if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
- merge_tool_candidates="$merge_tool_candidates emerge"
+ merge_tool_candidates="$merge_tool_candidates emerge ediff"
fi
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"
+ merge_tool_candidates="$merge_tool_candidates opendiff ediff emerge vimdiff"
echo "merge tool candidates: $merge_tool_candidates"
for i in $merge_tool_candidates; do
- if test $i = emerge ; then
+ if test $i = emerge || test $i = ediff ; then
cmd=emacs
else
cmd=$i
@@ -351,7 +360,7 @@ case "$merge_tool" in
exit 1
fi
;;
- emerge)
+ emerge|ediff)
if ! type "emacs" > /dev/null 2>&1; then
echo "Emacs is not available"
exit 1
--
1.5.2.1.1131.g3b90
^ permalink raw reply related
* a bunch of outstanding updates
From: Sam Vilain @ 2007-06-30 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Following up to this e-mail are a whole load of outstanding feature
requests of mine.
These changes are relatively mundane:
* repack: improve documentation on -a option
* git-remote: document -n
* git-remote: allow 'git-remote fetch' as a synonym for 'git fetch'
* git-svn: use git-log rather than rev-list | xargs cat-file
* git-svn: cache max revision in rev_db databases
This one will impact on the version displayed by "git --version", but
I think this is for the better:
* GIT-VERSION-GEN: don't convert - delimiter to .'s
These ones are really only very minor updates based on feedback so
far:
* git-merge-ff: fast-forward only merge
* git-mergetool: add support for ediff
This one is just the previously posted hook script put into the
templates directory, let me know if you'd rather I reshaped it to go
into contrib/hooks:
* contrib/hooks: add post-update hook for updating working copy
This one probably needs a bit more consideration and review, could
perhaps sit on pu.
* git-repack: generational repacking (and example hook script)
^ 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