* [PATCH 2/5] git-merge: refactor option parsing
From: Lars Hjemli @ 2007-09-22 0:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <1190421186-21784-2-git-send-email-hjemli@gmail.com>
Move the option parsing into a separate function as preparation for reuse
by the next commit.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
git-merge.sh | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 3a01db0..a3ef676 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -119,11 +119,7 @@ merge_name () {
fi
}
-case "$#" in 0) usage ;; esac
-
-have_message=
-while case "$#" in 0) break ;; esac
-do
+parse_option () {
case "$1" in
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
--no-summa|--no-summar|--no-summary)
@@ -166,9 +162,21 @@ do
have_message=t
;;
-*) usage ;;
- *) break ;;
+ *) return 1 ;;
esac
shift
+ args_left="$#"
+}
+
+case "$#" in 0) usage ;; esac
+
+have_message=
+while parse_option "$@"
+do
+ while test $args_left -lt $#
+ do
+ shift
+ done
done
if test -z "$show_diffstat"; then
--
1.5.3.2.82.g75c8d
^ permalink raw reply related
* [PATCH 0/5] per branch options for git-merge incl. --no-ff
From: Lars Hjemli @ 2007-09-22 0:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
This patch-series implements support for per branch configuration of
git-merge, using entries (branch.<name>.mergeoptions) in .git/config.
There is also a new option, --no-ff, which can be used to force git-merge
to create merge commits even when the merge was a fast-forward.
Finally, the new optiond --ff and --commit can be used to override
setting specified in .git/config.
Note: patch 1/5 is a resend of the testscript for git-merge, this time
with correct mode bits.
Shortlog:
Add test-script for git-merge porcelain
git-merge: refactor option parsing
git-merge: add support for branch.<name>.mergeoptions
git-merge: add support for --commit
git-merge: add --ff and --no-ff options
Diffstat:
Documentation/config.txt | 6 +
Documentation/git-merge.txt | 4 +
Documentation/merge-options.txt | 13 ++
git-merge.sh | 56 +++++-
t/t7600-merge.sh | 414 +++++++++++++++++++++++++++++++++++++++
5 files changed, 483 insertions(+), 10 deletions(-)
^ permalink raw reply
* Re: [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: David Kastrup @ 2007-09-22 0:26 UTC (permalink / raw)
To: git
In-Reply-To: <7vvea3h7sn.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> David Kastrup <dak@gnu.org> writes:
>
>> But doing a break inside of the while _condition_ rather than the body
>> just feels wrong to me.
>
> Sorry, but that is not the issue on the thread is about.
It is still relevant:
> BSD shell is failing the whole case statement when there is no
> matching case arm.
Sure, that is a bug. But in my opinion the idiom as such is ugly
enough not be worth keeping anyhow. The proposal of the patch
submitter was making an already ugly idiom even uglier for the sake of
his shell. I agree that this is not the way to go.
I was proposing replacing the idiom by something which I find cleaner.
That it will most likely work with the original poster's shell is more
or less a side effect. At least it is a side effect that might
motivate somebody else rather than me to do the cleanup work (and have
a buggy test shell to see whether he got everything indeed).
--
David Kastrup
^ permalink raw reply
* Re: [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: Junio C Hamano @ 2007-09-22 0:21 UTC (permalink / raw)
To: David Kastrup; +Cc: git
In-Reply-To: <7vvea3h7sn.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> David Kastrup <dak@gnu.org> writes:
>
>> But doing a break inside of the while _condition_ rather than the body
>> just feels wrong to me.
>
> Sorry, but that is not the issue on the thread is about.
> BSD shell is failing the whole case statement when there is no
> matching case arm.
I did not mean "BSD shell" in general here. The shell Eygene
uses on his (unspecified version of) FreeBSD box is failing.
^ permalink raw reply
* Re: [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: Junio C Hamano @ 2007-09-22 0:18 UTC (permalink / raw)
To: David Kastrup; +Cc: git
In-Reply-To: <86abrfy377.fsf@lola.quinscape.zz>
David Kastrup <dak@gnu.org> writes:
> But doing a break inside of the while _condition_ rather than the body
> just feels wrong to me.
Sorry, but that is not the issue on the thread is about.
BSD shell is failing the whole case statement when there is no
matching case arm.
^ permalink raw reply
* Re: [PATCH] post-checkout hook, and related docs and tests
From: Junio C Hamano @ 2007-09-22 0:15 UTC (permalink / raw)
To: Josh England; +Cc: git
In-Reply-To: <1190406421-15620-1-git-send-email-jjengla@sandia.gov>
"root" <root@sandia.gov> writes:
> +post-checkout
> +-----------
> +
> +This hook is invoked when a `git-checkout` is run on a local repository.
> +The hook is given two parameters: the ref of the previous HEAD, and the ref of
> +the new HEAD. This hook cannot affect the outcome of `git-checkout`.
> +
> +This hook can be used to perform repository validity checks, auto-display
> +differences from the previous HEAD, or set working dir metadata properties.
> +
People may wonder why this is not run when they do "git checkout
otherbranch path.c"; the second sentence from the above
description implies why it shouldn't, but the first sentence
probably should state it more clearly.
What's the _semantics_ you are trying to achieve?
Why does the hook run every time git-bisect suggests the next
revision to try?
Why does the hook run when rebase starts its work?
When "git pull" or "git merge" results in a fast forward, the
situation is no different from checking out a new revision. Why
doesn't the hook run in these cases?
^ permalink raw reply
* Re: [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: David Kastrup @ 2007-09-22 0:05 UTC (permalink / raw)
To: git
In-Reply-To: <7v8x6zinjf.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I do not doubt that "while case $# in 0) break ;; esac" does not
> work for your shell. But I think the above comment is grossly
> misleading.
Personally, I find this idiom distasteful.
I'd do either
while case $# in 0) false ;; *) true esac
or, more likely
while : do case $# in 0) break;; esac
But doing a break inside of the while _condition_ rather than the body
just feels wrong to me.
--
David Kastrup
^ permalink raw reply
* Re: cvsimport bug on branches [was: conversion to git]
From: Martin Langhoff @ 2007-09-22 0:05 UTC (permalink / raw)
To: Linus Torvalds
Cc: Steffen Prohaska, Eric Blake, m4-patches, Jim Meyering, git
In-Reply-To: <alpine.LFD.0.999.0709210840190.16478@woody.linux-foundation.org>
On 9/22/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> The big advantage of git-cvsimport is that it can do incremental imports,
Indeed. And it can take over incrementals on a GIT repo initially
imported by parsecvs or cvs2git. That's the recommended practice for
tracking non-trivial CVS repos -- IOWs "that's what I do" ;-)
cheers,
m
^ permalink raw reply
* [PATCH] post-checkout hook, and related docs and tests
From: root @ 2007-09-21 20:27 UTC (permalink / raw)
To: git; +Cc: Josh England
Signed-off-by: Josh England <jjengla@sandia.gov>
---
Documentation/hooks.txt | 10 +++++++
git-checkout.sh | 5 +++
t/t5403-post-checkout-hook.sh | 61 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)
create mode 100755 t/t5403-post-checkout-hook.sh
diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt
index c39edc5..e78f91a 100644
--- a/Documentation/hooks.txt
+++ b/Documentation/hooks.txt
@@ -87,6 +87,16 @@ parameter, and is invoked after a commit is made.
This hook is meant primarily for notification, and cannot affect
the outcome of `git-commit`.
+post-checkout
+-----------
+
+This hook is invoked when a `git-checkout` is run on a local repository.
+The hook is given two parameters: the ref of the previous HEAD, and the ref of
+the new HEAD. This hook cannot affect the outcome of `git-checkout`.
+
+This hook can be used to perform repository validity checks, auto-display
+differences from the previous HEAD, or set working dir metadata properties.
+
[[pre-receive]]
pre-receive
-----------
diff --git a/git-checkout.sh b/git-checkout.sh
index 17f4392..0cff36c 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -284,3 +284,8 @@ if [ "$?" -eq 0 ]; then
else
exit 1
fi
+
+# Run a post-checkout hook
+if test -x "$GIT_DIR"/hooks/post-checkout; then
+ "$GIT_DIR"/hooks/post-checkout $old $new
+fi
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
new file mode 100755
index 0000000..aa0216a
--- /dev/null
+++ b/t/t5403-post-checkout-hook.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Josh England
+#
+
+test_description='Test the post-checkout hook.'
+. ./test-lib.sh
+
+test_expect_success setup '
+ echo Data for commit0. >a &&
+ git update-index --add a &&
+ tree0=$(git write-tree) &&
+ commit0=$(echo setup | git commit-tree $tree0) &&
+ git update-ref refs/heads/master $commit0 &&
+ git-clone ./. clone1 &&
+ git-clone ./. clone2 &&
+ GIT_DIR=clone2/.git git branch -a new2 &&
+ echo Data for commit1. >clone2/b &&
+ GIT_DIR=clone2/.git git add clone2/b &&
+ GIT_DIR=clone2/.git git commit -m new2
+'
+
+for clone in 1 2; do
+ cat >clone${clone}/.git/hooks/post-checkout <<'EOF'
+#!/bin/sh
+echo $@ > $GIT_DIR/post-checkout.args
+EOF
+ chmod u+x clone${clone}/.git/hooks/post-checkout
+done
+
+test_expect_success 'post-checkout runs as expected ' '
+ GIT_DIR=clone1/.git git checkout master &&
+ test -e clone1/.git/post-checkout.args
+'
+
+test_expect_success 'post-checkout receives the right arguments with HEAD unchanged ' '
+ old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
+ new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
+ test $old = $new
+'
+
+test_expect_success 'post-checkout runs as expected ' '
+ GIT_DIR=clone1/.git git checkout master &&
+ test -e clone1/.git/post-checkout.args
+'
+
+test_expect_success 'post-checkout args are correct with git checkout -b ' '
+ GIT_DIR=clone1/.git git checkout -b new1 &&
+ old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
+ new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
+ test $old = $new
+'
+
+test_expect_success 'post-checkout receives the right arguments with HEAD changed ' '
+ GIT_DIR=clone2/.git git checkout new2 &&
+ old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
+ new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
+ test $old != $new
+'
+
+test_done
--
1.5.3.1.143.gf417e3-dirty
^ permalink raw reply related
* Re: Git as a filesystem
From: Martin Langhoff @ 2007-09-21 23:56 UTC (permalink / raw)
To: Dmitry Potapov
Cc: Peter Stahlir, Karl Hasselström, Johannes Schindelin, git
In-Reply-To: <20070921172941.GA7399@potapov>
On 9/22/07, Dmitry Potapov <dpotapov@gmail.com> wrote:
> used to create the original file. So, if you put any .deb file in such
> a system, you will get back a different .deb file (with a different SHA1).
> So, aside high CPU and memory requirements, this system cannot work in
> principle unless all users have exactly the same version of a compressor.
Was thinking the same - compression machinery, ordering of the files,
everything. It'd be a nightmare to ensure you get back the same .deb,
without a single different bit.
Debian packaging toolchain could be reworked to use a more GIT-like
approach - off the top of my head, at least
- signing/validating the "tree" of the package rather than the
completed package could allow the savings in distribution you mention,
decouple the signing from the compression, and simplify things like
debdiff
- git or git-like strategies for source packages
cheers,
m
^ permalink raw reply
* Re: [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: Junio C Hamano @ 2007-09-21 23:52 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: git
In-Reply-To: <20070921214346.GF97288@void.codelabs.ru>
Eygene Ryabinkin <rea-git@codelabs.ru> writes:
> Good day.
>
> I had found that FreeBSD's /bin/sh refuses to work with git 1.5.3.2.
> correctly: no flags are recognized. The details and fix are below.
> I don't currently know if the Bash's behaviour is POSIXly correct
> or the 'case' statement semantics is not very well defined. But
> the following patch fixes the things for the FreeBSD.
>
> Here we go.
>
> -----
>
> Option parsing in the Git shell scripts uses the construct 'while
> case "$#" in 0) break ;; esac; do ... done'. This is neat, because
> it needs no external commands invocation. But in the case when
> /bin/sh is not GNU Bash (for example, on FreeBSD) this cycle will
> not be executed at all.
I do not doubt that "while case $# in 0) break ;; esac" does not
work for your shell. But I think the above comment is grossly
misleading.
Don't mention bash there. You sound as if you are blaming
bashism, but the thing is, your shell is simply broken.
You have other choices than bash on BSD don't you?
My quick test shows that ksh, pdksh and dash seem to work
correctly. This idiom is what I picked up around late 80's from
somebody, and kept using on many variants of Unices. I would
find quite surprising that something that claims to be a shell
does not work correctly. Even /bin/sh that comes with Solaris
seems to work correctly, which should tell you something.
OpenBSD's /bin/sh seems to be Ok; I do not know whose shell they
use, but it seems to be hard-linked to /bin/ksh which is pdksh.
^ permalink raw reply
* Re: Git as a filesystem
From: Johannes Schindelin @ 2007-09-21 23:42 UTC (permalink / raw)
To: Eric Wong; +Cc: Nicolas Pitre, Peter Stahlir, git
In-Reply-To: <20070921233343.GA8327@muzzle>
Hi,
On Fri, 21 Sep 2007, Eric Wong wrote:
> Nicolas Pitre <nico@cam.org> wrote:
> > On Fri, 21 Sep 2007, Peter Stahlir wrote:
> >
> > > This is was I was looking for. My motivation is whether it is possible
> > > to run a system, for example Debian on a computer on top of gitfs,
> > > and then have a huge mirror on it, for example a complete 252GB
> > > Debian mirror as space efficient as possible.
> > >
> > > I wonder how big a deltified Debian mirror in one pack file would be. :)
> >
> > It would be just as big as the non gitified storage on disk.
> >
> > The space saving with git comes from efficient delta storage of
> > _versioned_ files, i.e. multiple nearly identical versions of the same
> > file where the stored delta is only the small difference between the
> > first full version and subsequent versions. Unless you plan on storing
> > many different Debian versions together, you won't benefit from any
> > delta at all. And since Debian packages are already compressed, git
> > won't be able to compress them further.
> >
> > So don't waste your time.
>
> On a similar note, has anybody experimented with using git to
> store maildirs or news spools? I'd imagine the quoted portions of
> most message threads could be delta-compressed quite efficiently.
I store all my mail in a git repository. Works beautifully. Except that
the buffers on my laptop are constantly full :-( So a simple commit takes
some waiting.
Should be no issue on normal (desktop) machines.
Ciao,
Dscho
^ permalink raw reply
* GIT_PAGER=cat git-svn log --> Illegal seek
From: Chris Moore @ 2007-09-21 23:40 UTC (permalink / raw)
To: git
I run my git commands inside an Emacs *shell* buffer, so I don't want
it running 'less' all the time. I export GIT_PAGER=cat to stop it.
I just tried a "git-svn log" and it failed:
$ GIT_PAGER=cat git-svn log
Use of uninitialized value in exec at /usr/bin/git-svn line 3451.
Use of uninitialized value in concatenation (.) or string at
/usr/bin/git-svn line 3451.
Can't run pager: Illegal seek ()
I don't get a shell prompt back. It just hangs.
This is on ubuntu feisty with the ubuntu-backport repositories enabled:
ii git-core 1.5.2.5-2~feisty1
ii git-svn 1.5.2.5-2~feisty1
^ permalink raw reply
* Re: Git as a filesystem
From: Eric Wong @ 2007-09-21 23:33 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Peter Stahlir, Johannes Schindelin, git
In-Reply-To: <alpine.LFD.0.9999.0709210912120.32185@xanadu.home>
Nicolas Pitre <nico@cam.org> wrote:
> On Fri, 21 Sep 2007, Peter Stahlir wrote:
>
> > This is was I was looking for. My motivation is whether it is possible
> > to run a system, for example Debian on a computer on top of gitfs,
> > and then have a huge mirror on it, for example a complete 252GB
> > Debian mirror as space efficient as possible.
> >
> > I wonder how big a deltified Debian mirror in one pack file would be. :)
>
> It would be just as big as the non gitified storage on disk.
>
> The space saving with git comes from efficient delta storage of
> _versioned_ files, i.e. multiple nearly identical versions of the same
> file where the stored delta is only the small difference between the
> first full version and subsequent versions. Unless you plan on storing
> many different Debian versions together, you won't benefit from any
> delta at all. And since Debian packages are already compressed, git
> won't be able to compress them further.
>
> So don't waste your time.
On a similar note, has anybody experimented with using git to
store maildirs or news spools? I'd imagine the quoted portions of
most message threads could be delta-compressed quite efficiently.
--
Eric Wong
^ permalink raw reply
* Re: cvsimport bug on branches [was: conversion to git]
From: Robin Rosenberg @ 2007-09-21 23:16 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Eric Blake, Steffen Prohaska, Jim Meyering, m4-patches,
Linus Torvalds, git
In-Reply-To: <Pine.LNX.4.64.0709212212020.28395@racer.site>
fredag 21 september 2007 skrev Johannes Schindelin:
> No, it's yet another dependency. And the quality of the code still
> depends on the programmer, not the language.
I think I can agree there, on both counts. But, if you want a good incremental
CVS importer and have access to the rcs files, that's the one there is.
git-cvsimport has a dependency on cvsps, which isn't included. You have to
to look it up yourself chooing among a dozen unequally bad versions.
Installing ruby isn't any harder.
The dependency excludes it from being included with Git, but it does not
disqualify it as a tool on it's own.
-- robin
^ permalink raw reply
* [PATCH] Allow shell scripts to run with non-Bash /bin/sh
From: Eygene Ryabinkin @ 2007-09-21 21:43 UTC (permalink / raw)
To: git
Good day.
I had found that FreeBSD's /bin/sh refuses to work with git 1.5.3.2.
correctly: no flags are recognized. The details and fix are below.
I don't currently know if the Bash's behaviour is POSIXly correct
or the 'case' statement semantics is not very well defined. But
the following patch fixes the things for the FreeBSD.
Here we go.
-----
Option parsing in the Git shell scripts uses the construct 'while
case "$#" in 0) break ;; esac; do ... done'. This is neat, because
it needs no external commands invocation. But in the case when
/bin/sh is not GNU Bash (for example, on FreeBSD) this cycle will
not be executed at all.
The fix is to add the case branch '*) : ;;'. It also needs no
external commands invocation and it does its work, because ':'
always returns zero.
Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
---
git-am.sh | 2 +-
git-clean.sh | 2 +-
git-commit.sh | 2 +-
git-fetch.sh | 2 +-
git-filter-branch.sh | 2 +-
git-instaweb.sh | 2 +-
git-ls-remote.sh | 2 +-
git-merge.sh | 2 +-
git-mergetool.sh | 2 +-
git-pull.sh | 2 +-
git-quiltimport.sh | 2 +-
git-rebase--interactive.sh | 2 +-
git-rebase.sh | 2 +-
git-repack.sh | 2 +-
git-reset.sh | 2 +-
git-submodule.sh | 2 +-
16 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 6809aa0..0bd8d34 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -109,7 +109,7 @@ dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary=
resolvemsg= resume=
git_apply_opt=
-while case "$#" in 0) break;; esac
+while case "$#" in 0) break;; *) : ;; esac
do
case "$1" in
-d=*|--d=*|--do=*|--dot=*|--dote=*|--dotes=*|--dotest=*)
diff --git a/git-clean.sh b/git-clean.sh
index a5cfd9f..1fac731 100755
--- a/git-clean.sh
+++ b/git-clean.sh
@@ -26,7 +26,7 @@ rmrf="rm -rf --"
rm_refuse="echo Not removing"
echo1="echo"
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
-d)
diff --git a/git-commit.sh b/git-commit.sh
index bb113e8..5f298c1 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -89,7 +89,7 @@ force_author=
only_include_assumed=
untracked_files=
templatefile="`git config commit.template`"
-while case "$#" in 0) break;; esac
+while case "$#" in 0) break;; *) : ;; esac
do
case "$1" in
-F|--F|-f|--f|--fi|--fil|--file)
diff --git a/git-fetch.sh b/git-fetch.sh
index c3a2001..dac2d72 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -27,7 +27,7 @@ shallow_depth=
no_progress=
test -t 1 || no_progress=--no-progress
quiet=
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
-a|--a|--ap|--app|--appe|--appen|--append)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index a4b6577..02b567b 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -105,7 +105,7 @@ filter_tag_name=
filter_subdir=
orig_namespace=refs/original/
force=
-while case "$#" in 0) usage;; esac
+while case "$#" in 0) usage;; *) : ;; esac
do
case "$1" in
--)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index b79c6b6..c85f8c0 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -61,7 +61,7 @@ stop_httpd () {
test -f "$fqgitdir/pid" && kill `cat "$fqgitdir/pid"`
}
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
--stop|stop)
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index b7e5d04..4ef4341 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -13,7 +13,7 @@ die () {
}
exec=
-while case "$#" in 0) break;; esac
+while case "$#" in 0) break;; *) : ;; esac
do
case "$1" in
-h|--h|--he|--hea|--head|--heads)
diff --git a/git-merge.sh b/git-merge.sh
index 3a01db0..94a50aa 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -122,7 +122,7 @@ merge_name () {
case "$#" in 0) usage ;; esac
have_message=
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 47a8055..0e286dd 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -268,7 +268,7 @@ merge_file () {
cleanup_temp_files
}
-while case $# in 0) break ;; esac
+while case $# in 0) break ;; *) : ;; esac
do
case "$1" in
-t|--tool*)
diff --git a/git-pull.sh b/git-pull.sh
index 5e96d1f..722ed4e 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -16,7 +16,7 @@ test -z "$(git ls-files -u)" ||
die "You are in the middle of a conflicted merge."
strategy_args= no_summary= no_commit= squash=
-while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
+while case "$#,$1" in 0) break ;; *,-*) : ;; *) break ;; esac
do
case "$1" in
-n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index 9de54d1..4039617 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -5,7 +5,7 @@ SUBDIRECTORY_ON=Yes
dry_run=""
quilt_author=""
-while case "$#" in 0) break;; esac
+while case "$#" in 0) break;; *) : ;; esac
do
case "$1" in
--au=*|--aut=*|--auth=*|--autho=*|--author=*)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index abc2b1c..54e4299 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -317,7 +317,7 @@ do_rest () {
done
}
-while case $# in 0) break ;; esac
+while case $# in 0) break ;; *) : ;; esac
do
case "$1" in
--continue)
diff --git a/git-rebase.sh b/git-rebase.sh
index 3bd66b0..f7ae22c 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -122,7 +122,7 @@ finish_rb_merge () {
is_interactive () {
test -f "$dotest"/interactive ||
- while case $#,"$1" in 0,|*,-i|*,--interactive) break ;; esac
+ while case $#,"$1" in 0,|*,-i|*,--interactive) break ;; *) : ;; esac
do
shift
done && test -n "$1"
diff --git a/git-repack.sh b/git-repack.sh
index 156c5e8..aac771e 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -9,7 +9,7 @@ SUBDIRECTORY_OK='Yes'
no_update_info= all_into_one= remove_redundant=
local= quiet= no_reuse= extra=
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
-n) no_update_info=t ;;
diff --git a/git-reset.sh b/git-reset.sh
index 1dc606f..eb92610 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -11,7 +11,7 @@ require_work_tree
update= reset_type=--mixed
unset rev
-while case $# in 0) break ;; esac
+while case $# in 0) break ;; *) : ;; esac
do
case "$1" in
--mixed | --soft | --hard)
diff --git a/git-submodule.sh b/git-submodule.sh
index 3320998..78a25ad 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -251,7 +251,7 @@ modules_list()
done
}
-while case "$#" in 0) break ;; esac
+while case "$#" in 0) break ;; *) : ;; esac
do
case "$1" in
add)
--
1.5.3.2
--
Eygene
^ permalink raw reply related
* [PATCH 5/5] gitweb: Add 'status_str' to parse_difftree_raw_line output
From: Jakub Narebski @ 2007-09-21 21:41 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Add 'status_str' to diffinfo output, which stores status (also for
merge commit) as a string. This allows for easy checking if there is
given status among all for merge commit, e.g.
$diffinfo->{'status_str'} =~ /D/
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is to simplify _future_ code, so I won't cry if it is not
accepted without some code that needs it.
gitweb/gitweb.perl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
[-- Attachment #2: 0005-gitweb-Add-status_str-to-parse_difftree_raw_line.patch --]
[-- Type: application/octet-stream, Size: 1501 bytes --]
From d5d0886111e98dc281d8503daa1ce655ea7729bf Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Thu, 13 Sep 2007 21:57:20 +0200
Subject: [PATCH 5/5] gitweb: Add 'status_str' to parse_difftree_raw_line output
Add 'status_str' to diffinfo output, which stores status (also for
merge commit) as a string. This allows for easy checking if there is
given status among all for merge commit, e.g.
$diffinfo->{'status_str'} =~ /D/
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This is to simplify _future_ code, so I won't cry if it is not
accepted without some code that needs it.
gitweb/gitweb.perl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6c79a95..adc1b32 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1963,7 +1963,7 @@ sub parse_difftree_raw_line {
$res{'to_mode'} = $2;
$res{'from_id'} = $3;
$res{'to_id'} = $4;
- $res{'status'} = $5;
+ $res{'status'} = $res{'status_str'} = $5;
$res{'similarity'} = $6;
if ($res{'status'} eq 'R' || $res{'status'} eq 'C') { # renamed or copied
($res{'from_file'}, $res{'to_file'}) = map { unquote($_) } split("\t", $7);
@@ -1979,6 +1979,7 @@ sub parse_difftree_raw_line {
$res{'to_mode'} = pop @{$res{'from_mode'}};
$res{'from_id'} = [ split(' ', $3) ];
$res{'to_id'} = pop @{$res{'from_id'}};
+ $res{'status_str'} = $4;
$res{'status'} = [ split('', $4) ];
$res{'to_file'} = unquote($5);
}
--
1.5.3
^ permalink raw reply related
* [PATCH 4/5] gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
From: Jakub Narebski @ 2007-09-21 21:39 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
Always set 'from_file' and 'to_file' keys when parsing raw diff output
format line, even if filename didn't change (file was not renamed).
This allows for less code (and no problems with file named '0'); use
this.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This simplifies code a bit _and_ fortifies gitweb against filenames
like '0' (although it does remove _fragments_ of lines, not lines
themselves, so it is not visible in diffstat).
gitweb/gitweb.perl | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
[-- Attachment #2: 0004-gitweb-Always-set-from_file-and-to_file-in-pars.patch --]
[-- Type: application/octet-stream, Size: 3488 bytes --]
From 9753f8b6a67239a4ed1ad5489965db37f7cbea89 Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Thu, 13 Sep 2007 21:57:03 +0200
Subject: [PATCH 4/5] gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
Always set 'from_file' and 'to_file' keys when parsing raw diff output
format line, even if filename didn't change (file was not renamed).
This allows for less code (and no problems with file named '0'); use
this.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This simplifies code a bit _and_ fortifies gitweb against filenames
like '0' (although it does remove _fragments_ of lines, not lines
themselves, so it is not visible in diffstat).
gitweb/gitweb.perl | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1b5642a..6c79a95 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1968,7 +1968,7 @@ sub parse_difftree_raw_line {
if ($res{'status'} eq 'R' || $res{'status'} eq 'C') { # renamed or copied
($res{'from_file'}, $res{'to_file'}) = map { unquote($_) } split("\t", $7);
} else {
- $res{'file'} = unquote($7);
+ $res{'from_file'} = $res{'to_file'} = $res{'file'} = unquote($7);
}
}
# '::100755 100755 100755 60e79ca1b01bc8b057abe17ddab484699a7f5fdb 94067cc5f73388f33722d52ae02f44692bc07490 94067cc5f73388f33722d52ae02f44692bc07490 MR git-gui/git-gui.sh'
@@ -2035,7 +2035,10 @@ sub parse_from_to_diffinfo {
fill_from_file_info($diffinfo, @parents)
unless exists $diffinfo->{'from_file'};
for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
- $from->{'file'}[$i] = $diffinfo->{'from_file'}[$i] || $diffinfo->{'to_file'};
+ $from->{'file'}[$i] =
+ defined $diffinfo->{'from_file'}[$i] ?
+ $diffinfo->{'from_file'}[$i] :
+ $diffinfo->{'to_file'};
if ($diffinfo->{'status'}[$i] ne "A") { # not new (added) file
$from->{'href'}[$i] = href(action=>"blob",
hash_base=>$parents[$i],
@@ -2047,7 +2050,7 @@ sub parse_from_to_diffinfo {
}
} else {
# ordinary (not combined) diff
- $from->{'file'} = $diffinfo->{'from_file'} || $diffinfo->{'file'};
+ $from->{'file'} = $diffinfo->{'from_file'};
if ($diffinfo->{'status'} ne "A") { # not new (added) file
$from->{'href'} = href(action=>"blob", hash_base=>$hash_parent,
hash=>$diffinfo->{'from_id'},
@@ -2057,7 +2060,7 @@ sub parse_from_to_diffinfo {
}
}
- $to->{'file'} = $diffinfo->{'to_file'} || $diffinfo->{'file'};
+ $to->{'file'} = $diffinfo->{'to_file'};
if (!is_deleted($diffinfo)) { # file exists in result
$to->{'href'} = href(action=>"blob", hash_base=>$hash,
hash=>$diffinfo->{'to_id'},
@@ -2802,7 +2805,7 @@ sub is_patch_split {
my ($diffinfo, $patchinfo) = @_;
return defined $diffinfo && defined $patchinfo
- && ($diffinfo->{'to_file'} || $diffinfo->{'file'}) eq $patchinfo->{'to_file'};
+ && $diffinfo->{'to_file'} eq $patchinfo->{'to_file'};
}
@@ -4637,8 +4640,8 @@ sub git_blobdiff {
}
%diffinfo = parse_difftree_raw_line($difftree[0]);
- $file_parent ||= $diffinfo{'from_file'} || $file_name || $diffinfo{'file'};
- $file_name ||= $diffinfo{'to_file'} || $diffinfo{'file'};
+ $file_parent ||= $diffinfo{'from_file'} || $file_name;
+ $file_name ||= $diffinfo{'to_file'};
$hash_parent ||= $diffinfo{'from_id'};
$hash ||= $diffinfo{'to_id'};
--
1.5.3
^ permalink raw reply related
* [PATCH 3/5] gitweb: Fix and simplify "split patch" detection
From: Jakub Narebski @ 2007-09-21 21:38 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 2746 bytes --]
There are some cases when one line from "raw" git-diff output (raw
format) corresponds to more than one patch in the patchset git-diff
output; we call this situation "split patch". Old code misdetected
subsequent patches (for different files) with the same pre-image and
post-image as fragments of "split patch", leading to mislabeled
from-file/to-file diff header etc.
Old code used pre-image and post-image SHA-1 identifier ('from_id' and
'to_id') to check if current patch corresponds to old raw diff format
line, to find if one difftree raw line coresponds to more than one
patch in the patch format. Now we use post-image filename for that.
This assumes that post-image filename alone can be used to identify
difftree raw line. In the case this changes (which is unlikely
considering current diff engine) we can add 'from_id' and 'to_id'
to detect "patch splitting" together with 'to_file'.
Because old code got pre-image and post-image SHA-1 identifier for the
patch from the "index" line in extended diff header, diff header had
to be buffered. New code takes post-image filename from "git diff"
header, which is first line of a patch; this allows to simplify
git_patchset_body code. A side effect of resigning diff header
buffering is that there is always "diff extended_header" div, even
if extended diff header is empty.
Alternate solution would be to check when git splits patches, and do
not check if parsed info from current patch corresponds to current or
next raw diff format output line. Git splits patches only for 'T'
(typechange) status filepair, and there always two patches
corresponding to one raw diff line. It was not used because it would
tie gitweb code to minute details of git diff output.
While at it, use newly introduced parsed_difftree_line wrapper
subroutine in git_difftree_body.
Noticed-by: Yann Dirson <ydirson@altern.org>
Diagnosed-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Junio has decided in
Message-ID: <7vmyw4ob7z.fsf@gitster.siamese.dyndns.org>
that tying gitweb to minute details of git diff output, namely that
we have "split patch" (two patches of patchset diff format for single
line of raw ditt format) only for typechange (status 'T') diffs.
We make other assumption instead, that post-image filename uniquely
defines line of raw git diff output. Currently diffcore is not
capable of producing other output; see Junio in
Message-ID: <7vtzqcj9ni.fsf@gitster.siamese.dyndns.org>
This assumption simplifies git_patchset_body, as we no longer need
to cache extended diff header for "split patch" detection.
gitweb/gitweb.perl | 152 +++++++++++++++++++++++-----------------------------
1 files changed, 67 insertions(+), 85 deletions(-)
[-- Attachment #2: 0003-gitweb-Fix-and-simplify-split-patch-detection.patch --]
[-- Type: application/octet-stream, Size: 11563 bytes --]
From a4dc45e0cb307d352fd9116507a7e128f8e0d503 Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sun, 9 Sep 2007 21:34:10 +0200
Subject: [PATCH 3/5] gitweb: Fix and simplify "split patch" detection
There are some cases when one line from "raw" git-diff output (raw
format) corresponds to more than one patch in the patchset git-diff
output; we call this situation "split patch". Old code misdetected
subsequent patches (for different files) with the same pre-image and
post-image as fragments of "split patch", leading to mislabeled
from-file/to-file diff header etc.
Old code used pre-image and post-image SHA-1 identifier ('from_id' and
'to_id') to check if current patch corresponds to old raw diff format
line, to find if one difftree raw line coresponds to more than one
patch in the patch format. Now we use post-image filename for that.
This assumes that post-image filename alone can be used to identify
difftree raw line. In the case this changes (which is unlikely
considering current diff engine) we can add 'from_id' and 'to_id'
to detect "patch splitting" together with 'to_file'.
Because old code got pre-image and post-image SHA-1 identifier for the
patch from the "index" line in extended diff header, diff header had
to be buffered. New code takes post-image filename from "git diff"
header, which is first line of a patch; this allows to simplify
git_patchset_body code. A side effect of resigning diff header
buffering is that there is always "diff extended_header" div, even
if extended diff header is empty.
Alternate solution would be to check when git splits patches, and do
not check if parsed info from current patch corresponds to current or
next raw diff format output line. Git splits patches only for 'T'
(typechange) status filepair, and there always two patches
corresponding to one raw diff line. It was not used because it would
tie gitweb code to minute details of git diff output.
While at it, use newly introduced parsed_difftree_line wrapper
subroutine in git_difftree_body.
Noticed-by: Yann Dirson <ydirson@altern.org>
Diagnosed-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Junio has decided in
Message-ID: <7vmyw4ob7z.fsf@gitster.siamese.dyndns.org>
that tying gitweb to minute details of git diff output, namely that
we have "split patch" (two patches of patchset diff format for single
line of raw ditt format) only for typechange (status 'T') diffs.
We make other assumption instead, that post-image filename uniquely
defines line of raw git diff output. Currently diffcore is not
capable of producing other output; see Junio in
Message-ID: <7vtzqcj9ni.fsf@gitster.siamese.dyndns.org>
This assumption simplifies git_patchset_body, as we no longer need
to cache extended diff header for "split patch" detection.
gitweb/gitweb.perl | 152 +++++++++++++++++++++++-----------------------------
1 files changed, 67 insertions(+), 85 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3064298..1b5642a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1990,6 +1990,19 @@ sub parse_difftree_raw_line {
return wantarray ? %res : \%res;
}
+# wrapper: return parsed line of git-diff-tree "raw" output
+# (the argument might be raw line, or parsed info)
+sub parsed_difftree_line {
+ my $line_or_ref = shift;
+
+ if (ref($line_or_ref) eq "HASH") {
+ # pre-parsed (or generated by hand)
+ return $line_or_ref;
+ } else {
+ return parse_difftree_raw_line($line_or_ref);
+ }
+}
+
# parse line of git-ls-tree output
sub parse_ls_tree_line ($;%) {
my $line = shift;
@@ -2033,6 +2046,7 @@ sub parse_from_to_diffinfo {
}
}
} else {
+ # ordinary (not combined) diff
$from->{'file'} = $diffinfo->{'from_file'} || $diffinfo->{'file'};
if ($diffinfo->{'status'} ne "A") { # not new (added) file
$from->{'href'} = href(action=>"blob", hash_base=>$hash_parent,
@@ -2756,6 +2770,7 @@ sub git_print_tree_entry {
## ......................................................................
## functions printing large fragments of HTML
+# get pre-image filenames for merge (combined) diff
sub fill_from_file_info {
my ($diff, @parents) = @_;
@@ -2772,28 +2787,25 @@ sub fill_from_file_info {
return $diff;
}
-# parameters can be strings, or references to arrays of strings
-sub from_ids_eq {
- my ($a, $b) = @_;
-
- if (ref($a) eq "ARRAY" && ref($b) eq "ARRAY" && @$a == @$b) {
- for (my $i = 0; $i < @$a; ++$i) {
- return 0 unless ($a->[$i] eq $b->[$i]);
- }
- return 1;
- } elsif (!ref($a) && !ref($b)) {
- return $a eq $b;
- } else {
- return 0;
- }
-}
-
+# is current raw difftree line of file deletion
sub is_deleted {
my $diffinfo = shift;
return $diffinfo->{'to_id'} eq ('0' x 40);
}
+# does patch correspond to [previous] difftree raw line
+# $diffinfo - hashref of parsed raw diff format
+# $patchinfo - hashref of parsed patch diff format
+# (the same keys as in $diffinfo)
+sub is_patch_split {
+ my ($diffinfo, $patchinfo) = @_;
+
+ return defined $diffinfo && defined $patchinfo
+ && ($diffinfo->{'to_file'} || $diffinfo->{'file'}) eq $patchinfo->{'to_file'};
+}
+
+
sub git_difftree_body {
my ($difftree, $hash, @parents) = @_;
my ($parent) = $parents[0];
@@ -2830,13 +2842,7 @@ sub git_difftree_body {
my $alternate = 1;
my $patchno = 0;
foreach my $line (@{$difftree}) {
- my $diff;
- if (ref($line) eq "HASH") {
- # pre-parsed (or generated by hand)
- $diff = $line;
- } else {
- $diff = parse_difftree_raw_line($line);
- }
+ my $diff = parsed_difftree_line($line);
if ($alternate) {
print "<tr class=\"dark\">\n";
@@ -3107,10 +3113,12 @@ sub git_patchset_body {
my ($fd, $difftree, $hash, @hash_parents) = @_;
my ($hash_parent) = $hash_parents[0];
+ my $is_combined = (@hash_parents > 1);
my $patch_idx = 0;
my $patch_number = 0;
my $patch_line;
my $diffinfo;
+ my $to_name;
my (%from, %to);
print "<div class=\"patchset\">\n";
@@ -3124,73 +3132,46 @@ sub git_patchset_body {
PATCH:
while ($patch_line) {
- my @diff_header;
- my ($from_id, $to_id);
-
- # git diff header
- #assert($patch_line =~ m/^diff /) if DEBUG;
- #assert($patch_line !~ m!$/$!) if DEBUG; # is chomp-ed
- $patch_number++;
- push @diff_header, $patch_line;
-
- # extended diff header
- EXTENDED_HEADER:
- while ($patch_line = <$fd>) {
- chomp $patch_line;
- last EXTENDED_HEADER if ($patch_line =~ m/^--- |^diff /);
-
- if ($patch_line =~ m/^index ([0-9a-fA-F]{40})..([0-9a-fA-F]{40})/) {
- $from_id = $1;
- $to_id = $2;
- } elsif ($patch_line =~ m/^index ((?:[0-9a-fA-F]{40},)+[0-9a-fA-F]{40})..([0-9a-fA-F]{40})/) {
- $from_id = [ split(',', $1) ];
- $to_id = $2;
- }
-
- push @diff_header, $patch_line;
+ # parse "git diff" header line
+ if ($patch_line =~ m/^diff --git (\"(?:[^\\\"]*(?:\\.[^\\\"]*)*)\"|[^ "]*) (.*)$/) {
+ # $1 is from_name, which we do not use
+ $to_name = unquote($2);
+ $to_name =~ s!^b/!!;
+ } elsif ($patch_line =~ m/^diff --(cc|combined) ("?.*"?)$/) {
+ # $1 is 'cc' or 'combined', which we do not use
+ $to_name = unquote($2);
+ } else {
+ $to_name = undef;
}
- my $last_patch_line = $patch_line;
# check if current patch belong to current raw line
# and parse raw git-diff line if needed
- if (defined $diffinfo &&
- defined $from_id && defined $to_id &&
- from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
- $diffinfo->{'to_id'} eq $to_id) {
+ if (is_patch_split($diffinfo, { 'to_file' => $to_name })) {
# this is continuation of a split patch
print "<div class=\"patch cont\">\n";
} else {
# advance raw git-diff output if needed
$patch_idx++ if defined $diffinfo;
- # compact combined diff output can have some patches skipped
- # find which patch (using pathname of result) we are at now
- my $to_name;
- if ($diff_header[0] =~ m!^diff --cc "?(.*)"?$!) {
- $to_name = $1;
- }
-
- do {
- # read and prepare patch information
- if (ref($difftree->[$patch_idx]) eq "HASH") {
- # pre-parsed (or generated by hand)
- $diffinfo = $difftree->[$patch_idx];
- } else {
- $diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
- }
+ # read and prepare patch information
+ $diffinfo = parsed_difftree_line($difftree->[$patch_idx]);
- # check if current raw line has no patch (it got simplified)
- if (defined $to_name && $to_name ne $diffinfo->{'to_file'}) {
+ # compact combined diff output can have some patches skipped
+ # find which patch (using pathname of result) we are at now;
+ if ($is_combined) {
+ while ($to_name ne $diffinfo->{'to_file'}) {
print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
format_diff_cc_simplified($diffinfo, @hash_parents) .
"</div>\n"; # class="patch"
$patch_idx++;
$patch_number++;
+
+ last if $patch_idx > $#$difftree;
+ $diffinfo = parsed_difftree_line($difftree->[$patch_idx]);
}
- } until (!defined $to_name || $to_name eq $diffinfo->{'to_file'} ||
- $patch_idx > $#$difftree);
+ }
# modifies %from, %to hashes
parse_from_to_diffinfo($diffinfo, \%from, \%to, @hash_parents);
@@ -3200,30 +3181,36 @@ sub git_patchset_body {
print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n";
}
+ # git diff header
+ #assert($patch_line =~ m/^diff /) if DEBUG;
+ #assert($patch_line !~ m!$/$!) if DEBUG; # is chomp-ed
+ $patch_number++;
# print "git diff" header
- $patch_line = shift @diff_header;
print format_git_diff_header_line($patch_line, $diffinfo,
\%from, \%to);
# print extended diff header
- print "<div class=\"diff extended_header\">\n" if (@diff_header > 0);
+ print "<div class=\"diff extended_header\">\n";
EXTENDED_HEADER:
- foreach $patch_line (@diff_header) {
+ while ($patch_line = <$fd>) {
+ chomp $patch_line;
+
+ last EXTENDED_HEADER if ($patch_line =~ m/^--- |^diff /);
+
print format_extended_diff_header_line($patch_line, $diffinfo,
\%from, \%to);
}
- print "</div>\n" if (@diff_header > 0); # class="diff extended_header"
+ print "</div>\n"; # class="diff extended_header"
# from-file/to-file diff header
- $patch_line = $last_patch_line;
if (! $patch_line) {
print "</div>\n"; # class="patch"
last PATCH;
}
next PATCH if ($patch_line =~ m/^diff /);
#assert($patch_line =~ m/^---/) if DEBUG;
- #assert($patch_line eq $last_patch_line) if DEBUG;
+ my $last_patch_line = $patch_line;
$patch_line = <$fd>;
chomp $patch_line;
#assert($patch_line =~ m/^\+\+\+/) if DEBUG;
@@ -3248,16 +3235,11 @@ sub git_patchset_body {
# for compact combined (--cc) format, with chunk and patch simpliciaction
# patchset might be empty, but there might be unprocessed raw lines
- for ($patch_idx++ if $patch_number > 0;
+ for (++$patch_idx if $patch_number > 0;
$patch_idx < @$difftree;
- $patch_idx++) {
+ ++$patch_idx) {
# read and prepare patch information
- if (ref($difftree->[$patch_idx]) eq "HASH") {
- # pre-parsed (or generated by hand)
- $diffinfo = $difftree->[$patch_idx];
- } else {
- $diffinfo = parse_difftree_raw_line($difftree->[$patch_idx]);
- }
+ $diffinfo = parsed_difftree_line($difftree->[$patch_idx]);
# generate anchor for "patch" links in difftree / whatchanged part
print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n" .
--
1.5.3
^ permalink raw reply related
* [PATCH 2/5] gitweb: No difftree output for trivial merge
From: Jakub Narebski @ 2007-09-21 21:36 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
In 'commitdiff' view, for the merge commit, there is an extra header
for the difftree table, with links to commitdiffs to individual
parents. Do not show such header when there is nothing to show, for
trivial merges.
This means that for trivial merge you have to go to 'commit' view
to get links to diffs to each parent.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
It looked a bit stupid, lone "_1_ _2_" links.
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
[-- Attachment #2: 0002-gitweb-No-difftree-output-for-trivial-merge.patch --]
[-- Type: application/octet-stream, Size: 1193 bytes --]
From e895e5b63a580a54c24509a0df631ff4d3dff658 Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sat, 8 Sep 2007 21:54:28 +0200
Subject: [PATCH 2/5] gitweb: No difftree output for trivial merge
In 'commitdiff' view, for the merge commit, there is an extra header
for the difftree table, with links to commitdiffs to individual
parents. Do not show such header when there is nothing to show, for
trivial merges.
This means that for trivial merge you have to go to 'commit' view
to get links to diffs to each parent.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
It looked a bit stupid, lone "_1_ _2_" links.
gitweb/gitweb.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c18339f..3064298 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2809,7 +2809,7 @@ sub git_difftree_body {
"diff_tree\">\n";
# header only for combined diff in 'commitdiff' view
- my $has_header = @parents > 1 && $action eq 'commitdiff';
+ my $has_header = @$difftree && @parents > 1 && $action eq 'commitdiff';
if ($has_header) {
# table header
print "<thead><tr>\n" .
--
1.5.3
^ permalink raw reply related
* [PATCH 1/5] gitweb: Remove parse_from_to_diffinfo code from git_patchset_body
From: Jakub Narebski @ 2007-09-21 21:35 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 704 bytes --]
In commit 90921740bd00029708370673fdc537522aa48e6f
"gitweb: Split git_patchset_body into separate subroutines"
a part of git_patchset_body code was separated into parse_from_to_diffinfo
subroutine. But instead of replacing the separated code by the call to
mentioned subroutine, the call to subroutine was placed before the separated
code. This patch removes parse_from_to_diffinfo code from git_patchset_body
subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
My bad...
I hope the explanation is clean enough. It does make reading
git_patchset_body code much easier.
gitweb/gitweb.perl | 36 +-----------------------------------
1 files changed, 1 insertions(+), 35 deletions(-)
[-- Attachment #2: 0001-gitweb-Remove-parse_from_to_diffinfo-code-from-git_.patch --]
[-- Type: application/octet-stream, Size: 2986 bytes --]
From 5016a1968b651ca971968f917e22dd7ce988e23d Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sat, 8 Sep 2007 21:49:11 +0200
Subject: [PATCH 1/5] gitweb: Remove parse_from_to_diffinfo code from git_patchset_body
In commit 90921740bd00029708370673fdc537522aa48e6f
"gitweb: Split git_patchset_body into separate subroutines"
a part of git_patchset_body code was separated into parse_from_to_diffinfo
subroutine. But instead of replacing the separated code by the call to
mentioned subroutine, the call to subroutine was placed before the separated
code. This patch removes parse_from_to_diffinfo code from git_patchset_body
subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
My bad...
I hope the explanation is clean enough. It does make reading
git_patchset_body code much easier.
gitweb/gitweb.perl | 36 +-----------------------------------
1 files changed, 1 insertions(+), 35 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b2bae1b..c18339f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3191,44 +3191,10 @@ sub git_patchset_body {
}
} until (!defined $to_name || $to_name eq $diffinfo->{'to_file'} ||
$patch_idx > $#$difftree);
+
# modifies %from, %to hashes
parse_from_to_diffinfo($diffinfo, \%from, \%to, @hash_parents);
- if ($diffinfo->{'nparents'}) {
- # combined diff
- $from{'file'} = [];
- $from{'href'} = [];
- fill_from_file_info($diffinfo, @hash_parents)
- unless exists $diffinfo->{'from_file'};
- for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
- $from{'file'}[$i] = $diffinfo->{'from_file'}[$i] || $diffinfo->{'to_file'};
- if ($diffinfo->{'status'}[$i] ne "A") { # not new (added) file
- $from{'href'}[$i] = href(action=>"blob",
- hash_base=>$hash_parents[$i],
- hash=>$diffinfo->{'from_id'}[$i],
- file_name=>$from{'file'}[$i]);
- } else {
- $from{'href'}[$i] = undef;
- }
- }
- } else {
- $from{'file'} = $diffinfo->{'from_file'} || $diffinfo->{'file'};
- if ($diffinfo->{'status'} ne "A") { # not new (added) file
- $from{'href'} = href(action=>"blob", hash_base=>$hash_parent,
- hash=>$diffinfo->{'from_id'},
- file_name=>$from{'file'});
- } else {
- delete $from{'href'};
- }
- }
- $to{'file'} = $diffinfo->{'to_file'} || $diffinfo->{'file'};
- if (!is_deleted($diffinfo)) { # file exists in result
- $to{'href'} = href(action=>"blob", hash_base=>$hash,
- hash=>$diffinfo->{'to_id'},
- file_name=>$to{'file'});
- } else {
- delete $to{'href'};
- }
# this is first patch for raw difftree line with $patch_idx index
# we index @$difftree array from 0, but number patches from 1
print "<div class=\"patch\" id=\"patch". ($patch_idx+1) ."\">\n";
--
1.5.3
^ permalink raw reply related
* [PATCH 0/5] gitweb: Fixes and improvements related to diffs
From: Jakub Narebski @ 2007-09-21 21:31 UTC (permalink / raw)
To: git
This series of patches adds fixes, simplifications and improvements
related to diff handling in gitweb ('commit', 'commitdiff' views).
Becaus I didn't have access to Internet, this series is based
on 1e61b7640d09015213dbcae3564fa27ac6a8c151 (v1.5.3.1-1-g1e61b76).
As I am sending it via GMail WWW interface, patches are send as
attachements.
I send this series now, even without good Internet access,
because it contains two bugfixes, and one code fix. I'll try to
resend it rebase on top of current master later...
Shortlog:
=========
Jakub Narebski (5):
gitweb: Remove parse_from_to_diffinfo code from git_patchset_body
gitweb: No difftree output for trivial merge
gitweb: Fix and simplify "split patch" detection
gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
gitweb: Add 'status_str' to parse_difftree_raw_line output
Diffstat:
=========
gitweb/gitweb.perl | 208 ++++++++++++++++++++--------------------------------
1 files changed, 80 insertions(+), 128 deletions(-)
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH] [git-p4] Detect exec bit in more cases.
From: David Brown @ 2007-09-21 21:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Simon Hausmann, git
In-Reply-To: <7vfy17iuu9.fsf@gitster.siamese.dyndns.org>
On Fri, Sep 21, 2007 at 02:15:10PM -0700, Junio C Hamano wrote:
>Simon Hausmann <simon@lst.de> writes:
>
>> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>>> David Brown <git@davidb.org> writes:
>>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>>> >>> git-p4 was missing the execute bit setting if the file had other
>>> >>> attribute bits set.
>>> >>> ---
>>> >>
>>> >>I'm fine with this, so unless you find a better way:
>>> >>
>>> >>Acked-By: Simon Hausmann <simon@lst.de>
>>> >
>>> > I sent out an improved version of this patch yesterday
>>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>>> > approved. I guess I'm not quite sure what happens at this point with a
>>> > patch.
>>>
>>> I still have that *768445* message as "the last one proposed as
>>> better than previous ones" in my mbox.
>>>
>>> Simon?
>>
>> Indeed, the new improved version is much better :)
>>
>> Acked-By: Simon Hausmann <simon@lst.de>
>
>Thanks. This should go to 'maint' (part of v1.5.3.3) right?
Sounds good by me. I've been using it on a few other repos, and haven't
had any problems.
David
^ permalink raw reply
* Re: [PATCH] [git-p4] Detect exec bit in more cases.
From: Junio C Hamano @ 2007-09-21 21:15 UTC (permalink / raw)
To: Simon Hausmann; +Cc: David Brown, git
In-Reply-To: <200709211220.05434.simon@lst.de>
Simon Hausmann <simon@lst.de> writes:
> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>> David Brown <git@davidb.org> writes:
>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> >>> git-p4 was missing the execute bit setting if the file had other
>> >>> attribute bits set.
>> >>> ---
>> >>
>> >>I'm fine with this, so unless you find a better way:
>> >>
>> >>Acked-By: Simon Hausmann <simon@lst.de>
>> >
>> > I sent out an improved version of this patch yesterday
>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>> > approved. I guess I'm not quite sure what happens at this point with a
>> > patch.
>>
>> I still have that *768445* message as "the last one proposed as
>> better than previous ones" in my mbox.
>>
>> Simon?
>
> Indeed, the new improved version is much better :)
>
> Acked-By: Simon Hausmann <simon@lst.de>
Thanks. This should go to 'maint' (part of v1.5.3.3) right?
^ permalink raw reply
* Re: cvsimport bug on branches [was: conversion to git]
From: Johannes Schindelin @ 2007-09-21 21:12 UTC (permalink / raw)
To: Robin Rosenberg
Cc: Linus Torvalds, Steffen Prohaska, Eric Blake, m4-patches,
Jim Meyering, git
In-Reply-To: <200709212242.53131.robin.rosenberg.lists@dewire.com>
Hi,
On Fri, 21 Sep 2007, Robin Rosenberg wrote:
> fredag 21 september 2007 skrev Johannes Schindelin:
> > Hi,
> >
> > On Fri, 21 Sep 2007, Robin Rosenberg wrote:
> >
> > > fredag 21 september 2007 skrev Linus Torvalds:
> > > >
> > > > The big advantage of git-cvsimport is that it can do incremental
> > > > imports, which I don't think the other methods do. But if there is any
> > > > choice at all, and especially if you're not that interested in the
> > > > incremental feature (ie you can cut over to git, and perhaps use
> > > > git-cvsserver to "supprt" CVS users) the other CVS importers are
> > > > likely to be much better.
> > >
> > > fromcvs does incremental import and it's very fast and uses much less
> > > memory than cvsimport. It needs the rcs files however and will not
> > > convert non-branch tags.
> >
> > Plus you have to install Ruby. Just wanted people to know.
>
> You don't like Ruby, do you? It worth it, really.
No, it's yet another dependency. And the quality of the code still
depends on the programmer, not the language.
Ciao,
Dscho
^ 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