Merge changes in the master branch into 0.99.5 preparation branch.

This commit is contained in:
Junio C Hamano 2005-08-11 22:12:29 -07:00
commit 8eb14dc188
22 changed files with 245 additions and 99 deletions

View File

@ -244,7 +244,8 @@ deb: dist
clean:
rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
rm -f $(GIT_TARNAME).tar.gz git-core.spec git-core_$(GIT_VERSION)-*.deb
rm -f $(GIT_TARNAME).tar.gz git-core.spec
rm -f git-core_$(GIT_VERSION)-*.deb git-tk_$(GIT_VERSION)-*.deb
rm -rf $(GIT_TARNAME)
$(MAKE) -C tools/ clean
$(MAKE) -C Documentation/ clean

8
debian/changelog vendored
View File

@ -4,6 +4,14 @@ git-core (0.99.5-0) unstable; urgency=low
-- Junio C Hamano <junkio@cox.net> Wed, 10 Aug 2005 22:05:00 -0700
git-core (0.99.4-3) unstable; urgency=low
* Split off gitk.
* Do not depend on diff which is an essential package.
* Use dh_movefiles, not dh_install, to stage two subpackages.
-- Matthias Urlichs <smurf@debian.org> Thu, 11 Aug 2005 01:43:24 +0200
git-core (0.99.4-2) unstable; urgency=low
* Git 0.99.4 official release.

10
debian/control vendored
View File

@ -7,7 +7,7 @@ Standards-Version: 3.6.1
Package: git-core
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, patch, diff, rcs
Depends: ${shlibs:Depends}, ${misc:Depends}, patch, rcs
Recommends: rsync, curl, ssh, libmail-sendmail-perl, libemail-valid-perl
Conflicts: git
Description: The git content addressable filesystem
@ -15,5 +15,11 @@ Description: The git content addressable filesystem
and flexible filesystem-based database designed to store directory trees
with regard to their history. The top layer is a SCM-like tool which
enables human beings to work with the database in a manner to a degree
similar to other SCM tools (like CVS, BitKeeper or Monotone).
similar to other SCM tools.
Package: git-tk
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, git-core, tk8.4
Description: The git content addressable filesystem, GUI add-on
This package contains 'gitk', the git revision tree visualizer.

25
debian/copyright vendored
View File

@ -1,3 +1,24 @@
License:
This package was downloaded from ftp.kernel.org:/pub/software/scm/git/.
GPL v2 (see COPYING for details)
Upstream Author: Linus Torvalds and many others
Copyright:
Copyright 2005, Linus Torvalds and others.
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

2
debian/docs vendored
View File

@ -1,3 +1 @@
README
COPYING

1
debian/git-core.files vendored Normal file
View File

@ -0,0 +1 @@
/usr

View File

@ -1 +0,0 @@
*

1
debian/git-tk.files vendored Normal file
View File

@ -0,0 +1 @@
/usr/bin/gitk

4
debian/rules vendored
View File

@ -61,7 +61,9 @@ install: build
mkdir -p $(DOC_DESTDIR)
find $(DOC) '(' -name '*.txt' -o -name '*.html' ')' -exec install {} $(DOC_DESTDIR) ';'
dh_install --list-missing --sourcedir=$(DESTDIR)
dh_movefiles -p git-tk
dh_movefiles -p git-core
find debian/tmp -type d -o -print | sed -e 's/^/? /'
binary: build install
dh_testdir

47
gitk
View File

