* [cogito PATCH] Add "-c" (colorize) option to cg-diff
From: Catalin Marinas @ 2005-05-20 14:58 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
An option I found quite useful in quilt. I just copied the
corresponding code from quilt (released under GPLv2) to cg-diff.
Catalin
[-- Attachment #2: patch-color-diff --]
[-- Type: text/plain, Size: 3131 bytes --]
Add "-c" (colorize) option to cg-diff
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Index: cg-diff
===================================================================
--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-diff (mode:100755)
+++ uncommitted/cg-diff (mode:100755)
@@ -14,6 +14,8 @@
# -p instead of one ID denotes a parent commit to the specified ID
# (which must not be a tree, obviously).
#
+# -c colorizes the diff output
+#
# Outputs a diff converting the first tree to the second one.
. ${COGITO_LIB}cg-Xlib
@@ -22,7 +24,17 @@
id1=" "
id2=" "
parent=
+opt_color=
+setup_colors()
+{
+ local C=diff_hdr=32:diff_add=36:diff_mod=35:diff_rem=35:diff_hunk=33:diff_ctx=35:diff_cctx=33:patch_offs=33:patch_fuzz=35:patch_fail=31:clear=00
+ [ -n "$COGITO_COLORS" ] && C="$C:$COGITO_COLORS"
+
+ C=${C//=/=\'$'\e'[}
+ C=color_${C//:/m\'; color_}m\'
+ eval $C
+}
# FIXME: The commandline parsing is awful.
@@ -31,6 +43,12 @@
parent=1
fi
+if [ "$1" = "-c" ]; then
+ shift
+ opt_color=1
+ setup_colors
+fi
+
if [ "$1" = "-r" ]; then
shift
id1=$(echo "$1": | cut -d : -f 1)
@@ -44,6 +62,32 @@
shift
fi
+colorize() {
+ if [ "$opt_color" ]; then
+ /usr/bin/gawk '
+ { if (/^(Index:|\-\-\-|\+\+\+|\*\*\*) /)
+ print "'$color_diff_hdr'" $0 "'$color_clear'"
+ else if (/^\+/)
+ print "'$color_diff_add'" $0 "'$color_clear'"
+ else if (/^-/)
+ print "'$color_diff_rem'" $0 "'$color_clear'"
+ else if (/^!/)
+ print "'$color_diff_mod'" $0 "'$color_clear'"
+ else if (/^@@ \-[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@/)
+ print gensub(/^(@@[^@]*@@)([ \t]*)(.*)/,
+ "'$color_diff_hunk'" "\\1" "'$color_clear'" \
+ "\\2" \
+ "'$color_diff_ctx'" "\\3" "'$color_clear'", "")
+ else if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/)
+ print "'$color_diff_cctx'" $0 "'$color_clear'"
+ else
+ print
+ }'
+ else
+ cat
+ fi
+}
+
if [ "$parent" ]; then
id2="$id1"
id1=$(parent-id "$id2" | head -n 1)
@@ -71,7 +115,7 @@
# FIXME: Update ret based on what did we match. And take "$@"
# to account after all.
ret=
- git-diff-cache -r -z $tree | xargs -0 ${COGITO_LIB}cg-Xdiffdo "$tree" uncommitted "$filter"
+ git-diff-cache -r -z $tree | xargs -0 ${COGITO_LIB}cg-Xdiffdo "$tree" uncommitted "$filter" | colorize
[ "$filter" ] && rm $filter
@@ -85,7 +129,7 @@
[ "$id1" = "$id2" ] && die "trying to diff $id1 against itself"
-git-diff-tree -r -z $id1 $id2 | xargs -0 ${COGITO_LIB}cg-Xdiffdo $id1 $id2 "$filter"
+git-diff-tree -r -z $id1 $id2 | xargs -0 ${COGITO_LIB}cg-Xdiffdo $id1 $id2 "$filter" | colorize
[ "$filter" ] && rm $filter
exit 0
Index: cg-help
===================================================================
--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-help (mode:100755)
+++ uncommitted/cg-help (mode:100755)
@@ -26,7 +26,7 @@
cg-cancel
cg-clone [-s] SOURCE_LOC [DESTDIR]
cg-commit [-m"Commit message"]... [-e | -E] [FILE]... < log message
- cg-diff [-p] [-r FROM_ID[:TO_ID]] [FILE]...
+ cg-diff [-p] [-c] [-r FROM_ID[:TO_ID]] [FILE]...
cg-export DEST [TREE_ID]
cg-help [COMMAND]
cg-init
^ permalink raw reply
* [PATCH] cg-log: make -r id:id show the given id instead of nothing
From: Jonas Fonseca @ 2005-05-20 15:04 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
If cg-log is passed -r cogito-0.10 -r cogito-0.10 no log entries are
shown. This patch make it show the log for the given ID.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Index: cg-log
===================================================================
--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-log (mode:100755)
+++ uncommitted/cg-log (mode:100755)
@@ -113,6 +113,9 @@
if [ "$log_end" ]; then
id1="$(commit-id $log_start)" || exit 1
id2="$(commit-id $log_end)" || exit 1
+ if [ "$id1" = "$id2" ]; then
+ id1=$(git-cat-file commit $id1 | sed -n '/^parent /,0s/parent //p')
+ fi
revls="git-rev-tree $id2 ^$id1"
revsort="sort -rn"
revfmt="git-rev-tree"
--
Jonas Fonseca
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Linus Torvalds @ 2005-05-20 15:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vacmquet3.fsf@assigned-by-dhcp.cox.net>
On Fri, 20 May 2005, Junio C Hamano wrote:
>
> I was preparing a set of tests for diff family because I wanted
> to have something that catches screwups I am going to inflict
> upon them during the coming couple of days. One of the tests
> accidentally found out that the above is not true in the current
> implementation. Just an excerpt of relevant lines [*1*]:
>
> $ git-diff-tree -r $tree_B $tree_A
>
> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
>
> $ git-diff-tree -R $tree_A $tree_B
>
> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
Ahh.. "diff-tree" uses the wrong algorithm for selecting name ordering.
It thinks that "DF" and "DF/" sort equally because it just looks at the
name, not the type. So then, becuse the names sort the same, it will sort
them according to where they come from, and you get the behaviour you see.
It doesn't really matter, but you're right, I should fix it to be
consistent.
git-diff-cache and git-diff-files should automaticallu get it right thanks
to reading the whole tree, so it's likely just git-diff-tree that can get
confused.
Linus
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Junio C Hamano @ 2005-05-20 15:29 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200806150.2206@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Fri, 20 May 2005, Junio C Hamano wrote:
>>
>> I was preparing a set of tests for diff family because I wanted
>> to have something that catches screwups I am going to inflict
>> upon them during the coming couple of days. One of the tests
>> accidentally found out that the above is not true in the current
>> implementation. Just an excerpt of relevant lines [*1*]:
>>
>> $ git-diff-tree -r $tree_B $tree_A
>>
>> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
>> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
>> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
>> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
>>
>> $ git-diff-tree -R $tree_A $tree_B
>>
>> +100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
>> -100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
>> +100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
>> -100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
LT> Ahh.. "diff-tree" uses the wrong algorithm for selecting name ordering.
LT> It thinks that "DF" and "DF/" sort equally because it just looks at the
LT> name, not the type. So then, becuse the names sort the same, it will sort
LT> them according to where they come from, and you get the behaviour you see.
LT> It doesn't really matter, but you're right, I should fix it to be
LT> consistent.
Don't bother. I already have a fix with the test case.
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Junio C Hamano @ 2005-05-20 15:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200806150.2206@ppc970.osdl.org>
Keep git-diff-tree output sorted in cache order on dir/file swap.
When one tree has a tree where the other has a blob, diff-tree
always outputs delete/create pair for that entry; deletion of
the entry in the first tree is output first and then creation in
the second tree. This order results in entries in the
subdirectories from the first tree reported before the plain
blob is shown from the second tree, i.e. not in the cache order.
This inconsistency may break downstream tools that expect the
entries are sorted, since the git-* tools that output paths in
all other cases do so in the cache order. Also this is needed
to make "diff-tree A B" === "diff-tree -R B A".
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff-tree.c | 16 +++
t/lib-read-tree-m-3way.sh | 144 +++++++++++++++++++++++++++++++++
t/t1000-read-tree-m-3way.sh | 171 ----------------------------------------
t/t4002-diff-basic.sh | 187 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 347 insertions(+), 171 deletions(-)
new file (100755): t/lib-read-tree-m-3way.sh
new file (100755): t/t4002-diff-basic.sh
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -124,8 +124,22 @@ static int compare_tree_entry(void *tree
* file, we need to consider it a remove and an add.
*/
if (S_ISDIR(mode1) != S_ISDIR(mode2)) {
- show_file("-", tree1, size1, base);
+ /*
+ * This "one_first" is needed for keeping the output in
+ * the cache entry order. Otherwise, "diff A B" becomes
+ * different from "diff -R B A".
+ *
+ * It may look counterintuitive that one_first is not
+ * defined as (!recursive || S_ISDIR(mode2)), but this
+ * is deliberate; again otherwise, "diff A B" becomes
+ * different from "diff -R B A".
+ */
+ int one_first = S_ISDIR(mode2);
+ if (one_first)
+ show_file("-", tree1, size1, base);
show_file("+", tree2, size2, base);
+ if (!one_first)
+ show_file("-", tree1, size1, base);
return 0;
}
diff --git a/t/lib-read-tree-m-3way.sh b/t/lib-read-tree-m-3way.sh
new file mode 100755
--- /dev/null
+++ b/t/lib-read-tree-m-3way.sh
@@ -0,0 +1,144 @@
+: Included from t1000-read-tree-m-3way.sh and others
+# Original tree.
+mkdir Z
+for a in N D M
+do
+ for b in N D M
+ do
+ p=$a$b
+ echo This is $p from the original tree. >$p
+ echo This is Z/$p from the original tree. >Z/$p
+ test_expect_success \
+ "adding test file $p and Z/$p" \
+ 'git-update-cache --add $p &&
+ git-update-cache --add Z/$p'
+ done
+done
+echo This is SS from the original tree. >SS
+test_expect_success \
+ 'adding test file SS' \
+ 'git-update-cache --add SS'
+cat >TT <<\EOF
+This is a trivial merge sample text.
+Branch A is expected to upcase this word, here.
+There are some filler lines to avoid diff context
+conflicts here,
+like this one,
+and this one,
+and this one is yet another one of them.
+At the very end, here comes another line, that is
+the word, expected to be upcased by Branch B.
+This concludes the trivial merge sample file.
+EOF
+test_expect_success \
+ 'adding test file TT' \
+ 'git-update-cache --add TT'
+test_expect_success \
+ 'prepare initial tree' \
+ 'tree_O=$(git-write-tree)'
+
+################################################################
+# Branch A and B makes the changes according to the above matrix.
+
+################################################################
+# Branch A
+
+to_remove=$(echo D? Z/D?)
+rm -f $to_remove
+test_expect_success \
+ 'change in branch A (removal)' \
+ 'git-update-cache --remove $to_remove'
+
+for p in M? Z/M?
+do
+ echo This is modified $p in the branch A. >$p
+ test_expect_success \
+ 'change in branch A (modification)' \
+ "git-update-cache $p"
+done
+
+for p in AN AA Z/AN Z/AA
+do
+ echo This is added $p in the branch A. >$p
+ test_expect_success \
+ 'change in branch A (addition)' \
+ "git-update-cache --add $p"
+done
+
+echo This is SS from the modified tree. >SS
+echo This is LL from the modified tree. >LL
+test_expect_success \
+ 'change in branch A (addition)' \
+ 'git-update-cache --add LL &&
+ git-update-cache SS'
+mv TT TT-
+sed -e '/Branch A/s/word/WORD/g' <TT- >TT
+rm -f TT-
+test_expect_success \
+ 'change in branch A (edit)' \
+ 'git-update-cache TT'
+
+mkdir DF
+echo Branch A makes a file at DF/DF, creating a directory DF. >DF/DF
+test_expect_success \
+ 'change in branch A (change file to directory)' \
+ 'git-update-cache --add DF/DF'
+
+test_expect_success \
+ 'recording branch A tree' \
+ 'tree_A=$(git-write-tree)'
+
+################################################################
+# Branch B
+# Start from O
+
+rm -rf [NDMASLT][NDMASLT] Z DF
+mkdir Z
+test_expect_success \
+ 'reading original tree and checking out' \
+ 'git-read-tree $tree_O &&
+ git-checkout-cache -a'
+
+to_remove=$(echo ?D Z/?D)
+rm -f $to_remove
+test_expect_success \
+ 'change in branch B (removal)' \
+ "git-update-cache --remove $to_remove"
+
+for p in ?M Z/?M
+do
+ echo This is modified $p in the branch B. >$p
+ test_expect_success \
+ 'change in branch B (modification)' \
+ "git-update-cache $p"
+done
+
+for p in NA AA Z/NA Z/AA
+do
+ echo This is added $p in the branch B. >$p
+ test_expect_success \
+ 'change in branch B (addition)' \
+ "git-update-cache --add $p"
+done
+echo This is SS from the modified tree. >SS
+echo This is LL from the modified tree. >LL
+test_expect_success \
+ 'change in branch B (addition and modification)' \
+ 'git-update-cache --add LL &&
+ git-update-cache SS'
+mv TT TT-
+sed -e '/Branch B/s/word/WORD/g' <TT- >TT
+rm -f TT-
+test_expect_success \
+ 'change in branch B (modification)' \
+ 'git-update-cache TT'
+
+echo Branch B makes a file at DF. >DF
+test_expect_success \
+ 'change in branch B (addition of a file to conflict with directory)' \
+ 'git-update-cache --add DF'
+
+test_expect_success \
+ 'recording branch B tree' \
+ 'tree_B=$(git-write-tree)'
+
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -71,177 +71,8 @@ In addition:
DF: a special case, where A makes a directory and B makes a file.
'
-
. ./test-lib.sh
-
-# Original tree.
-mkdir Z
-for a in N D M
-do
- for b in N D M
- do
- p=$a$b
- echo This is $p from the original tree. >$p
- echo This is Z/$p from the original tree. >Z/$p
- test_expect_success \
- "adding test file $p and Z/$p" \
- 'git-update-cache --add $p &&
- git-update-cache --add Z/$p'
- done
-done
-echo This is SS from the original tree. >SS
-test_expect_success \
- 'adding test file SS' \
- 'git-update-cache --add SS'
-cat >TT <<\EOF
-This is a trivial merge sample text.
-Branch A is expected to upcase this word, here.
-There are some filler lines to avoid diff context
-conflicts here,
-like this one,
-and this one,
-and this one is yet another one of them.
-At the very end, here comes another line, that is
-the word, expected to be upcased by Branch B.
-This concludes the trivial merge sample file.
-EOF
-test_expect_success \
- 'adding test file TT' \
- 'git-update-cache --add TT'
-test_expect_success \
- 'prepare initial tree' \
- 'tree_O=$(git-write-tree)'
-
-test_expect_success \
- 'commit initial tree' \
- 'commit_O=$(echo "Original tree for the merge test." |
- git-commit-tree $tree_O)'
-echo $commit_O >.git/HEAD-O
-
-################################################################
-# Branch A and B makes the changes according to the above matrix.
-
-################################################################
-# Branch A
-
-to_remove=$(echo D? Z/D?)
-rm -f $to_remove
-test_expect_success \
- 'change in branch A (removal)' \
- 'git-update-cache --remove $to_remove'
-
-for p in M? Z/M?
-do
- echo This is modified $p in the branch A. >$p
- test_expect_success \
- 'change in branch A (modification)' \
- "git-update-cache $p"
-done
-
-for p in AN AA Z/AN Z/AA
-do
- echo This is added $p in the branch A. >$p
- test_expect_success \
- 'change in branch A (addition)' \
- "git-update-cache --add $p"
-done
-
-echo This is SS from the modified tree. >SS
-echo This is LL from the modified tree. >LL
-test_expect_success \
- 'change in branch A (addition)' \
- 'git-update-cache --add LL &&
- git-update-cache SS'
-mv TT TT-
-sed -e '/Branch A/s/word/WORD/g' <TT- >TT
-rm -f TT-
-test_expect_success \
- 'change in branch A (edit)' \
- 'git-update-cache TT'
-
-mkdir DF
-echo Branch A makes a file at DF/DF, creating a directory DF. >DF/DF
-test_expect_success \
- 'change in branch A (change file to directory)' \
- 'git-update-cache --add DF/DF'
-
-test_expect_success \
- 'recording branch A tree' \
- 'tree_A=$(git-write-tree)'
-test_expect_success \
- 'committing branch A changes' \
- 'commit_A=$(echo "Branch A for the merge test." |
- git-commit-tree $tree_A -p $commit_O)'
-echo $commit_A >.git/HEAD-A
-
-################################################################
-# Branch B
-# Start from O
-
-rm -rf [NDMASLT][NDMASLT] Z DF
-mkdir Z
-test_expect_success \
- 'reading original tree and checking out' \
- 'git-read-tree $tree_O &&
- git-checkout-cache -a'
-
-to_remove=$(echo ?D Z/?D)
-rm -f $to_remove
-test_expect_success \
- 'change in branch B (removal)' \
- "git-update-cache --remove $to_remove"
-
-for p in ?M Z/?M
-do
- echo This is modified $p in the branch B. >$p
- test_expect_success \
- 'change in branch B (modification)' \
- "git-update-cache $p"
-done
-
-for p in NA AA Z/NA Z/AA
-do
- echo This is added $p in the branch B. >$p
- test_expect_success \
- 'change in branch B (addition)' \
- "git-update-cache --add $p"
-done
-echo This is SS from the modified tree. >SS
-echo This is LL from the modified tree. >LL
-test_expect_success \
- 'change in branch B (addition and modification)' \
- 'git-update-cache --add LL &&
- git-update-cache SS'
-mv TT TT-
-sed -e '/Branch B/s/word/WORD/g' <TT- >TT
-rm -f TT-
-test_expect_success \
- 'change in branch B (modification)' \
- 'git-update-cache TT'
-
-echo Branch B makes a file at DF. >DF
-test_expect_success \
- 'change in branch B (addition of a file to conflict with directory)' \
- 'git-update-cache --add DF'
-
-test_expect_success \
- 'recording branch B tree' \
- 'tree_B=$(git-write-tree)'
-test_expect_success \
- 'committing branch B changes' \
- 'commit_B=$(echo "Branch B for the merge test." |
- git-commit-tree $tree_B -p $commit_O)'
-echo $commit_B >.git/HEAD-B
-
-################################################################
-# Done preparation.
-
-test_debug '
- for T in O A B
- do
- echo "# $T $(eval git-cat-file commit \$commit_$T | sed -e 1q)"
- done
-'
+. ../lib-read-tree-m-3way.sh
################################################################
# Try merging and showing the various diffs
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
new file mode 100755
--- /dev/null
+++ b/t/t4002-diff-basic.sh
@@ -0,0 +1,187 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='Test diff raw-output.
+
+'
+. ./test-lib.sh
+. ../lib-read-tree-m-3way.sh
+
+cat >.test-plain-OA <<\EOF
++100644 blob ccba72ad3888a3520b39efcf780b9ee64167535d AA
++100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
+-100644 blob bcc68ef997017466d5c9094bcf7692295f588c9a DD
++040000 tree 6d50f65d3bdab91c63444294d38f08aeff328e42 DF
+-100644 blob 141c1f1642328e4bc46a7d801a71da392e66791e DM
+-100644 blob 35abde1506ddf806572ff4d407bd06885d0f8ee9 DN
++100644 blob 1d41122ebdd7a640f29d3c9cc4f9d70094374762 LL
+*100644->100644 blob 03f24c8c4700babccfd28b654e7e8eac402ad6cd->103d9f89b50b9aad03054b579be5e7aa665f2d57 MD
+*100644->100644 blob b258508afb7ceb449981bd9d63d2d3e971bf8d34->b431b272d829ff3aa4d1a5085f4394ab4d3305b6 MM
+*100644->100644 blob bd084b0c27c7b6cc34f11d6d0509a29be3caf970->a716d58de4a570e0038f5c307bd8db34daea021f MN
+*100644->100644 blob 40c959f984c8b89a2b02520d17f00d717f024397->2ac547ae9614a00d1b28275de608131f7a0e259f SS
+*100644->100644 blob 4ac13458899ab908ef3b1128fa378daefc88d356->4c86f9a85fbc5e6804ee2e17a797538fbe785bca TT
+*040000->040000 tree 7d670fdcdb9929f6c7dac196ff78689cd1c566a1->5e5f22072bb39f6e12cf663a57cb634c76eefb49 Z
+EOF
+
+cat >.test-recursive-OA <<\EOF
++100644 blob ccba72ad3888a3520b39efcf780b9ee64167535d AA
++100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
+-100644 blob bcc68ef997017466d5c9094bcf7692295f588c9a DD
++100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
+-100644 blob 141c1f1642328e4bc46a7d801a71da392e66791e DM
+-100644 blob 35abde1506ddf806572ff4d407bd06885d0f8ee9 DN
++100644 blob 1d41122ebdd7a640f29d3c9cc4f9d70094374762 LL
+*100644->100644 blob 03f24c8c4700babccfd28b654e7e8eac402ad6cd->103d9f89b50b9aad03054b579be5e7aa665f2d57 MD
+*100644->100644 blob b258508afb7ceb449981bd9d63d2d3e971bf8d34->b431b272d829ff3aa4d1a5085f4394ab4d3305b6 MM
+*100644->100644 blob bd084b0c27c7b6cc34f11d6d0509a29be3caf970->a716d58de4a570e0038f5c307bd8db34daea021f MN
+*100644->100644 blob 40c959f984c8b89a2b02520d17f00d717f024397->2ac547ae9614a00d1b28275de608131f7a0e259f SS
+*100644->100644 blob 4ac13458899ab908ef3b1128fa378daefc88d356->4c86f9a85fbc5e6804ee2e17a797538fbe785bca TT
++100644 blob 8acb8e9750e3f644bf323fcf3d338849db106c77 Z/AA
++100644 blob 087494262084cefee7ed484d20c8dc0580791272 Z/AN
+-100644 blob 879007efae624d2b1307214b24a956f0a8d686a8 Z/DD
+-100644 blob 9b541b2275c06e3a7b13f28badf5294e2ae63df4 Z/DM
+-100644 blob beb5d38c55283d280685ea21a0e50cfcc0ca064a Z/DN
+*100644->100644 blob d41fda41b7ec4de46b43cb7ea42a45001ae393d5->a79ac3be9377639e1c7d1edf1ae1b3a5f0ccd8a9 Z/MD
+*100644->100644 blob 4ca22bae2527d3d9e1676498a0fba3b355bd1278->61422ba9c2c873416061a88cd40a59a35b576474 Z/MM
+*100644->100644 blob b16d7b25b869f2beb124efa53467d8a1550ad694->a5c544c21cfcb07eb80a4d89a5b7d1570002edfd Z/MN
+EOF
+cat >.test-plain-OB <<\EOF
++100644 blob 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 AA
+-100644 blob bcc68ef997017466d5c9094bcf7692295f588c9a DD
++100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
+*100644->100644 blob 141c1f1642328e4bc46a7d801a71da392e66791e->3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
++100644 blob 1d41122ebdd7a640f29d3c9cc4f9d70094374762 LL
+-100644 blob 03f24c8c4700babccfd28b654e7e8eac402ad6cd MD
+*100644->100644 blob b258508afb7ceb449981bd9d63d2d3e971bf8d34->19989d4559aae417fedee240ccf2ba315ea4dc2b MM
++100644 blob 15885881ea69115351c09b38371f0348a3fb8c67 NA
+-100644 blob a4e179e4291e5536a5e1c82e091052772d2c5a93 ND
+*100644->100644 blob c8f25781e8f1792e3e40b74225e20553041b5226->cdb9a8c3da571502ac30225e9c17beccb8387983 NM
+*100644->100644 blob 40c959f984c8b89a2b02520d17f00d717f024397->2ac547ae9614a00d1b28275de608131f7a0e259f SS
+*100644->100644 blob 4ac13458899ab908ef3b1128fa378daefc88d356->c4e4a12231b9fa79a0053cb6077fcb21bb5b135a TT
+*040000->040000 tree 7d670fdcdb9929f6c7dac196ff78689cd1c566a1->1ba523955d5160681af65cb776411f574c1e8155 Z
+EOF
+cat >.test-recursive-OB <<\EOF
++100644 blob 6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 AA
+-100644 blob bcc68ef997017466d5c9094bcf7692295f588c9a DD
++100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
+*100644->100644 blob 141c1f1642328e4bc46a7d801a71da392e66791e->3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
++100644 blob 1d41122ebdd7a640f29d3c9cc4f9d70094374762 LL
+-100644 blob 03f24c8c4700babccfd28b654e7e8eac402ad6cd MD
+*100644->100644 blob b258508afb7ceb449981bd9d63d2d3e971bf8d34->19989d4559aae417fedee240ccf2ba315ea4dc2b MM
++100644 blob 15885881ea69115351c09b38371f0348a3fb8c67 NA
+-100644 blob a4e179e4291e5536a5e1c82e091052772d2c5a93 ND
+*100644->100644 blob c8f25781e8f1792e3e40b74225e20553041b5226->cdb9a8c3da571502ac30225e9c17beccb8387983 NM
+*100644->100644 blob 40c959f984c8b89a2b02520d17f00d717f024397->2ac547ae9614a00d1b28275de608131f7a0e259f SS
+*100644->100644 blob 4ac13458899ab908ef3b1128fa378daefc88d356->c4e4a12231b9fa79a0053cb6077fcb21bb5b135a TT
++100644 blob 6c0b99286d0bce551ac4a7b3dff8b706edff3715 Z/AA
+-100644 blob 879007efae624d2b1307214b24a956f0a8d686a8 Z/DD
+*100644->100644 blob 9b541b2275c06e3a7b13f28badf5294e2ae63df4->d77371d15817fcaa57eeec27f770c505ba974ec1 Z/DM
+-100644 blob d41fda41b7ec4de46b43cb7ea42a45001ae393d5 Z/MD
+*100644->100644 blob 4ca22bae2527d3d9e1676498a0fba3b355bd1278->697aad7715a1e7306ca76290a3dd4208fbaeddfa Z/MM
++100644 blob d12979c22fff69c59ca9409e7a8fe3ee25eaee80 Z/NA
+-100644 blob a18393c636b98e9bd7296b8b437ea4992b72440c Z/ND
+*100644->100644 blob 3fdbe17fd013303a2e981e1ca1c6cd6e72789087->7e09d6a3a14bd630913e8c75693cea32157b606d Z/NM
+EOF
+cat >.test-plain-AB <<\EOF
+*100644->100644 blob ccba72ad3888a3520b39efcf780b9ee64167535d->6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 AA
+-100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
++100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
+-040000 tree 6d50f65d3bdab91c63444294d38f08aeff328e42 DF
++100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
++100644 blob 35abde1506ddf806572ff4d407bd06885d0f8ee9 DN
+-100644 blob 103d9f89b50b9aad03054b579be5e7aa665f2d57 MD
+*100644->100644 blob b431b272d829ff3aa4d1a5085f4394ab4d3305b6->19989d4559aae417fedee240ccf2ba315ea4dc2b MM
+*100644->100644 blob a716d58de4a570e0038f5c307bd8db34daea021f->bd084b0c27c7b6cc34f11d6d0509a29be3caf970 MN
++100644 blob 15885881ea69115351c09b38371f0348a3fb8c67 NA
+-100644 blob a4e179e4291e5536a5e1c82e091052772d2c5a93 ND
+*100644->100644 blob c8f25781e8f1792e3e40b74225e20553041b5226->cdb9a8c3da571502ac30225e9c17beccb8387983 NM
+*100644->100644 blob 4c86f9a85fbc5e6804ee2e17a797538fbe785bca->c4e4a12231b9fa79a0053cb6077fcb21bb5b135a TT
+*040000->040000 tree 5e5f22072bb39f6e12cf663a57cb634c76eefb49->1ba523955d5160681af65cb776411f574c1e8155 Z
+EOF
+cat >.test-recursive-AB <<\EOF
+*100644->100644 blob ccba72ad3888a3520b39efcf780b9ee64167535d->6aa2b5335b16431a0ef71e5c0a28be69183cf6a2 AA
+-100644 blob 7e426fb079479fd67f6d81f984e4ec649a44bc25 AN
++100644 blob 71420ab81e254145d26d6fc0cddee64c1acd4787 DF
+-100644 blob 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 DF/DF
++100644 blob 3c4d8de5fbad08572bab8e10eef8dbb264cf0231 DM
++100644 blob 35abde1506ddf806572ff4d407bd06885d0f8ee9 DN
+-100644 blob 103d9f89b50b9aad03054b579be5e7aa665f2d57 MD
+*100644->100644 blob b431b272d829ff3aa4d1a5085f4394ab4d3305b6->19989d4559aae417fedee240ccf2ba315ea4dc2b MM
+*100644->100644 blob a716d58de4a570e0038f5c307bd8db34daea021f->bd084b0c27c7b6cc34f11d6d0509a29be3caf970 MN
++100644 blob 15885881ea69115351c09b38371f0348a3fb8c67 NA
+-100644 blob a4e179e4291e5536a5e1c82e091052772d2c5a93 ND
+*100644->100644 blob c8f25781e8f1792e3e40b74225e20553041b5226->cdb9a8c3da571502ac30225e9c17beccb8387983 NM
+*100644->100644 blob 4c86f9a85fbc5e6804ee2e17a797538fbe785bca->c4e4a12231b9fa79a0053cb6077fcb21bb5b135a TT
+*100644->100644 blob 8acb8e9750e3f644bf323fcf3d338849db106c77->6c0b99286d0bce551ac4a7b3dff8b706edff3715 Z/AA
+-100644 blob 087494262084cefee7ed484d20c8dc0580791272 Z/AN
++100644 blob d77371d15817fcaa57eeec27f770c505ba974ec1 Z/DM
++100644 blob beb5d38c55283d280685ea21a0e50cfcc0ca064a Z/DN
+-100644 blob a79ac3be9377639e1c7d1edf1ae1b3a5f0ccd8a9 Z/MD
+*100644->100644 blob 61422ba9c2c873416061a88cd40a59a35b576474->697aad7715a1e7306ca76290a3dd4208fbaeddfa Z/MM
+*100644->100644 blob a5c544c21cfcb07eb80a4d89a5b7d1570002edfd->b16d7b25b869f2beb124efa53467d8a1550ad694 Z/MN
++100644 blob d12979c22fff69c59ca9409e7a8fe3ee25eaee80 Z/NA
+-100644 blob a18393c636b98e9bd7296b8b437ea4992b72440c Z/ND
+*100644->100644 blob 3fdbe17fd013303a2e981e1ca1c6cd6e72789087->7e09d6a3a14bd630913e8c75693cea32157b606d Z/NM
+EOF
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree $tree_O $tree_A >.test-a &&
+ cmp -s .test-a .test-plain-OA'
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree -r $tree_O $tree_A >.test-a &&
+ cmp -s .test-a .test-recursive-OA'
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree $tree_O $tree_B >.test-a &&
+ cmp -s .test-a .test-plain-OB'
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree -r $tree_O $tree_B >.test-a &&
+ cmp -s .test-a .test-recursive-OB'
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree $tree_A $tree_B >.test-a &&
+ cmp -s .test-a .test-plain-AB'
+
+test_expect_success \
+ 'diff-tree of known trees.' \
+ 'git-diff-tree -r $tree_A $tree_B >.test-a &&
+ cmp -s .test-a .test-recursive-AB'
+
+################################################################
+# Now we have established the baseline, we do not have to
+# rely on individual object ID values that much.
+
+test_expect_success \
+ 'diff-tree O A == diff-tree -R A O' \
+ 'git-diff-tree $tree_O $tree_A >.test-a &&
+ git-diff-tree -R $tree_A $tree_O >.test-b &&
+ cmp -s .test-a .test-b'
+
+test_expect_success \
+ 'diff-tree -r O A == diff-tree -r -R A O' \
+ 'git-diff-tree -r $tree_O $tree_A >.test-a &&
+ git-diff-tree -r -R $tree_A $tree_O >.test-b &&
+ cmp -s .test-a .test-b'
+
+test_expect_success \
+ 'diff-tree B A == diff-tree -R A B' \
+ 'git-diff-tree $tree_B $tree_A >.test-a &&
+ git-diff-tree -R $tree_A $tree_B >.test-b &&
+ cmp -s .test-a .test-b'
+
+test_expect_success \
+ 'diff-tree -r B A == diff-tree -r -R A B' \
+ 'git-diff-tree -r $tree_B $tree_A >.test-a &&
+ git-diff-tree -r -R $tree_A $tree_B >.test-b &&
+ cmp -s .test-a .test-b'
+
+test_done
------------------------------------------------
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Linus Torvalds @ 2005-05-20 15:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vzmupud54.fsf@assigned-by-dhcp.cox.net>
On Fri, 20 May 2005, Junio C Hamano wrote:
>
> Keep git-diff-tree output sorted in cache order on dir/file swap.
No, this is wrong.
Or rather, it is incomplete - it gets only a small subset of the
interesting cases right.
You need to really teach diff-tree about directory sorting, because it is
more complicated than you think.
The sorting does _not_ just affect files/directories with the same names.
It affects files and directories that have the same _beginning_.
The only correct way to do name sorting is the one that fsck does in
"verify_order()". To realize why, you need to realize that "A" (the
directory) sorts _after_ a filename "A file", because '/' sorts after ' '.
In contrast, "A" (the directory) sorts _before_ "ABBA" (the band), because
'/' sorts before 'B'.
--
Side note:
Btw, right now I depend on "memcmp()" doing comparisons as "unsigned
char", which is supposed to be true, but I don't know whether it's
entirely portable. So it might be that I should implement my own
"namecmp()" entirely from scratch.
Does anybody know if some broken system does "memcmp" ordering on signed
chars?
Linus
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Linus Torvalds @ 2005-05-20 15:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200844090.2206@ppc970.osdl.org>
On Fri, 20 May 2005, Linus Torvalds wrote:
>
> The only correct way to do name sorting is the one that fsck does in
> "verify_order()". To realize why, you need to realize that "A" (the
> directory) sorts _after_ a filename "A file", because '/' sorts after ' '.
>
> In contrast, "A" (the directory) sorts _before_ "ABBA" (the band), because
> '/' sorts before 'B'.
Btw, in case you wonder: the real problem is that we use
"cache_name_compare()" on a directory name. The function is (as the name
says) designed for full pathnames, not the diff-tree kind of possibly
partial basenames.
Linus
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Linus Torvalds @ 2005-05-20 16:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200844090.2206@ppc970.osdl.org>
On Fri, 20 May 2005, Linus Torvalds wrote:
>
> The sorting does _not_ just affect files/directories with the same names.
> It affects files and directories that have the same _beginning_.
Ok, I just pushed out a fix which should get this right (it introduces a
new "base_name_compare()" function that knows about these subtleties).
I guess we should add a proper ordering test for all these cases. There's:
- exact same name, directory vs file
- different length names, but same in the first characters
- this one has the subcases of the next character sorting with '/'
or '\0' depending on the type of the shorter filename.
Your previous test handled only the simple "exact same name" case.
Linus
^ permalink raw reply
* Re: "git-diff-tree -R A B == git-diff-tree B A"?
From: Junio C Hamano @ 2005-05-20 16:48 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200844090.2206@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> No, this is wrong.
Understood. Since I am going to be futzing with diff family,
I'll come up with some more tests while I am at it.
^ permalink raw reply
* Re: gitweb wishlist
From: Linus Torvalds @ 2005-05-20 16:54 UTC (permalink / raw)
To: Kay Sievers; +Cc: Petr Baudis, git
In-Reply-To: <1116384951.5094.83.camel@dhcp-188.off.vrfy.org>
On Wed, 18 May 2005, Kay Sievers wrote:
>
> I did this now. The top-link shows now the repository listing with a
> nice "last change" field. The default link points to an overview page
> which also list the tags.
In the summary page, could we get authorship information too? Right now it
looks like
recent commits
15 minutes ago [PATCH] Add tests for diff-tree
31 minutes ago diff-tree: use new base_name_compare() helper function
34 minutes ago Introduce "base_name_compare()" helper function
...
and wouldn't it be nice if it told you who had written these things, like
recent commits
15 minutes ago Junio C Hamano [PATCH] Add tests for diff-tree
31 minutes ago Linus Torvalds diff-tree: use new base_name_compare() helper function
34 minutes ago Linus Torvalds Introduce "base_name_compare()" helper function
...
(limit the name to the first 20 characters or something to make things
line up).
If the lines get too long, you could changes "minutes" to "min", and maybe
limit the name to the first 10 characters (or even first name, but there's
a lot of David's around, while 10-12 characters tends to get enough of
the last name to be reasonable unique).
Linus
^ permalink raw reply
* [PATCH] Simplify "reverse-diff" logic in the diff core.
From: Junio C Hamano @ 2005-05-20 16:54 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0505200806150.2206@ppc970.osdl.org>
Instead of swapping the arguments just before output, this patch
makes the swapping happen on the input side of the diff core,
when "reverse-diff" is in effect. This greatly simplifies the
logic, but more importantly it is necessary for upcoming "copy
detection" work.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff.c | 38 +++++++++++++++-----------------------
1 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -350,15 +350,6 @@ static void run_external_diff(const char
int status;
static int atexit_asked = 0;
- if (reverse_diff) {
- struct diff_spec *tmp_spec;
- tmp_spec = one; one = two; two = tmp_spec;
- if (other) {
- const char *tmp;
- tmp = name; name = other; other = tmp;
- }
- }
-
if (!matches_pathspec(name) && (!other || !matches_pathspec(other)))
return;
@@ -765,11 +756,12 @@ void diff_addremove(int addremove, unsig
char concatpath[PATH_MAX];
struct diff_spec spec[2], *one, *two;
+ if (reverse_diff)
+ addremove = (addremove == '+' ? '-' : '+');
+
if (0 <= diff_raw_output) {
if (!path)
path = "";
- if (reverse_diff)
- addremove = (addremove == '+' ? '-' : '+');
printf("%c%06o %s %s %s%s%c",
addremove,
mode,
@@ -806,24 +798,24 @@ void diff_change(unsigned old_mode, unsi
char concatpath[PATH_MAX];
struct diff_spec spec[2];
+ if (reverse_diff) {
+ unsigned tmp;
+ const unsigned char *tmp_c;
+ tmp = old_mode; old_mode = new_mode; new_mode = tmp;
+ tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c;
+ }
+
if (0 <= diff_raw_output) {
char old_hex[41];
strcpy(old_hex, sha1_to_hex(old_sha1));
if (!path)
path = "";
- if (reverse_diff)
- printf("*%06o->%06o %s %s->%s %s%s%c",
- new_mode, old_mode,
- git_object_type(new_mode),
- sha1_to_hex(new_sha1), old_hex,
- base, path, diff_raw_output);
- else
- printf("*%06o->%06o %s %s->%s %s%s%c",
- old_mode, new_mode,
- git_object_type(new_mode),
- old_hex, sha1_to_hex(new_sha1),
- base, path, diff_raw_output);
+ printf("*%06o->%06o %s %s->%s %s%s%c",
+ old_mode, new_mode,
+ git_object_type(new_mode),
+ old_hex, sha1_to_hex(new_sha1),
+ base, path, diff_raw_output);
return;
}
if (S_ISDIR(new_mode))
------------------------------------------------
^ permalink raw reply
* Re: gitweb wishlist
From: Junio C Hamano @ 2005-05-20 17:04 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kay Sievers, Petr Baudis, git
In-Reply-To: <Pine.LNX.4.58.0505200948150.2206@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> If the lines get too long, you could changes "minutes" to "min", and maybe
LT> limit the name to the first 10 characters (or even first name, but there's
LT> a lot of David's around, while 10-12 characters tends to get enough of
LT> the last name to be reasonable unique).
Or abbreviate the first names. L Torvalds, JC Hamano, etc.
^ permalink raw reply
* Re: [PATCH] Fix and clean up man page building
From: Sebastian Kuzminsky @ 2005-05-20 17:09 UTC (permalink / raw)
To: git
In-Reply-To: <20050520145211.GB27395@diku.dk>
Jonas Fonseca <fonseca@diku.dk> wrote:
> Raja R Harinath <rharinath@novell.com> wrote Fri, May 20, 2005:
> > Jonas Fonseca <fonseca@diku.dk> writes:
> > > +%.7 : %.1
> > > + # FIXME: this next line works around an output filename bug in asciidoc 6.0.3
> > > + if [ -f "$<" ]; then mv $< $@; fi
> > > +
> > > %.1 %.7 : %.xml
> > > xmlto man $<
> > > - # FIXME: this next line works around an output filename bug in asciidoc 6.0.3
> > > - [ "$@" = "git.7" ] || mv git.1 $@
> > >
> > > %.xml : %.txt
> > > asciidoc -b docbook -d manpage $<
> >
> > That doesn't look right. I think you want
> >
> > %.7: %.xml
> > xmlto man %<
> >
> > %.1: %.xml
> > xmlto man $<
> > [ test -f $@ ] || mv git.1 $@
>
> [ Looks like you mixed up %.1 and %.7 ]
>
> Yes, separating the rule for %.1 and %.7 might be clearer. But it would
> be great if it would work for any man page in section 7 not just git.7.
> Since I hope to add cogito.7 soon.
That's still not right. Jonas' %.7 target works (as long as none of the
%.7 source files have dashes in the name), but the %.1 target fails to
rebuild the manpages if they already exist.
The underlying problem, just so we're all clear, is that asciidoc 6.0.3
has a bug that causes it to output buggy xml files when the command-name
has a dash in it. When there's a dash in the command-name, asciidoc
produces xml that says everything _before_ the first dash is the command
name, and everything _after_ the first dash is the quick description
("purpose") of that command.
The git.txt -> git.xml transition is fine since there is no dash in "git",
but (for example) the git-cat-file.txt -> git-cat-file.xml transition
tickles the bug. git-cat-file.xml thinks it's documenting a program
called "git", with the quick description beginning with "cat-file".
Here's the relevant snippet from git-cat-file.xml:
<refnamediv>
<refname>git</refname>
<refpurpose>cat-file - Provide content or type information for repository objects</refpurpose>
</refnamediv>
So far it's not too bad (it's still getting the filename right, even
though the contents are less than perfect). But when we feed that xml to
'xmlto man', xmlto sensibly uses the buggy command name "git" for the
output file name, producing "git.1". _That_ is what we have to move.
(xmlto has no --output-filename option, or we'd just use that.)
Here's another attempt at the Makefile patch. It's got the broken-out
man1 vs man7 layout that Jonas sensibly suggested.
Note that the asciidoc bug workaround is incredibly fragile. If we have
any man1 pages that don't begin with "git-", it'll do the wrong thing
(because they won't be named git.1). And if we have any man7 pages
that have "-" in the name, it'll do the wrong thing (by not renaming
the incorrectly named manpage).
Please please Stuart Rackham, Mr Asciidoc man, use David Greaves'
patch <http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2> to
fix this bug.
Index: Documentation/Makefile
===================================================================
--- a81ef956b9b2946bea2104cd11a4529c965976ad/Documentation/Makefile (mode:100644)
+++ uncommitted/Documentation/Makefile (mode:100644)
@@ -1,25 +1,40 @@
-DOC_SRC=$(wildcard git*.txt)
-DOC_HTML=$(patsubst %.txt,%.html,$(DOC_SRC))
-DOC_MAN=$(patsubst %.txt,%.1,$(DOC_SRC))
+MAN1_TXT=$(wildcard git-*.txt)
+MAN7_TXT=git.txt
-all: $(DOC_HTML) $(DOC_MAN)
+DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT))
+
+DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
+DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
+
+
+all: html man
html: $(DOC_HTML)
-man: $(DOC_MAN)
+man: man1 man7
+
+man1: $(DOC_MAN1)
+
+man7: $(DOC_MAN7)
+
# 'include' dependencies
git-diff-%.txt: diff-format.txt
touch $@
clean:
- rm -f *.xml *.html *.1
+ rm -f *.xml *.html *.1 *.7
%.html : %.txt
asciidoc -b css-embedded -d manpage $<
%.1 : %.xml
xmlto man $<
+ @# FIXME: this next line works around an output filename bug in asciidoc 6.0.3
+ mv git.1 $@
+
+%.7 : %.xml
+ xmlto man $<
%.xml : %.txt
asciidoc -b docbook -d manpage $<
--
Sebastian Kuzminsky
"Marie will know I'm headed south, so's to meet me by and by"
-Townes Van Zandt
^ permalink raw reply
* Re: gitweb wishlist
From: Linus Torvalds @ 2005-05-20 17:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Kay Sievers, Petr Baudis, git
In-Reply-To: <7vbr75u8vw.fsf@assigned-by-dhcp.cox.net>
On Fri, 20 May 2005, Junio C Hamano wrote:
>
> Or abbreviate the first names. L Torvalds, JC Hamano, etc.
Technically, yes. Except I end up at least personally going by either
first names (or _possibly_ email addresses), not by last name. Maybe Linux
is fairly unique in that, but dammit, I'm not "Torvalds", I'm "Linus". And
like it or not, you're either Junio or junkio at least to me ;)
Linus
^ permalink raw reply
* gitweb and kernel.org
From: Jeff Garzik @ 2005-05-20 17:48 UTC (permalink / raw)
To: Git Mailing List; +Cc: FTP Admin, Kay Sievers
No sure who maintains http://www.kernel.org/git/ so...
I have a request for the above URL: provide access to branches in
refs/heads/* somehow. -All- my work occurs in a branch, with the main
branch containing nothing but "vanilla Linus" tree.
My jgarzik/libata-dev.git repository contains a large number of branches:
> [jgarzik@pretzel libata-dev]$ ls .git/refs/heads/
> adma atapi-enable iomap new-ids promise-sata-pata
> adma-mwi bridge-detect iomap-step1 passthru sil24
> ahci-atapi chs-support master pdc2027x
> ahci-msi ioctl-get-identity misc-fixes pdc20619
and ditto for jgarzik/netdev-2.6.git:
> [jgarzik@pretzel netdev-2.6]$ ls .git/refs/heads/
> 8139cp e100 janitor pcnet32 skge we18
> 8139too-iomap e1000 master ppp smc91x wifi
> airo forcedeth misc-fixes qeth smc91x-eeprom
> amd8111 hdlc natsemi r8169 starfire
> atmel ieee80211 ns83820 register-netdev tlan
> chelsio iff-running orinoco remove-drivers veth
> dm9000 ixgb orinoco-hch sis900 viro
^ permalink raw reply
* Re: gitweb wishlist
From: Kay Sievers @ 2005-05-20 17:58 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Petr Baudis, git
In-Reply-To: <Pine.LNX.4.58.0505200948150.2206@ppc970.osdl.org>
On Fri, 2005-05-20 at 09:54 -0700, Linus Torvalds wrote:
>
> On Wed, 18 May 2005, Kay Sievers wrote:
> >
> > I did this now. The top-link shows now the repository listing with a
> > nice "last change" field. The default link points to an overview page
> > which also list the tags.
>
> In the summary page, could we get authorship information too? Right now it
> looks like
>
> recent commits
>
> 15 minutes ago [PATCH] Add tests for diff-tree
> 31 minutes ago diff-tree: use new base_name_compare() helper function
> 34 minutes ago Introduce "base_name_compare()" helper function
> ...
>
> and wouldn't it be nice if it told you who had written these things, like
>
> recent commits
>
> 15 minutes ago Junio C Hamano [PATCH] Add tests for diff-tree
> 31 minutes ago Linus Torvalds diff-tree: use new base_name_compare() helper function
> 34 minutes ago Linus Torvalds Introduce "base_name_compare()" helper function
> ...
>
> (limit the name to the first 20 characters or something to make things
> line up).
Something like that: :)
http://www.kernel.org/git/?p=cogito/cogito.git;a=summary
Kay
^ permalink raw reply
* Re: gitweb wishlist
From: Linus Torvalds @ 2005-05-20 18:16 UTC (permalink / raw)
To: Kay Sievers; +Cc: Petr Baudis, git
In-Reply-To: <1116611932.12975.22.camel@dhcp-188>
On Fri, 20 May 2005, Kay Sievers wrote:
>
> Something like that: :)
> http://www.kernel.org/git/?p=cogito/cogito.git;a=summary
Looking good.
I still think "minutes" is an awfully long word to waste vertical space
with, especially since it's also the only one that will have up to three
digits associated with it. It seems kind of silly to give more (or even
equal) space to the simplified time field than to the person who did
something.
(To see minutes, you need to use "git/git.git" instead of cogito.
So I still think you should change "minutes" to "min", which is the common
abbreviation.
(That "ago" is also very repetitive, but removing it would seem to make it
unreadable, so I guess it's needed).
Linus
^ permalink raw reply
* Re: gitweb wishlist
From: Linus Torvalds @ 2005-05-20 18:28 UTC (permalink / raw)
To: Kay Sievers; +Cc: Petr Baudis, git
In-Reply-To: <Pine.LNX.4.58.0505201111090.2206@ppc970.osdl.org>
On Fri, 20 May 2005, Linus Torvalds wrote:
>
> Looking good.
Oh, dang, while I'm at it, why not ask for the "commmitdiff" thing to have
the commit message in it too, ie basically look like a prettified version
of "git-diff-tree -v -M <cmitname>"
You already do the first line of it, so there's not much missing. Right
now there is no place where everything important from one commit is
"brought together" (ie no single place where you can see both what the
diff is all about, and what it actually does).
Linus
^ permalink raw reply
* Re: gitk-1.0 released
From: Kari Hameenaho @ 2005-05-20 18:18 UTC (permalink / raw)
To: git
In-Reply-To: <17037.5109.556362.904185@cargo.ozlabs.ibm.com>
Paul Mackerras wrote:
>
> Yes, indeed. I'll have to think about how to do it in a responsive
> fashion, since getting the necessary information involves reading all
> the commits and all the tree objects back to the beginning of time,
> AFAICS.
Maybe its not necessary to go back all the way. It is possible to look only
commits between 2.6.12-rc4 and 2.6.12-rc3, like follows (needs just a few
fixes to gitk):
gitk -d $(commit-id v2.6.12-rc4) ^$(parent-id $(commit-id v2.6.12-rc3))
--
Kari Hämeenaho
^ permalink raw reply
* Re: gitweb and kernel.org
From: Kay Sievers @ 2005-05-20 18:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Git Mailing List, FTP Admin
In-Reply-To: <428E22F0.3050007@pobox.com>
On Fri, 2005-05-20 at 13:48 -0400, Jeff Garzik wrote:
> No sure who maintains http://www.kernel.org/git/ so...
>
> I have a request for the above URL: provide access to branches in
> refs/heads/* somehow. -All- my work occurs in a branch, with the main
> branch containing nothing but "vanilla Linus" tree.
>
> My jgarzik/libata-dev.git repository contains a large number of branches:
> > [jgarzik@pretzel libata-dev]$ ls .git/refs/heads/
> > adma atapi-enable iomap new-ids promise-sata-pata
> > adma-mwi bridge-detect iomap-step1 passthru sil24
> > ahci-atapi chs-support master pdc2027x
> > ahci-msi ioctl-get-identity misc-fixes pdc20619
>
> and ditto for jgarzik/netdev-2.6.git:
> > [jgarzik@pretzel netdev-2.6]$ ls .git/refs/heads/
> > 8139cp e100 janitor pcnet32 skge we18
> > 8139too-iomap e1000 master ppp smc91x wifi
> > airo forcedeth misc-fixes qeth smc91x-eeprom
> > amd8111 hdlc natsemi r8169 starfire
> > atmel ieee80211 ns83820 register-netdev tlan
> > chelsio iff-running orinoco remove-drivers veth
> > dm9000 ixgb orinoco-hch sis900 viro
Initial support for branches added! :)
Kay
^ permalink raw reply
* Re: gitweb wishlist
From: Kay Sievers @ 2005-05-20 18:58 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Petr Baudis, git
In-Reply-To: <Pine.LNX.4.58.0505201111090.2206@ppc970.osdl.org>
On Fri, 2005-05-20 at 11:16 -0700, Linus Torvalds wrote:
>
> On Fri, 20 May 2005, Kay Sievers wrote:
> >
> > Something like that: :)
> > http://www.kernel.org/git/?p=cogito/cogito.git;a=summary
>
> Looking good.
>
> I still think "minutes" is an awfully long word to waste vertical space
> with, especially since it's also the only one that will have up to three
> digits associated with it.
Changed to "min".
Kay
^ permalink raw reply
* Re: gitweb wishlist
From: Kay Sievers @ 2005-05-20 19:00 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Petr Baudis, git
In-Reply-To: <Pine.LNX.4.58.0505201123550.2206@ppc970.osdl.org>
On Fri, 2005-05-20 at 11:28 -0700, Linus Torvalds wrote:
>
> On Fri, 20 May 2005, Linus Torvalds wrote:
> >
> > Looking good.
>
> Oh, dang, while I'm at it, why not ask for the "commmitdiff" thing to have
> the commit message in it too, ie basically look like a prettified version
> of "git-diff-tree -v -M <cmitname>"
>
> You already do the first line of it, so there's not much missing. Right
> now there is no place where everything important from one commit is
> "brought together" (ie no single place where you can see both what the
> diff is all about, and what it actually does).
Somehting like this?:
http://kernel.org/git/?p=git/git.git;a=commitdiff;h=de809dbbce497e0d107562615c1d85ff35b4e0c5
Kay
^ permalink raw reply
* Re: gitk-1.0 released
From: Linus Torvalds @ 2005-05-20 19:07 UTC (permalink / raw)
To: Kari Hameenaho; +Cc: git
In-Reply-To: <d6l9l1$ttd$1@sea.gmane.org>
On Fri, 20 May 2005, Kari Hameenaho wrote:
> Paul Mackerras wrote:
> >
> > Yes, indeed. I'll have to think about how to do it in a responsive
> > fashion, since getting the necessary information involves reading all
> > the commits and all the tree objects back to the beginning of time,
> > AFAICS.
>
> Maybe its not necessary to go back all the way. It is possible to look only
> commits between 2.6.12-rc4 and 2.6.12-rc3, like follows (needs just a few
> fixes to gitk):
>
> gitk -d $(commit-id v2.6.12-rc4) ^$(parent-id $(commit-id v2.6.12-rc3))
But that _does_ actually go back all the way in time.
It does so inside of "git-rev-tree", and that's why git-rev-tree is slow.
What you can do, is to special-case certain things that git-rev-tree does,
and try to do them more efficiently.
For example, git-rev-list is much nicer to use, exactly because it does
only one very particular special case of what git-rev-tree does, ie "list
all revisions". Because it's a special case, you can do it incrementally.
Similarly, you _can_ actually do "git-rev-tree HEAD ^OLD_HEAD" as a
special case too, and do it "as incrementally as possible". It's more
complicated than the (trivial) git-rev-list, so I've not actually done it,
but it's clearly important enough that I _should_ do it.
The way to do it "as incrementally as possible" is to start with the
HEAD, and walk down and print out everything until you hit OLD_HEAD or a
merge. Then:
- If you hit OLD_HEAD, you're done.
- If you hit a merge, you know the merge itself wasn't in OLD_HEAD, but
now one of the sides might contain OLD_HEAD which might have a merge
pointing to the other side, so you don't know if you should show any of
the commits below it. What you do is:
- walk down both paths in date order - like rev-list does - until you
_do_ hit OLD_HEAD. Here "date order" ends up being an approximation
for "how do I avoid going down a long chain that ends up already
being pointed to by OLD_HEAD"
- mark everything reachable from OLD_HEAD as being uninteresting (aka
"seen"), and everything that reaches OLD_HEAD as being interesting
and print it out.
- as long as there are commits that aren't marked either uninteresting
_or_ interesting (they are unknown) continue to walk the commit
chain in date order, where the parent(s) of an uninteresting commit
is always uninteresting.
- eventually, you'll have no unknowns left, and you can stop.
In the worst case, you'll end up walking back to the root (somebody did
development against the root, and then merged that development up after
OLD_HEAD), but that ends up being increasingly unlikely as the project
grows, so in practice this kind of algorithm will always end up doign work
that is comparable to the amount of development between OLD_HEAD and HEAD,
and independent of the total history size.
I might have missed some detail in the above, but it should be _fairly_
straightforward to start with rev-list.c and make it generate the lists of
"interesting", "uninteresting" and "unknown" commits and do the above.
Is anybody up for coding up this small exercise in graph traversal?
Linus
^ permalink raw reply
* Re: gitweb wishlist
From: Linus Torvalds @ 2005-05-20 19:13 UTC (permalink / raw)
To: Kay Sievers; +Cc: Petr Baudis, git
In-Reply-To: <1116615600.12975.33.camel@dhcp-188>
On Fri, 20 May 2005, Kay Sievers wrote:
>
> Somehting like this?:
> http://kernel.org/git/?p=git/git.git;a=commitdiff;h=de809dbbce497e0d107562615c1d85ff35b4e0c5
Yes, except I don't think you should repeat the part of the commit message
that you used as a header (so in your example, since you already used "Fix
up previous commit" in the header, don't show it below).
Btw, any chance to see gitweb itself under gitweb on kernel.org?
Linus
^ permalink raw reply
* Re: gitweb wishlist
From: Thomas Glanzmann @ 2005-05-20 19:13 UTC (permalink / raw)
To: git
In-Reply-To: <1116615600.12975.33.camel@dhcp-188>
Hello Kay,
I would like to see that I can klick on the file instead of the seperate
'blob' link in a directory view, becasue that is more intuitive and you can
already an klick on directories:
http://www.kernel.org/git/?p=git/git.git;a=tree;h=665a48af9e192ed84d2707c95d4c0d9c45eb45ad;hb=411746940f02f6fb90c4b6b97c6f07cee599c2e1
Thanks for this great tool!
Sincerely,
Thomas
^ 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