@ -31,7 +31,7 @@ proc getcommits {rargs} {
set phase getcommits
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
set ncmupdate 0
set ncmupdate 1
if [catch {
set parse_args [concat --default HEAD $rargs]
set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
@ -62,7 +62,6 @@ proc getcommitlines {commfd} {
global commits parents cdate children nchildren
global commitlisted phase commitinfo nextupdate
global stopped redisplaying leftover
global numcommits ncmupdate
set stuff [read $commfd]
if {$stuff == {}} {
@ -110,10 +109,8 @@ to allow selection of commits to be displayed.)}
set commitlisted($id) 1
parsecommit $id $cmit 1
drawcommit $id
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate + 100} {
doupdate
set ncmupdate $numcommits
if {[clock clicks -milliseconds] >= $nextupdate} {
doupdate 1
}
while {$redisplaying} {
set redisplaying 0
@ -123,10 +120,8 @@ to allow selection of commits to be displayed.)}
foreach id $commits {
drawcommit $id
if {$stopped} break
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate + 100} {
doupdate
set ncmupdate $numcommits
if {[clock clicks -milliseconds] >= $nextupdate} {
doupdate 1
}
}
}
@ -134,13 +129,24 @@ to allow selection of commits to be displayed.)}
}
}
proc doupdate {} {
global commfd nextupdate
proc doupdate {reading} {
global commfd nextupdate numcommits ncmupdate
incr nextupdate 100
fileevent $commfd readable {}
if {$reading} {
fileevent $commfd readable {}
}
update
fileevent $commfd readable [list getcommitlines $commfd]
set nextupdate [expr {[clock clicks -milliseconds] + 100}]
if {$numcommits < 100} {
set ncmupdate [expr {$numcommits + 1}]
} elseif {$numcommits < 10000} {
set ncmupdate [expr {$numcommits + 10}]
} else {
set ncmupdate [expr {$numcommits + 100}]
}
if {$reading} {
fileevent $commfd readable [list getcommitlines $commfd]
}
}
proc readcommit {id} {
@ -1127,8 +1133,7 @@ proc drawcommit {id} {
}
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate} {
doupdate
set ncmupdate $numcommits
doupdate 1
if {$stopped} break
}
}
@ -1171,7 +1176,7 @@ proc drawgraph {} {
if {$startcommits == {}} return
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
set ncmupdate 0
set ncmupdate 1
initgraph
set todo [lindex $startcommits 0]
drawrest 0 1
@ -1210,10 +1215,8 @@ proc drawrest {level startix} {
drawslants $level
}
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate + 100} {
update
incr nextupdate 100
set ncmupdate $numcommits
&& $numcommits >= $ncmupdate} {
doupdate 0
}
}
}

View File

@ -2,6 +2,86 @@
#include "cache.h"
#include "commit.h"
#define PARENT1 1
#define PARENT2 2
#define UNINTERESTING 4
static struct commit *interesting(struct commit_list *list)
{
while (list) {
struct commit *commit = list->item;
list = list->next;
if (commit->object.flags & UNINTERESTING)
continue;
return commit;
}
return NULL;
}
/*
* A pathological example of how this thing works.
*
* Suppose we had this commit graph, where chronologically
* the timestamp on the commit are A <= B <= C <= D <= E <= F
* and we are trying to figure out the merge base for E and F
* commits.
*
* F
* / \
* E A D
* \ / /
* B /
* \ /
* C
*
* First we push E and F to list to be processed. E gets bit 1
* and F gets bit 2. The list becomes:
*
* list=F(2) E(1), result=empty
*
* Then we pop F, the newest commit, from the list. Its flag is 2.
* We scan its parents, mark them reachable from the side that F is
* reachable from, and push them to the list:
*
* list=E(1) D(2) A(2), result=empty
*
* Next pop E and do the same.
*
* list=D(2) B(1) A(2), result=empty
*
* Next pop D and do the same.
*
* list=C(2) B(1) A(2), result=empty
*
* Next pop C and do the same.
*
* list=B(1) A(2), result=empty
*
* Now it is B's turn. We mark its parent, C, reachable from B's side,
* and push it to the list:
*
* list=C(3) A(2), result=empty
*
* Now pop C and notice it has flags==3. It is placed on the result list,
* and the list now contains:
*
* list=A(2), result=C(3)
*
* We pop A and do the same.
*
* list=B(3), result=C(3)
*
* Next, we pop B and something very interesting happens. It has flags==3
* so it is also placed on the result list, and its parents are marked
* uninteresting, retroactively, and placed back on the list:
*
* list=C(7), result=C(7) B(3)
*
* Now, list does not have any interesting commit. So we find the newest
* commit from the result list that is not marked uninteresting. Which is
* commit B.
*/
static struct commit *common_ancestor(struct commit *rev1, struct commit *rev2)
{
struct commit_list *list = NULL;
@ -18,19 +98,18 @@ static struct commit *common_ancestor(struct commit *rev1, struct commit *rev2)
insert_by_date(rev1, &list);
insert_by_date(rev2, &list);
while (list) {
while (interesting(list)) {
struct commit *commit = list->item;
struct commit_list *tmp = list, *parents;
int flags = commit->object.flags & 3;
int flags = commit->object.flags & 7;
list = list->next;
free(tmp);
switch (flags) {
case 3:
if (flags == 3) {
insert_by_date(commit, &result);
continue;
case 0:
die("git-merge-base: commit without either parent?");
/* Mark children of a found merge uninteresting */
flags |= UNINTERESTING;
}
parents = commit->parents;
while (parents) {
@ -43,9 +122,7 @@ static struct commit *common_ancestor(struct commit *rev1, struct commit *rev2)
insert_by_date(p, &list);
}
}
if (!result)
return NULL;
return result->item;
return interesting(result);
}
int main(int argc, char **argv)

58
pull.c
View File

@ -98,12 +98,39 @@ static int process_tag(struct tag *tag)
static struct object_list *process_queue = NULL;
static struct object_list **process_queue_end = &process_queue;
static int process_object(struct object *obj)
{
if (obj->type == commit_type) {
if (process_commit((struct commit *)obj))
return -1;
return 0;
}
if (obj->type == tree_type) {
if (process_tree((struct tree *)obj))
return -1;
return 0;
}
if (obj->type == blob_type) {
return 0;
}
if (obj->type == tag_type) {
if (process_tag((struct tag *)obj))
return -1;
return 0;
}
return error("Unable to determine requirements "
"of type %s for %s",
obj->type, sha1_to_hex(obj->sha1));
}
static int process(unsigned char *sha1, const char *type)
{
struct object *obj;
if (has_sha1_file(sha1))
return 0;
obj = lookup_object_type(sha1, type);
struct object *obj = lookup_object_type(sha1, type);
if (has_sha1_file(sha1)) {
parse_object(sha1);
/* We already have it, so we should scan it now. */
return process_object(obj);
}
if (object_list_contains(process_queue, obj))
return 0;
object_list_insert(obj, process_queue_end);
@ -134,27 +161,8 @@ static int loop(void)
return -1;
if (!obj->type)
parse_object(obj->sha1);
if (obj->type == commit_type) {
if (process_commit((struct commit *)obj))
return -1;
continue;
}
if (obj->type == tree_type) {
if (process_tree((struct tree *)obj))
return -1;
continue;
}
if (obj->type == blob_type) {
continue;
}
if (obj->type == tag_type) {
if (process_tag((struct tag *)obj))
return -1;
continue;
}
return error("Unable to determine requirements "
"of type %s for %s",
obj->type, sha1_to_hex(obj->sha1));
if (process_object(obj))
return -1;
}
return 0;
}

View File

@ -100,7 +100,7 @@ test_expect_success \
git-checkout-cache -u -f -q -a &&
git-update-cache --add yomin &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >4.out || exit
git-ls-files --stage >4.out || return 1
diff -u M.out 4.out >4diff.out
compare_change 4diff.out expected &&
check_cache_at yomin clean'
@ -114,7 +114,7 @@ test_expect_success \
git-update-cache --add yomin &&
echo yomin yomin >yomin &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >5.out || exit
git-ls-files --stage >5.out || return 1
diff -u M.out 5.out >5diff.out
compare_change 5diff.out expected &&
check_cache_at yomin dirty'
@ -215,7 +215,7 @@ test_expect_success \
echo nitfol nitfol >nitfol &&
git-update-cache --add nitfol &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >14.out || exit
git-ls-files --stage >14.out || return 1
diff -u M.out 14.out >14diff.out
compare_change 14diff.out expected &&
check_cache_at nitfol clean'
@ -229,7 +229,7 @@ test_expect_success \
git-update-cache --add nitfol &&
echo nitfol nitfol nitfol >nitfol &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >15.out || exit
git-ls-files --stage >15.out || return 1
diff -u M.out 15.out >15diff.out
compare_change 15diff.out expected &&
check_cache_at nitfol dirty'

View File

@ -73,7 +73,7 @@ test_expect_success \
'rm -f .git/index &&
git-update-cache --add yomin &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >4.out || exit
git-ls-files --stage >4.out || return 1
diff --unified=0 M.out 4.out >4diff.out
compare_change 4diff.out expected &&
check_cache_at yomin clean &&
@ -90,7 +90,7 @@ test_expect_success \
git-update-cache --add yomin &&
echo yomin yomin >yomin &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >5.out || exit
git-ls-files --stage >5.out || return 1
diff --unified=0 M.out 5.out >5diff.out
compare_change 5diff.out expected &&
check_cache_at yomin dirty &&
@ -192,7 +192,7 @@ test_expect_success \
echo nitfol nitfol >nitfol &&
git-update-cache --add nitfol &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >14.out || exit
git-ls-files --stage >14.out || return 1
diff --unified=0 M.out 14.out >14diff.out
compare_change 14diff.out expected &&
sum bozbar frotz >actual14.sum &&
@ -212,7 +212,7 @@ test_expect_success \
git-update-cache --add nitfol &&
echo nitfol nitfol nitfol >nitfol &&
git-read-tree -m -u $treeH $treeM &&
git-ls-files --stage >15.out || exit
git-ls-files --stage >15.out || return 1
diff --unified=0 M.out 15.out >15diff.out
compare_change 15diff.out expected &&
check_cache_at nitfol dirty &&

View File

@ -120,7 +120,7 @@ test_expect_success \
git-checkout-cache -u -f -q -a &&
git-update-cache --add yomin &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >4.out || exit
git-ls-files --stage >4.out || return 1
diff -u M.out 4.out >4diff.out
compare_change 4diff.out expected &&
check_cache_at yomin clean'
@ -136,7 +136,7 @@ test_expect_success \
git-update-cache --add yomin &&
echo yomin yomin >yomin &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >5.out || exit
git-ls-files --stage >5.out || return 1
diff -u M.out 5.out >5diff.out
compare_change 5diff.out expected &&
check_cache_at yomin dirty'
@ -241,7 +241,7 @@ test_expect_success \
echo nitfol nitfol >nitfol &&
git-update-cache --add nitfol &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >14.out || exit
git-ls-files --stage >14.out || return 1
diff -u M.out 14.out >14diff.out
compare_change 14diff.out expected &&
check_cache_at nitfol clean'
@ -255,7 +255,7 @@ test_expect_success \
git-update-cache --add nitfol &&
echo nitfol nitfol nitfol >nitfol &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >15.out || exit
git-ls-files --stage >15.out || return 1
diff -u M.out 15.out >15diff.out
compare_change 15diff.out expected &&
check_cache_at nitfol dirty'
@ -352,7 +352,7 @@ test_expect_success \
sed -e "s/such as/SUCH AS/" bozbar-old >bozbar &&
git-update-cache --add bozbar &&
read_tree_twoway $treeH $treeM &&
git-ls-files --stage >22.out || exit
git-ls-files --stage >22.out || return 1
diff -u M.out 22.out >22diff.out
compare_change 22diff.out &&
check_cache_at bozbar clean'

View File

@ -93,3 +93,4 @@ test_expect_success \
test -d tmp-path1 &&
test -f tmp-path1/file1'
test_done

View File

@ -66,3 +66,5 @@ test_expect_success \
--exclude-from=.git/ignore \
>output &&
diff -u expect output'
test_done

View File

@ -191,7 +191,7 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] &&
git-read-tree $tree_A &&
git-checkout-cache -f -a &&
git-read-tree -m $tree_O || (exit 1)
git-read-tree -m $tree_O || return 1
git-update-cache --refresh >/dev/null ;# this can exit non-zero
git-diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-OA'
@ -201,7 +201,7 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] &&
git-read-tree $tree_B &&
git-checkout-cache -f -a &&
git-read-tree -m $tree_O || (exit 1)
git-read-tree -m $tree_O || return 1
git-update-cache --refresh >/dev/null ;# this can exit non-zero
git-diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-OB'
@ -211,7 +211,7 @@ test_expect_success \
'rm -fr Z [A-Z][A-Z] &&
git-read-tree $tree_B &&
git-checkout-cache -f -a &&
git-read-tree -m $tree_A || (exit 1)
git-read-tree -m $tree_A || return 1
git-update-cache --refresh >/dev/null ;# this can exit non-zero
git-diff-files >.test-a &&
cmp_diff_files_output .test-a .test-recursive-AB'

View File

@ -30,3 +30,5 @@ do
"git-apply <diff.$i-$j && diff frotz.$j frotz"
done
done
test_done

View File

@ -16,7 +16,7 @@ test_expect_success \
for i in a b c
do
dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
git-update-cache --add $i || exit
git-update-cache --add $i || return 1
done &&
cat c >d && echo foo >>d && git-update-cache --add d &&
tree=`git-write-tree` &&
@ -29,7 +29,7 @@ test_expect_success \
while read object
do
t=`git-cat-file -t $object` &&
git-cat-file $t $object || exit 1
git-cat-file $t $object || return 1
done <obj-list
} >expect'
@ -58,7 +58,7 @@ test_expect_success \
do
cmp $path ../.git/$path || {
echo $path differs.
exit 1
return 1
}
done'
cd $TRASH
@ -88,7 +88,7 @@ test_expect_success \
do
cmp $path ../.git/$path || {
echo $path differs.
exit 1
return 1
}
done'
cd $TRASH
@ -106,7 +106,7 @@ test_expect_success \
while read object
do
t=`git-cat-file -t $object` &&
git-cat-file $t $object || exit 1
git-cat-file $t $object || return 1
done <obj-list
} >current &&
diff expect current'
@ -122,7 +122,7 @@ test_expect_success \
while read object
do
t=`git-cat-file -t $object` &&
git-cat-file $t $object || exit 1
git-cat-file $t $object || return 1
done <obj-list
} >current &&
diff expect current'

View File

@ -18,7 +18,7 @@ test_expect_success setup '
do
sleep 1 &&
commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
parent=$commit || exit
parent=$commit || return 1
done &&
echo "$commit" >.git/HEAD &&
git clone -l ./. victim &&
@ -31,7 +31,7 @@ test_expect_success setup '
do
sleep 1 &&
commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
parent=$commit || exit
parent=$commit || return 1
done &&
echo "$commit" >.git/HEAD &&
echo Rebase &&
@ -52,3 +52,5 @@ test_expect_success \
git-send-pack --force ./victim/.git/ master &&
cmp victim/.git/refs/heads/master .git/refs/heads/master
'
test_done

View File

@ -5,8 +5,9 @@
# For repeatability, reset the environment to known value.
LANG=C
PAGER=cat
TZ=UTC
export LANG TZ
export LANG PAGER TZ
unset AUTHOR_DATE
unset AUTHOR_EMAIL
unset AUTHOR_NAME
@ -35,6 +36,7 @@ unset SHA1_FILE_DIRECTORY
error () {
echo "* error: $*"
trap - exit
exit 1
}
@ -62,6 +64,7 @@ do
esac
done
exec 5>&1
if test "$verbose" = "t"
then
exec 4>&2 3>&1
@ -72,6 +75,8 @@ fi
test_failure=0
test_count=0
trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
# You are not expected to call test_ok_ and test_failure_ directly, use
# the text_expect_* functions instead.
@ -87,31 +92,39 @@ test_failure_ () {
say "FAIL $test_count: $1"
shift
echo "$@" | sed -e 's/^/ /'
test "$immediate" == "" || exit 1
test "$immediate" = "" || { trap - exit; exit 1; }
}
test_debug () {
test "$debug" == "" || eval "$1"
test "$debug" = "" || eval "$1"
}
test_run_ () {
eval >&3 2>&4 "$1"
eval_ret="$?"
return 0
}
test_expect_failure () {
test "$#" == 2 ||
test "$#" = 2 ||
error "bug in the test script: not 2 parameters to test-expect-failure"
say >&3 "expecting failure: $2"
if eval >&3 2>&4 "$2"
test_run_ "$2"
if [ "$?" = 0 -a "$eval_ret" != 0 ]
then
test_failure_ "$@"
else
test_ok_ "$1"
else
test_failure_ "$@"
fi
}
test_expect_success () {
test "$#" == 2 ||
test "$#" = 2 ||
error "bug in the test script: not 2 parameters to test-expect-success"
say >&3 "expecting success: $2"
if eval >&3 2>&4 "$2"
test_run_ "$2"
if [ "$?" = 0 -a "$eval_ret" = 0 ]
then
test_ok_ "$1"
else
@ -120,6 +133,7 @@ test_expect_success () {
}
test_done () {
trap - exit
case "$test_failure" in
0)
# We could: