* Re: [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics
From: Linus Torvalds @ 2006-04-02 21:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmzf3k7m9.fsf@assigned-by-dhcp.cox.net>
On Sun, 2 Apr 2006, Junio C Hamano wrote:
> Linus Torvalds <torvalds@osdl.org> writes:
>
> > This is the "letter of the law" version of using fgets() properly in the
> > face of incredibly broken stdio implementations. We can work around the
> > Solaris breakage with SA_RESTART, but in case anybody else is ever that
> > stupid, here's the "safe" (read: "insanely anal") way to use fgets.
>
> Did you mean this as a real change or a demonstration? The
> sigaction change is a real fix, but somehow I find this one
> similar to the "(void*) NULL" thing you objected earlier (which
> was not merged because I agreed with your argument)...
I don't have any really strong opinions on it. I think that any libc that
needs the "ferror()" test + EINTR loopback is totally broken. I would
happily say that people should just not use a development platform that is
that horrible.
But the fact that Solaris actually had that as a real problem (never mind
that we could work around it another way) just makes me go "Hmm..".
So I _think_ we're safe with just the "sigaction()" diff. Neither of the
patches _should_ make any difference at all on a sane platform.
Linus
^ permalink raw reply
* Re: [RFH] xdiff shows trivially redundant diff.
From: Linus Torvalds @ 2006-04-02 21:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Davide Libenzi, git
In-Reply-To: <7vzmj3k7x9.fsf@assigned-by-dhcp.cox.net>
On Sun, 2 Apr 2006, Junio C Hamano wrote:
>
> I should have tried your pristine xdiff code myself before
> bothering you, but I haven't (sorry).
It definitely happens with plain libxdiff-0.17 too.
In general, unless it's related to the "\ No newline" or the extra stuff
on the "@@"-line, I'd be very surprised if we have any differences in the
diff output wrt libxdiff-0.17. I was really pretty careful, and didn't
change the code at all, just removed unnecessary files and functions.
Linus
^ permalink raw reply
* Re: [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics
From: Junio C Hamano @ 2006-04-02 21:09 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604021328380.3050@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> This is the "letter of the law" version of using fgets() properly in the
> face of incredibly broken stdio implementations. We can work around the
> Solaris breakage with SA_RESTART, but in case anybody else is ever that
> stupid, here's the "safe" (read: "insanely anal") way to use fgets.
Thanks.
It's good that I can say "Oh, I think this is the part that is
broken, but I am going to bed" to find the problem solved by
capable others when I wake up the next day. Global distributed
development process at the finest, although I suspect Jason,
Linus and myself are all in the same timezone ;-)
Did you mean this as a real change or a demonstration? The
sigaction change is a real fix, but somehow I find this one
similar to the "(void*) NULL" thing you objected earlier (which
was not merged because I agreed with your argument)...
^ permalink raw reply
* Re: [RFH] xdiff shows trivially redundant diff.
From: Junio C Hamano @ 2006-04-02 21:02 UTC (permalink / raw)
To: Davide Libenzi; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.64.0604021035130.30097@alien.or.mcafeemobile.com>
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
Davide Libenzi <davidel@xmailserver.org> writes:
> On Sun, 2 Apr 2006, Junio C Hamano wrote:
>
>> $ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
>>
>> shows a change that trivially is redundant, like this:
>>
>> diff --git a/git-fetch.sh b/git-fetch.sh
>> index b4325d9..de4f011 100755
>> --- a/git-fetch.sh
>> +++ b/git-fetch.sh
>> @@ -320,7 +320,7 @@ fetch_main () {
>>..
>> Notice the first '-' and '+' lines of second hunk are identical?
>>
>> There is another interesting thing. This is running diff
>> between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
>> so that the first hunk is not different, then this anomaly
>> disappears.
>
> Could you send me the two files that creates the above diff?
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
The problem is from the "stripped down" version we use in git,
so you may or may not see the problem in your version. Attached
are the files.
[-- Attachment #2: diff test preimage --]
[-- Type: text/plain, Size: 9364 bytes --]
#!/bin/sh
#
USAGE='<fetch-options> <repository> <refspec>...'
. git-sh-setup
. git-parse-remote
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
LF='
'
IFS="$LF"
no_tags=
tags=
append=
force=
verbose=
update_head_ok=
exec=
upload_pack=
while case "$#" in 0) break ;; esac
do
case "$1" in
-a|--a|--ap|--app|--appe|--appen|--append)
append=t
;;
--upl|--uplo|--uploa|--upload|--upload-|--upload-p|\
--upload-pa|--upload-pac|--upload-pack)
shift
exec="--exec=$1"
upload_pack="-u $1"
;;
-f|--f|--fo|--for|--forc|--force)
force=t
;;
-t|--t|--ta|--tag|--tags)
tags=t
;;
-n|--n|--no|--no-|--no-t|--no-ta|--no-tag|--no-tags)
no_tags=t
;;
-u|--u|--up|--upd|--upda|--updat|--update|--update-|--update-h|\
--update-he|--update-hea|--update-head|--update-head-|\
--update-head-o|--update-head-ok)
update_head_ok=t
;;
-v|--verbose)
verbose=Yes
;;
-k|--k|--ke|--kee|--keep)
keep=--keep
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
case "$#" in
0)
test -f "$GIT_DIR/branches/origin" ||
test -f "$GIT_DIR/remotes/origin" ||
die "Where do you want to fetch from today?"
set origin ;;
esac
remote_nick="$1"
remote=$(get_remote_url "$@")
refs=
rref=
rsync_slurped_objects=
if test "" = "$append"
then
: >"$GIT_DIR/FETCH_HEAD"
fi
append_fetch_head () {
head_="$1"
remote_="$2"
remote_name_="$3"
remote_nick_="$4"
local_name_="$5"
case "$6" in
t) not_for_merge_='not-for-merge' ;;
'') not_for_merge_= ;;
esac
# remote-nick is the URL given on the command line (or a shorthand)
# remote-name is the $GIT_DIR relative refs/ path we computed
# for this refspec.
case "$remote_name_" in
HEAD)
note_= ;;
refs/heads/*)
note_="$(expr "$remote_name_" : 'refs/heads/\(.*\)')"
note_="branch '$note_' of " ;;
refs/tags/*)
note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
note_="tag '$note_' of " ;;
*)
note_="$remote_name of " ;;
esac
remote_1_=$(expr "$remote_" : '\(.*\)\.git/*$') &&
remote_="$remote_1_"
note_="$note_$remote_"
# 2.6.11-tree tag would not be happy to be fed to resolve.
if git-cat-file commit "$head_" >/dev/null 2>&1
then
headc_=$(git-rev-parse --verify "$head_^0") || exit
echo "$headc_ $not_for_merge_ $note_" >>"$GIT_DIR/FETCH_HEAD"
[ "$verbose" ] && echo >&2 "* committish: $head_"
[ "$verbose" ] && echo >&2 " $note_"
else
echo "$head_ not-for-merge $note_" >>"$GIT_DIR/FETCH_HEAD"
[ "$verbose" ] && echo >&2 "* non-commit: $head_"
[ "$verbose" ] && echo >&2 " $note_"
fi
if test "$local_name_" != ""
then
# We are storing the head locally. Make sure that it is
# a fast forward (aka "reverse push").
fast_forward_local "$local_name_" "$head_" "$note_"
fi
}
fast_forward_local () {
mkdir -p "$(dirname "$GIT_DIR/$1")"
case "$1" in
refs/tags/*)
# Tags need not be pointing at commits so there
# is no way to guarantee "fast-forward" anyway.
if test -f "$GIT_DIR/$1"
then
if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
then
[ "$verbose" ] && echo >&2 "* $1: same as $3"
else
echo >&2 "* $1: updating with $3"
fi
else
echo >&2 "* $1: storing $3"
fi
git-update-ref "$1" "$2"
;;
refs/heads/*)
# $1 is the ref being updated.
# $2 is the new value for the ref.
local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
if test "$local"
then
# Require fast-forward.
mb=$(git-merge-base "$local" "$2") &&
case "$2,$mb" in
$local,*)
echo >&2 "* $1: same as $3"
;;
*,$local)
echo >&2 "* $1: fast forward to $3"
git-update-ref "$1" "$2" "$local"
;;
*)
false
;;
esac || {
echo >&2 "* $1: does not fast forward to $3;"
case ",$force,$single_force," in
*,t,*)
echo >&2 " forcing update."
git-update-ref "$1" "$2" "$local"
;;
*)
echo >&2 " not updating."
;;
esac
}
else
echo >&2 "* $1: storing $3"
git-update-ref "$1" "$2"
fi
;;
esac
}
case "$update_head_ok" in
'')
orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
;;
esac
# If --tags (and later --heads or --all) is specified, then we are
# not talking about defaults stored in Pull: line of remotes or
# branches file, and just fetch those and refspecs explicitly given.
# Otherwise we do what we always did.
reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags"
then
taglist=$(IFS=" " &&
git-ls-remote $upload_pack --tags "$remote" |
while read sha1 name
do
case "$name" in
(*^*) continue ;;
esac
if git-check-ref-format "$name"
then
echo ".${name}:${name}"
else
echo >&2 "warning: tag ${name} ignored"
fi
done)
if test "$#" -gt 1
then
# remote URL plus explicit refspecs; we need to merge them.
reflist="$reflist$LF$taglist"
else
# No explicit refspecs; fetch tags only.
reflist=$taglist
fi
fi
fetch_main () {
reflist="$1"
refs=
for ref in $reflist
do
refs="$refs$LF$ref"
# These are relative path from $GIT_DIR, typically starting at refs/
# but may be HEAD
if expr "$ref" : '\.' >/dev/null
then
not_for_merge=t
ref=$(expr "$ref" : '\.\(.*\)')
else
not_for_merge=
fi
if expr "$ref" : '\+' >/dev/null
then
single_force=t
ref=$(expr "$ref" : '\+\(.*\)')
else
single_force=
fi
remote_name=$(expr "$ref" : '\([^:]*\):')
local_name=$(expr "$ref" : '[^:]*:\(.*\)')
rref="$rref$LF$remote_name"
# There are transports that can fetch only one head at a time...
case "$remote" in
http://* | https://*)
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k"
fi
remote_name_quoted=$(perl -e '
my $u = $ARGV[0];
$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
print "$u";
' "$remote_name")
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
expr "$head" : "$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
echo >&2 Fetching "$remote_name from $remote" using http
git-http-fetch -v -a "$head" "$remote/" || exit
;;
rsync://*)
TMP_HEAD="$GIT_DIR/TMP_HEAD"
rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1
head=$(git-rev-parse --verify TMP_HEAD)
rm -f "$TMP_HEAD"
test "$rsync_slurped_objects" || {
rsync -av --ignore-existing --exclude info \
"$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit
# Look at objects/info/alternates for rsync -- http will
# support it natively and git native ones will do it on
# the remote end. Not having that file is not a crime.
rsync -q "$remote/objects/info/alternates" \
"$GIT_DIR/TMP_ALT" 2>/dev/null ||
rm -f "$GIT_DIR/TMP_ALT"
if test -f "$GIT_DIR/TMP_ALT"
then
resolve_alternates "$remote" <"$GIT_DIR/TMP_ALT" |
while read alt
do
case "$alt" in 'bad alternate: '*) die "$alt";; esac
echo >&2 "Getting alternate: $alt"
rsync -av --ignore-existing --exclude info \
"$alt" "$GIT_OBJECT_DIRECTORY/" || exit
done
rm -f "$GIT_DIR/TMP_ALT"
fi
rsync_slurped_objects=t
}
;;
*)
# We will do git native transport with just one call later.
continue ;;
esac
append_fetch_head "$head" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
case "$remote" in
http://* | https://* | rsync://* )
;; # we are already done.
*)
( : subshell because we muck with IFS
IFS=" $LF"
(
git-fetch-pack $exec $keep "$remote" $rref || echo failed "$remote"
) |
while read sha1 remote_name
do
case "$sha1" in
failed)
echo >&2 "Fetch failure: $remote"
exit 1 ;;
esac
found=
single_force=
for ref in $refs
do
case "$ref" in
+$remote_name:*)
single_force=t
not_for_merge=
found="$ref"
break ;;
.+$remote_name:*)
single_force=t
not_for_merge=t
found="$ref"
break ;;
.$remote_name:*)
not_for_merge=t
found="$ref"
break ;;
$remote_name:*)
not_for_merge=
found="$ref"
break ;;
esac
done
local_name=$(expr "$found" : '[^:]*:\(.*\)')
append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
) || exit ;;
esac
}
fetch_main "$reflist"
# automated tag following
case "$no_tags$tags" in
'')
taglist=$(IFS=" " &&
git-ls-remote $upload_pack --tags "$remote" |
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
while read sha1 name
do
test -f "$GIT_DIR/$name" && continue
git-check-ref-format "$name" || {
echo >&2 "warning: tag ${name} ignored"
continue
}
git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
echo >&2 "Auto-following $name"
echo ".${name}:${name}"
done)
case "$taglist" in
'') ;;
?*)
fetch_main "$taglist" ;;
esac
esac
# If the original head was empty (i.e. no "master" yet), or
# if we were told not to worry, we do not have to check.
case ",$update_head_ok,$orig_head," in
*,, | t,* )
;;
*)
curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
if test "$curr_head" != "$orig_head"
then
git-update-ref HEAD "$orig_head"
die "Cannot fetch into the current branch."
fi
;;
esac
[-- Attachment #3: diff test postimage --]
[-- Type: text/plain, Size: 9508 bytes --]
#!/bin/sh
#
USAGE='<fetch-options> <repository> <refspec>...'
. git-sh-setup
. git-parse-remote
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
LF='
'
IFS="$LF"
no_tags=
tags=
append=
force=
verbose=
update_head_ok=
exec=
upload_pack=
while case "$#" in 0) break ;; esac
do
case "$1" in
-a|--a|--ap|--app|--appe|--appen|--append)
append=t
;;
--upl|--uplo|--uploa|--upload|--upload-|--upload-p|\
--upload-pa|--upload-pac|--upload-pack)
shift
exec="--exec=$1"
upload_pack="-u $1"
;;
-f|--f|--fo|--for|--forc|--force)
force=t
;;
-t|--t|--ta|--tag|--tags)
tags=t
;;
-n|--n|--no|--no-|--no-t|--no-ta|--no-tag|--no-tags)
no_tags=t
;;
-u|--u|--up|--upd|--upda|--updat|--update|--update-|--update-h|\
--update-he|--update-hea|--update-head|--update-head-|\
--update-head-o|--update-head-ok)
update_head_ok=t
;;
-v|--verbose)
verbose=Yes
;;
-k|--k|--ke|--kee|--keep)
keep=--keep
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
case "$#" in
0)
test -f "$GIT_DIR/branches/origin" ||
test -f "$GIT_DIR/remotes/origin" ||
die "Where do you want to fetch from today?"
set origin ;;
esac
remote_nick="$1"
remote=$(get_remote_url "$@")
refs=
rref=
rsync_slurped_objects=
if test "" = "$append"
then
: >"$GIT_DIR/FETCH_HEAD"
fi
append_fetch_head () {
head_="$1"
remote_="$2"
remote_name_="$3"
remote_nick_="$4"
local_name_="$5"
case "$6" in
t) not_for_merge_='not-for-merge' ;;
'') not_for_merge_= ;;
esac
# remote-nick is the URL given on the command line (or a shorthand)
# remote-name is the $GIT_DIR relative refs/ path we computed
# for this refspec.
case "$remote_name_" in
HEAD)
note_= ;;
refs/heads/*)
note_="$(expr "$remote_name_" : 'refs/heads/\(.*\)')"
note_="branch '$note_' of " ;;
refs/tags/*)
note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
note_="tag '$note_' of " ;;
*)
note_="$remote_name of " ;;
esac
remote_1_=$(expr "$remote_" : '\(.*\)\.git/*$') &&
remote_="$remote_1_"
note_="$note_$remote_"
# 2.6.11-tree tag would not be happy to be fed to resolve.
if git-cat-file commit "$head_" >/dev/null 2>&1
then
headc_=$(git-rev-parse --verify "$head_^0") || exit
echo "$headc_ $not_for_merge_ $note_" >>"$GIT_DIR/FETCH_HEAD"
[ "$verbose" ] && echo >&2 "* committish: $head_"
[ "$verbose" ] && echo >&2 " $note_"
else
echo "$head_ not-for-merge $note_" >>"$GIT_DIR/FETCH_HEAD"
[ "$verbose" ] && echo >&2 "* non-commit: $head_"
[ "$verbose" ] && echo >&2 " $note_"
fi
if test "$local_name_" != ""
then
# We are storing the head locally. Make sure that it is
# a fast forward (aka "reverse push").
fast_forward_local "$local_name_" "$head_" "$note_"
fi
}
fast_forward_local () {
mkdir -p "$(dirname "$GIT_DIR/$1")"
case "$1" in
refs/tags/*)
# Tags need not be pointing at commits so there
# is no way to guarantee "fast-forward" anyway.
if test -f "$GIT_DIR/$1"
then
if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
then
[ "$verbose" ] && echo >&2 "* $1: same as $3"
else
echo >&2 "* $1: updating with $3"
fi
else
echo >&2 "* $1: storing $3"
fi
git-update-ref "$1" "$2"
;;
refs/heads/*)
# $1 is the ref being updated.
# $2 is the new value for the ref.
local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
if test "$local"
then
# Require fast-forward.
mb=$(git-merge-base "$local" "$2") &&
case "$2,$mb" in
$local,*)
echo >&2 "* $1: same as $3"
;;
*,$local)
echo >&2 "* $1: fast forward to $3"
git-update-ref "$1" "$2" "$local"
;;
*)
false
;;
esac || {
echo >&2 "* $1: does not fast forward to $3;"
case ",$force,$single_force," in
*,t,*)
echo >&2 " forcing update."
git-update-ref "$1" "$2" "$local"
;;
*)
echo >&2 " not updating."
;;
esac
}
else
echo >&2 "* $1: storing $3"
git-update-ref "$1" "$2"
fi
;;
esac
}
case "$update_head_ok" in
'')
orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
;;
esac
# If --tags (and later --heads or --all) is specified, then we are
# not talking about defaults stored in Pull: line of remotes or
# branches file, and just fetch those and refspecs explicitly given.
# Otherwise we do what we always did.
reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags"
then
taglist=$(IFS=" " &&
git-ls-remote $upload_pack --tags "$remote" |
while read sha1 name
do
case "$name" in
(*^*) continue ;;
esac
if git-check-ref-format "$name"
then
echo ".${name}:${name}"
else
echo >&2 "warning: tag ${name} ignored"
fi
done)
if test "$#" -gt 1
then
# remote URL plus explicit refspecs; we need to merge them.
reflist="$reflist$LF$taglist"
else
# No explicit refspecs; fetch tags only.
reflist=$taglist
fi
fi
fetch_main () {
reflist="$1"
refs=
for ref in $reflist
do
refs="$refs$LF$ref"
# These are relative path from $GIT_DIR, typically starting at refs/
# but may be HEAD
if expr "$ref" : '\.' >/dev/null
then
not_for_merge=t
ref=$(expr "$ref" : '\.\(.*\)')
else
not_for_merge=
fi
if expr "$ref" : '\+' >/dev/null
then
single_force=t
ref=$(expr "$ref" : '\+\(.*\)')
else
single_force=
fi
remote_name=$(expr "$ref" : '\([^:]*\):')
local_name=$(expr "$ref" : '[^:]*:\(.*\)')
rref="$rref$LF$remote_name"
# There are transports that can fetch only one head at a time...
case "$remote" in
http://* | https://*)
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k"
fi
remote_name_quoted=$(perl -e '
my $u = $ARGV[0];
$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
print "$u";
' "$remote_name")
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
expr "$head" : "$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
echo >&2 Fetching "$remote_name from $remote" using http
git-http-fetch -v -a "$head" "$remote/" || exit
;;
rsync://*)
TMP_HEAD="$GIT_DIR/TMP_HEAD"
rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1
head=$(git-rev-parse --verify TMP_HEAD)
rm -f "$TMP_HEAD"
test "$rsync_slurped_objects" || {
rsync -av --ignore-existing --exclude info \
"$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit
# Look at objects/info/alternates for rsync -- http will
# support it natively and git native ones will do it on
# the remote end. Not having that file is not a crime.
rsync -q "$remote/objects/info/alternates" \
"$GIT_DIR/TMP_ALT" 2>/dev/null ||
rm -f "$GIT_DIR/TMP_ALT"
if test -f "$GIT_DIR/TMP_ALT"
then
resolve_alternates "$remote" <"$GIT_DIR/TMP_ALT" |
while read alt
do
case "$alt" in 'bad alternate: '*) die "$alt";; esac
echo >&2 "Getting alternate: $alt"
rsync -av --ignore-existing --exclude info \
"$alt" "$GIT_OBJECT_DIRECTORY/" || exit
done
rm -f "$GIT_DIR/TMP_ALT"
fi
rsync_slurped_objects=t
}
;;
*)
# We will do git native transport with just one call later.
continue ;;
esac
append_fetch_head "$head" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
case "$remote" in
http://* | https://* | rsync://* )
;; # we are already done.
*)
( : subshell because we muck with IFS
IFS=" $LF"
(
git-fetch-pack $exec $keep --thin "$remote" $rref || echo failed "$remote"
) |
while read sha1 remote_name
do
case "$sha1" in
failed)
echo >&2 "Fetch failure: $remote"
exit 1 ;;
esac
found=
single_force=
for ref in $refs
do
case "$ref" in
+$remote_name:*)
single_force=t
not_for_merge=
found="$ref"
break ;;
.+$remote_name:*)
single_force=t
not_for_merge=t
found="$ref"
break ;;
.$remote_name:*)
not_for_merge=t
found="$ref"
break ;;
$remote_name:*)
not_for_merge=
found="$ref"
break ;;
esac
done
local_name=$(expr "$found" : '[^:]*:\(.*\)')
append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done
) || exit ;;
esac
}
fetch_main "$reflist"
# automated tag following
case "$no_tags$tags" in
'')
case "$reflist" in
*:refs/*)
# effective only when we are following remote branch
# using local tracking branch.
taglist=$(IFS=" " &&
git-ls-remote $upload_pack --tags "$remote" |
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
while read sha1 name
do
test -f "$GIT_DIR/$name" && continue
git-check-ref-format "$name" || {
echo >&2 "warning: tag ${name} ignored"
continue
}
git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
echo >&2 "Auto-following $name"
echo ".${name}:${name}"
done)
esac
case "$taglist" in
'') ;;
?*)
fetch_main "$taglist" ;;
esac
esac
# If the original head was empty (i.e. no "master" yet), or
# if we were told not to worry, we do not have to check.
case ",$update_head_ok,$orig_head," in
*,, | t,* )
;;
*)
curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
if test "$curr_head" != "$orig_head"
then
git-update-ref HEAD "$orig_head"
die "Cannot fetch into the current branch."
fi
;;
esac
^ permalink raw reply
* [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics
From: Linus Torvalds @ 2006-04-02 20:31 UTC (permalink / raw)
To: Jason Riedy, Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0604021312510.3050@g5.osdl.org>
This is the "letter of the law" version of using fgets() properly in the
face of incredibly broken stdio implementations. We can work around the
Solaris breakage with SA_RESTART, but in case anybody else is ever that
stupid, here's the "safe" (read: "insanely anal") way to use fgets.
It probably goes without saying that I'm not terribly impressed by
Solaris libc.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
This is the same one that I already sent out, but re-diffed, and with a
proper commit message.
Not tested on Solaris.
Junio - I think that I forgot to Cc: you on the 1/2 patch, but you'll see
it on the git list.
diff --git a/pack-objects.c b/pack-objects.c
index 1817b58..0ea16ad 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1110,8 +1110,18 @@ int main(int argc, char **argv)
setup_progress_signal();
}
- while (fgets(line, sizeof(line), stdin) != NULL) {
+ for (;;) {
unsigned char sha1[20];
+
+ if (!fgets(line, sizeof(line), stdin)) {
+ if (feof(stdin))
+ break;
+ if (!ferror(stdin))
+ die("fgets returned NULL, not EOF, not error!");
+ if (errno == EINTR)
+ continue;
+ die("fgets: %s", strerror(errno));
+ }
if (line[0] == '-') {
if (get_sha1_hex(line+1, sha1))
^ permalink raw reply related
* Re: Solaris cloning woes partly diagnosed
From: Linus Torvalds @ 2006-04-02 20:28 UTC (permalink / raw)
To: Jason Riedy; +Cc: git
In-Reply-To: <824.1144007555@lotus.CS.Berkeley.EDU>
On Sun, 2 Apr 2006, Jason Riedy wrote:
>
> Solaris folks will say you should be using sigaction with
> SA_RESTART. IIRC, SA_RESTART isn't guaranteed to be there
> or work, but all the systems I deal with right now have it.
I think we might as well do that _too_.
However, once you use "sigaction()", you don't need to re-arm the signal
handler any more, so I'd suggest a simpler patch like this instead..
Junio, I think this confirms/explains the Solaris breakage.
I'll re-send the "anal stdio semantics" version of the patch on top of
this in the next email.
Linus
----
Subject: Fix Solaris stdio signal handling stupidities
This uses sigaction() to install the SIGALRM handler with SA_RESTART, so
that Solaris stdio doesn't break completely when a signal interrupts a
read.
Thanks to Jason Riedy for confirming the silly Solaris signal behaviour.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
----
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..1817b58 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -58,7 +58,7 @@ static int nr_objects = 0, nr_alloc = 0,
static const char *base_name;
static unsigned char pack_file_sha1[20];
static int progress = 1;
-static volatile int progress_update = 0;
+static volatile sig_atomic_t progress_update = 0;
/*
* The object names in objects array are hashed with this hashtable,
@@ -879,7 +879,6 @@ static int try_delta(struct unpacked *cu
static void progress_interval(int signum)
{
- signal(SIGALRM, progress_interval);
progress_update = 1;
}
@@ -1025,6 +1024,23 @@ static int reuse_cached_pack(unsigned ch
return 1;
}
+static void setup_progress_signal(void)
+{
+ struct sigaction sa;
+ struct itimerval v;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = progress_interval;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART;
+ sigaction(SIGALRM, &sa, NULL);
+
+ v.it_interval.tv_sec = 1;
+ v.it_interval.tv_usec = 0;
+ v.it_value = v.it_interval;
+ setitimer(ITIMER_REAL, &v, NULL);
+}
+
int main(int argc, char **argv)
{
SHA_CTX ctx;
@@ -1090,13 +1106,8 @@ int main(int argc, char **argv)
prepare_packed_git();
if (progress) {
- struct itimerval v;
- v.it_interval.tv_sec = 1;
- v.it_interval.tv_usec = 0;
- v.it_value = v.it_interval;
- signal(SIGALRM, progress_interval);
- setitimer(ITIMER_REAL, &v, NULL);
fprintf(stderr, "Generating pack...\n");
+ setup_progress_signal();
}
while (fgets(line, sizeof(line), stdin) != NULL) {
^ permalink raw reply related
* Re: Solaris cloning woes partly diagnosed
From: Jason Riedy @ 2006-04-02 19:52 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.64.0604021159110.3050@g5.osdl.org>
And Linus Torvalds writes:
-
- so it really really looks like fgets() would have problems with a SIGALRM
- coming in and doesn't just re-try on EINTR. Can Solaris stdio _really_ be
- that broken? (Yeah, yeah, it may be "conforming". It's also so incredibly
- programmer-unfriendly that it's not even funny)
Yes, it is that broken. I haven't encountered the problem
consistently in git myself, so I can't tell you if the patch
works. Google finds similar reports and patches for BOINC, ruby,
and a few other projects.
Solaris folks will say you should be using sigaction with
SA_RESTART. IIRC, SA_RESTART isn't guaranteed to be there
or work, but all the systems I deal with right now have it.
So an alternate patch for this one use is appended... Other
uses of signal could be changed to sigaction, too. And
progress_update "should" be sig_atomic_t.
Passes the pack-objects tests, but I can't make the problem
happen on demand. (I have seen it occur before, but never
during make test, and I'd not tracked it down...)
Jason
----
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..1faa0bb 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -877,10 +877,21 @@ static int try_delta(struct unpacked *cu
return 0;
}
-static void progress_interval(int signum)
+static void progress_interval(int);
+
+static void setup_progress_signal(void)
+{
+ struct sigaction sa;
+ sa.sa_handler = progress_interval;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART;
+ sigaction(SIGALRM, &sa, NULL);
+}
+
+void progress_interval(int signum)
{
- signal(SIGALRM, progress_interval);
progress_update = 1;
+ setup_progress_signal();
}
static void find_deltas(struct object_entry **list, int window, int depth)
@@ -1094,7 +1105,7 @@ int main(int argc, char **argv)
v.it_interval.tv_sec = 1;
v.it_interval.tv_usec = 0;
v.it_value = v.it_interval;
- signal(SIGALRM, progress_interval);
+ setup_progress_signal();
setitimer(ITIMER_REAL, &v, NULL);
fprintf(stderr, "Generating pack...\n");
}
^ permalink raw reply related
* Re: parsecvs tool now creates git repositories
From: Jan-Benedict Glaw @ 2006-04-02 19:31 UTC (permalink / raw)
To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <20060402093906.GH1259@lug-owl.de>
[-- Attachment #1: Type: text/plain, Size: 2751 bytes --]
On Sun, 2006-04-02 11:39:06 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> On Sat, 2006-04-01 21:36:28 -0800, Keith Packard <keithp@keithp.com> wrote:
> > The UI is a total disaster, sufficient for testing. You must create an
> > Authors file in the current directory which looks like the git-cvsimport
> > authors file. You must also have a edit-change-log program in your path
> > which edits the commit message in place. /bin/true will work if you
> > don't need to edit the messages.
>
> Well, at least this sounds quite promising. I'll give it a run once
> I've arrived back home on the Binutils repository.
Doesn't build for me:
jbglaw@bixie:~/vax/gittish/parsecvs$ make clean
rm -f gram.o lex.o parsecvs.o cvsutil.o revlist.o atom.o revcvs.o git.o y.tab.h gram.c parsecvs
jbglaw@bixie:~/vax/gittish/parsecvs$ make
yacc -d gram.y
mv -f y.tab.c gram.c
cc -O0 -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -c -o gram.o gram.c
cc -O0 -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -c -o lex.o lex.c
lex.l: In function ‘yylex’:
lex.l:69: warning: implicit declaration of function ‘yyget_lineno’
lex.l:69: warning: nested extern declaration of ‘yyget_lineno’
<stdout>: At top level:
<stdout>:1747: warning: no previous prototype for ‘yyget_lineno’
<stdout>:1756: warning: no previous prototype for ‘yyget_in’
<stdout>:1764: warning: no previous prototype for ‘yyget_out’
<stdout>:1772: warning: no previous prototype for ‘yyget_leng’
<stdout>:1781: warning: no previous prototype for ‘yyget_text’
<stdout>:1790: warning: no previous prototype for ‘yyset_lineno’
<stdout>:1802: warning: no previous prototype for ‘yyset_in’
<stdout>:1807: warning: no previous prototype for ‘yyset_out’
<stdout>:1812: warning: no previous prototype for ‘yyget_debug’
<stdout>:1817: warning: no previous prototype for ‘yyset_debug’
<stdout>:1823: warning: no previous prototype for ‘yylex_destroy’
lex.l: In function ‘parse_data’:
lex.l:90: error: ‘yytext_ptr’ undeclared (first use in this function)
lex.l:90: error: (Each undeclared identifier is reported only once
lex.l:90: error: for each function it appears in.)
make: *** [lex.o] Error 1
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Solaris cloning woes partly diagnosed
From: Linus Torvalds @ 2006-04-02 19:22 UTC (permalink / raw)
To: Jason Riedy; +Cc: git
In-Reply-To: <29336.1144005022@lotus.CS.Berkeley.EDU>
On Sun, 2 Apr 2006, Jason Riedy wrote:
> And Linus Torvalds writes:
> -
> - I'd be willing to bet that it's the fact that we take signals.
>
> Unfortunately, I'm too busy to check into this, but I've
> run into similar problems in the past. Just takes a busy
> file server.
>
> - We do, for example, expect that regular file writing not do that. At least
> - "write_sha1_from_fd()" will just do a "write()" without testing the error
> - return, [...]
>
> There is an xwrite in git-compat-util.h...
Well, git itself is actually fairly good about these things. Right now I'm
seriously suspecting Solaris stdio as being just horribly impolite.
git tends to not just use xwrite() in most places, but check the return
value for partial sizes etc. I tried to grep for places where we were
lazy, and there really seems to be just a very small handful, and they
shouldn't impact this case at all (you have to have a seriously broken
setup for them to matter, but we should fix them nonetheless.
Linus
^ permalink raw reply
* Re: Solaris cloning woes partly diagnosed
From: Linus Torvalds @ 2006-04-02 19:18 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604021118210.3050@g5.osdl.org>
On Sun, 2 Apr 2006, Linus Torvalds wrote:
>
> Suddenly, some system calls will either return -1/EINTR, or they'll return
> partial reads or writes.
Hmm. If I read the IRC logs right, the bad pack is still a _valid_ pack,
and passes git-verify-pack with flying colors.
That certainly implies that we had no problems with write-out: not only
must the SHA1 of the resulting file match itself, but it must match the
index too, and the number of objects there must match the index.
So the only way I see the pack being bad (if it does indeed pass
git-verify-pack) is if the object list we generated was bad.
However, "-q" only affects git-pack-file itself, not the generation of the
list. Which would imply that we have trouble _reading_ the list as it
comes in through a pipe. Which is just insane, because we use just a
bog-standard "fgets(... stdin)" for that. And no _way_ can stdio have
problems with a few SIGALRM's, that would break a lot of other problems.
But Oeje1 seems to be saying (in http://pastebin.com/635566):
git rev-list --objects --all | git pack-objects pack
Generating pack...
Done counting 15 objects.
Deltifying 15 objects.
100% (15/15) done
Writing 15 objects.
100% (15/15) done
806439fdfa5e9990b03f9301bd68e243795fff50
where the result _should_ be 16385 objects, not 15.
And the thing is, the _only_ thing we do there is that
while (fgets(line, sizeof(line), stdin) != NULL) {
...
add_object_entry(sha1, name_hash(NULL, line+41), 0);
so it really really looks like fgets() would have problems with a SIGALRM
coming in and doesn't just re-try on EINTR. Can Solaris stdio _really_ be
that broken? (Yeah, yeah, it may be "conforming". It's also so incredibly
programmer-unfriendly that it's not even funny)
That would be truly insane. Can somebody with Solaris check what the
following patch results in...
Linus
----
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..daba5de 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1099,8 +1099,18 @@ int main(int argc, char **argv)
fprintf(stderr, "Generating pack...\n");
}
- while (fgets(line, sizeof(line), stdin) != NULL) {
+ for (;;) {
unsigned char sha1[20];
+
+ if (!fgets(line, sizeof(line), stdin)) {
+ if (feof(stdin))
+ break;
+ if (!ferror(stdin))
+ die("fgets returned NULL, not EOF, not error!");
+ if (errno == EINTR)
+ continue;
+ die("fgets: %s", strerror(errno));
+ }
if (line[0] == '-') {
if (get_sha1_hex(line+1, sha1))
^ permalink raw reply related
* Re: Solaris cloning woes partly diagnosed
From: Jason Riedy @ 2006-04-02 19:10 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.64.0604021118210.3050@g5.osdl.org>
And Linus Torvalds writes:
-
- I'd be willing to bet that it's the fact that we take signals.
Unfortunately, I'm too busy to check into this, but I've
run into similar problems in the past. Just takes a busy
file server.
- We do, for example, expect that regular file writing not do that. At least
- "write_sha1_from_fd()" will just do a "write()" without testing the error
- return, [...]
There is an xwrite in git-compat-util.h...
Jason
^ permalink raw reply
* Re: [PATCH] Provide configurable UI font for gitk
From: Keith Packard @ 2006-04-02 19:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: keithp, git, Paul Mackerras
In-Reply-To: <7vodzkkzxr.fsf@assigned-by-dhcp.cox.net>
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
On Sun, 2006-04-02 at 03:57 -0700, Junio C Hamano wrote:
> Your MUA seems to be line-wrapping the patch here and there...
Sigh. I'll resend it to Paul.
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply
* Re: Solaris cloning woes partly diagnosed
From: Linus Torvalds @ 2006-04-02 18:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy7yol0nk.fsf@assigned-by-dhcp.cox.net>
On Sun, 2 Apr 2006, Junio C Hamano wrote:
>
> We do two funky things when we have progress bar. We play games
> with timer signal (setitimer(ITIMER_REAL) and signal(SIGALRM)),
> and we spit out messages to stderr.
I'd be willing to bet that it's the fact that we take signals.
Suddenly, some system calls will either return -1/EINTR, or they'll return
partial reads or writes.
We should be pretty good at handling that, but maybe some place forgets.
One thing to do might be to make the itimer use a much higher frequency,
to trigger the problem more easily.
We do, for example, expect that regular file writing not do that. At least
"write_sha1_from_fd()" will just do a "write()" without testing the error
return, which is bad (it would silently create a truncated object if the
/tmp filesystem filled up). If somebody has their filesystem over NFS
mounted interruptible, partial writes could also happen.
Ho humm.
Linus
^ permalink raw reply
* git-svn and svn sw --relocate
From: Nicolas Vilz 'niv' @ 2006-04-02 18:04 UTC (permalink / raw)
To: git
ok, guys... next question:
i have now my repository locally and i want to get it remotely on a
server, in order to have a few collaborators...
the steps on the svn-side are clear. But what do i have todo on the
git-svn-side of this life?
does a simple "svn sw --relocate" do the job in the git-svn meta-dir?
Sincerly
Nicolas
^ permalink raw reply
* Re: [RFH] xdiff shows trivially redundant diff.
From: Davide Libenzi @ 2006-04-02 17:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Linus Torvalds
In-Reply-To: <7v4q1cmj7l.fsf@assigned-by-dhcp.cox.net>
On Sun, 2 Apr 2006, Junio C Hamano wrote:
> $ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
>
> shows a change that trivially is redundant, like this:
>
> diff --git a/git-fetch.sh b/git-fetch.sh
> index b4325d9..de4f011 100755
> --- a/git-fetch.sh
> +++ b/git-fetch.sh
> @@ -320,7 +320,7 @@ fetch_main () {
> ( : subshell because we muck with IFS
> IFS=" $LF"
> (
> - git-fetch-pack $exec $keep "$remo...
> + git-fetch-pack $exec $keep --thin...
> ) |
> while read sha1 remote_name
> do
> @@ -367,21 +367,26 @@ fetch_main "$reflist"
>
> # automated tag following
> case "$no_tags$tags" in
> -'')
> - taglist=$(IFS=" " &&
> - git-ls-remote $upload_pack --tags "$remote" |
> ...
> - done)
> +'')
> + case "$reflist" in
> + *:refs/*)
> ...
>
> Notice the first '-' and '+' lines of second hunk are identical?
>
> There is another interesting thing. This is running diff
> between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
> so that the first hunk is not different, then this anomaly
> disappears.
Could you send me the two files that creates the above diff?
- Davide
^ permalink raw reply
* Re: Patch calculus
From: Jakub Narebski @ 2006-04-02 17:03 UTC (permalink / raw)
To: git
In-Reply-To: <e0ou7b$moa$1@sea.gmane.org>
J. Bruce Fields wrote:
> What are the benefits of patch calculus? (What is it? The only
> explanation I've seen is at
> http://abridgegame.org/darcs/manual/node8.html,
> but I don't find it very helpful.)
See also http://www.darcs.net/DarcsWiki/PatchTheory
particularly http://www.darcs.net/DarcsWiki/WhyYouWantPatchTheory
and http://en.wikibooks.org/wiki/Understanding_darcs
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply
* Re: Patch calculus
From: Jakub Narebski @ 2006-04-02 16:30 UTC (permalink / raw)
To: git
In-Reply-To: <20060402161121.GB18864@fieldses.org>
J. Bruce Fields wrote:
> What are the benefits of patch calculus? (What is it? The only
> explanation I've seen is at
> http://abridgegame.org/darcs/manual/node8.html,
> but I don't find it very helpful.)
See also http://www.darcs.net/DarcsWiki/PatchTheory
particularly http://www.darcs.net/DarcsWiki/WhyYouWantPatchTheory
P.S. I'm not a Darcs advocate.
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply
* Re: Default remote branch for local branch
From: Josef Weidendorfer @ 2006-04-02 16:17 UTC (permalink / raw)
To: Pavel Roskin; +Cc: Junio C Hamano, git
In-Reply-To: <1143865123.14465.26.camel@dv>
On Saturday 01 April 2006 06:18, Pavel Roskin wrote:
> On Fri, 2006-03-31 at 19:05 -0800, Junio C Hamano wrote:
> > Maybe you would want something like this.
> >
> > In $GIT_DIR/config:
> >
> > [pull]
> > origin = linus for master
> > origin = irq-pio of libata for ata-irq-pio
> > origin = pata-drivers of libata for ata-pata
Let me try to understand this: the general idea is that
pull.origin = [<refspec> of] <remote> for <branch>
specifies the default action of git-pull if we are on <branch>, ie.
a "git pull" then runs "git pull <remote> [<refspec>]".
So the example above, if .git/remotes/linus would contain two
refspecs, and you are on the branch of the 2nd refspec, it would
do the wrong thing: merge the 1st refspec with current branch.
So I think this is not useful, and if we use above syntax, we
should make the refspec mandatory.
However. I think a syntax mentioning only 2 local branches is better:
pull.origin = <local upstream for branch> for <branch>
Perhaps I have misunderstood the proposal?
> First of all, using "origin" on every line carries to little
> information.
"origin" is part of the case-insensitive alphanum key, which is the same
for all config values in Junio's proposal. Especially, you can
not use it for head names. So this is fine.
Perhaps we could make a shorther alternative form for the above where
the key part has not to be specified on every line with a rule like
if the line does not match /^\S+="/, the full line is the value
Then, above could be written as
[pull.origin]
linus for master
irq-pio of libata for ata-irq-pio
pata-drivers of libata for ata-pata
However, that's only syntactical sugar.
> Secondly, I think the relationship should be between a local development
> branch and a local tracking branch.
Agree.
It is also useful to specify this relation if the upstream is purely a
local branch, e.g. when branching off a local branch, and you want to
pull in changes from the local upstream.
This works automatically if git-pull only does upstream fetching if
there is a remote branch associated. The default action of git-fetch
similar could be "fetch the upstream branch, if that tracks a remote
branch", using the same configuration.
> After all, all remote data is
> placed on a local tracking branch first. It's better not to jump over
> layers of abstraction. Suppose I want to update "masterB". I tell git
> to sync "originB" first. git already has rules what to do if it should
> sync "originB". Let's not supersede those rules.
Junio's proposal has the advantage that you do not have to search in all
files in .git/remotes (and even .git/branches) for the remote branch that
maps to a given local branch.
But that is not the big issue.
> I would write the config like this:
>
> [branch-upstream]
> master = linus
> ata-irq-pio = irq-pio
> ata-pata = pata-drivers
That is not working, as said above. But with above syntax extension,
with s/=/for/ it would be fine.
It would be nice to also support the topic branches, ie. to be able
to specify all topic branches for a branch, and make "git-pull" default
to an octopus merge of the topic branches.
However, "git-pull" can not distinguish between "merge upstream" and
"merge topic branches". Yet, specifying multiple default branches should
be possible.
> > While we are on the topic, it _might_ be worthwhile to think
> > about revamping the syntax of $GIT_DIR/remotes file, maybe even
> > breaking backward compatibility. The Pull: lines can be
> > independently specified which gives flexibility, but I suspect
> > local tracking branches from the same remote tend to live in the
> > same place; IOW, you would probably not do something like:
> >
> > URL: git://git.kernel.org/.../jgarzik/libata-dev.git
> > Pull: refs/heads/irq-pio:refs/remotes/libata/irq-pio
> > Pull: refs/heads/pata-drivers:refs/heads/pata-drivers
> >
> > in practice.
What is the idea instead?
I think the current syntax is fine, as it is very flexible.
The reasoning about tracking remote branches in the same place
is a porcelain issue to be set up by git-clone.
Perhaps you are missing a remotes editor command?
Josef
>
> Sorry, I don't understand this part.
^ permalink raw reply
* Re: Multi-headed branches (hydra? :)) for basic patch calculus
From: J. Bruce Fields @ 2006-04-02 16:11 UTC (permalink / raw)
To: Sam Vilain; +Cc: git
In-Reply-To: <1143950852.21233.23.camel@localhost.localdomain>
On Sun, Apr 02, 2006 at 04:07:32PM +1200, Sam Vilain wrote:
> To represent this in git you could just roll back the head merge commit,
> push commit 5 on that branch, then make a new head:
>
> 1 -> 3 -> 5 \
> >- head
> 2 -> 4 -----/
>
> However, if there was support for "hydra", or heads that are multiple
> commit IDs (and necessarily, no blobs in corresponding paths in their
> trees that are not identical), then you would not need to destroy and
> recreate this dummy merge head commit to model your patch history in
> this manner.
What's the advantage to doing this?
> If the plumbing or a porcelain could be smart enough to automatically
> create hydra when patches are not dependent, then many of the benefits
> of patch calculus might come for free, without having to create these
> complicated sounding entities manually.
What are the benefits of patch calculus? (What is it? The only
explanation I've seen is at
http://abridgegame.org/darcs/manual/node8.html, but I don't find it very
helpful.)
--b.
^ permalink raw reply
* Re: [PATCH] Use _type constants instead of literal constants
From: Jakub Narebski @ 2006-04-02 13:41 UTC (permalink / raw)
To: git
In-Reply-To: <20060402130051.GA2933@ebar091.ebar.dtu.dk>
Peter Eriksen wrote:
> From: Peter Eriksen <s022018@student.dtu.dk>
> Date: Sun Apr 2 14:44:09 2006 +0200
> Subject: [PATCH] Use blob_, commit_, tag_, and tree_type throughout.
>
> This replaces occurences of "blob", "commit", "tag", and "tree",
> where they're really used as type specifiers, which we already
> have defined global constants for.
Shouldn't the name of constant rather be e.g. instead of blob_type be
type_blob, and similarly for the rest of type constants?
--
Jakub Narebski
Warsaw, Poland
^ permalink raw reply
* [PATCH] Use _type constants instead of litteral constants
From: Peter Eriksen @ 2006-04-02 13:00 UTC (permalink / raw)
To: git
From: Peter Eriksen <s022018@student.dtu.dk>
Date: Sun Apr 2 14:44:09 2006 +0200
Subject: [PATCH] Use blob_, commit_, tag_, and tree_type throughout.
This replaces occurences of "blob", "commit", "tag", and "tree",
where they're really used as type specifiers, which we already
have defined global constants for.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---
I have no idea if something like this is wanted. It does touch
a lot of core files, and probably will give merge conflicts
all over the place. It was good fun and practice for me, though.
Regards,
Peter
apply.c | 5 +++--
blame.c | 2 +-
cat-file.c | 6 ++++--
combine-diff.c | 3 ++-
commit-tree.c | 8 +++++---
convert-objects.c | 15 +++++++++------
diff-tree.c | 2 +-
entry.c | 3 ++-
hash-object.c | 3 ++-
index-pack.c | 14 +++++++++-----
ls-tree.c | 4 ++--
mktag.c | 3 ++-
mktree.c | 3 ++-
object.c | 8 ++++----
pack-objects.c | 16 ++++++++++------
revision.c | 2 +-
sha1_file.c | 42 +++++++++++++++++++++++-------------------
tar-tree.c | 2 +-
tree-diff.c | 7 ++++---
tree-walk.c | 3 ++-
unpack-file.c | 3 ++-
unpack-objects.c | 14 +++++++++-----
write-tree.c | 3 ++-
23 files changed, 102 insertions(+), 69 deletions(-)
fad7c58e5e1bc105b7a39ff9ceb19eb7c4927c28
diff --git a/apply.c b/apply.c
index c50b3a6..cc3f12e 100644
--- a/apply.c
+++ b/apply.c
@@ -9,6 +9,7 @@
#include <fnmatch.h>
#include "cache.h"
#include "quote.h"
+#include "blob.h"
// --check turns on checking that the working tree matches the
// files that are being modified, but doesn't apply the patch
@@ -1296,7 +1297,7 @@ static int apply_fragments(struct buffer
* applies to.
*/
write_sha1_file_prepare(desc->buffer, desc->size,
- "blob", sha1, hdr, &hdrlen);
+ blob_type, sha1, hdr, &hdrlen);
if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix))
return error("the patch applies to '%s' (%s), "
"which does not match the "
@@ -1659,7 +1660,7 @@ static void add_index_file(const char *p
if (lstat(path, &st) < 0)
die("unable to stat newly created file %s", path);
fill_stat_cache_info(ce, &st);
- if (write_sha1_file(buf, size, "blob", ce->sha1) < 0)
+ if (write_sha1_file(buf, size, blob_type, ce->sha1) < 0)
die("unable to create backing store for newly created file %s", path);
if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD) < 0)
die("unable to add cache entry for %s", path);
diff --git a/blame.c b/blame.c
index 396defc..98f9992 100644
--- a/blame.c
+++ b/blame.c
@@ -229,7 +229,7 @@ static void get_blob(struct commit *comm
info->buf = read_sha1_file(info->sha1, type, &info->size);
- assert(!strcmp(type, "blob"));
+ assert(!strcmp(type, blob_type));
}
/* For debugging only */
diff --git a/cat-file.c b/cat-file.c
index 761111e..628f6ca 100644
--- a/cat-file.c
+++ b/cat-file.c
@@ -5,6 +5,8 @@
*/
#include "cache.h"
#include "exec_cmd.h"
+#include "tag.h"
+#include "tree.h"
static void flush_buffer(const char *buf, unsigned long size)
{
@@ -136,13 +138,13 @@ int main(int argc, char **argv)
die("Not a valid object name %s", argv[2]);
/* custom pretty-print here */
- if (!strcmp(type, "tree"))
+ if (!strcmp(type, tree_type))
return execl_git_cmd("ls-tree", argv[2], NULL);
buf = read_sha1_file(sha1, type, &size);
if (!buf)
die("Cannot read object %s", argv[2]);
- if (!strcmp(type, "tag"))
+ if (!strcmp(type, tag_type))
return pprint_tag(sha1, buf, size);
/* otherwise just spit out the data */
diff --git a/combine-diff.c b/combine-diff.c
index f17aab3..7693884 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "commit.h"
+#include "blob.h"
#include "diff.h"
#include "diffcore.h"
#include "quote.h"
@@ -104,7 +105,7 @@ static char *grab_blob(const unsigned ch
return xcalloc(1, 1);
}
blob = read_sha1_file(sha1, type, size);
- if (strcmp(type, "blob"))
+ if (strcmp(type, blob_type))
die("object '%s' is not a blob!", sha1_to_hex(sha1));
return blob;
}
diff --git a/commit-tree.c b/commit-tree.c
index 16c1787..2d86518 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -4,6 +4,8 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
+#include "commit.h"
+#include "tree.h"
#define BLOCKING (1ul << 14)
@@ -93,13 +95,13 @@ int main(int argc, char **argv)
if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
usage(commit_tree_usage);
- check_valid(tree_sha1, "tree");
+ check_valid(tree_sha1, tree_type);
for (i = 2; i < argc; i += 2) {
char *a, *b;
a = argv[i]; b = argv[i+1];
if (!b || strcmp(a, "-p") || get_sha1(b, parent_sha1[parents]))
usage(commit_tree_usage);
- check_valid(parent_sha1[parents], "commit");
+ check_valid(parent_sha1[parents], commit_type);
if (new_parent(parents))
parents++;
}
@@ -125,7 +127,7 @@ int main(int argc, char **argv)
while (fgets(comment, sizeof(comment), stdin) != NULL)
add_buffer(&buffer, &size, "%s", comment);
- if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
+ if (!write_sha1_file(buffer, size, commit_type, commit_sha1)) {
printf("%s\n", sha1_to_hex(commit_sha1));
return 0;
}
diff --git a/convert-objects.c b/convert-objects.c
index b49bce2..2476577 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -2,6 +2,9 @@ #define _XOPEN_SOURCE 500 /* glibc2 and
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
#include <time.h>
#include "cache.h"
+#include "blob.h"
+#include "commit.h"
+#include "tree.h"
struct entry {
unsigned char old_sha1[20];
@@ -122,7 +125,7 @@ static int write_subdirectory(void *buff
buffer += len;
}
- write_sha1_file(new, newlen, "tree", result_sha1);
+ write_sha1_file(new, newlen, tree_type, result_sha1);
free(new);
return used;
}
@@ -262,7 +265,7 @@ static void convert_date(void *buffer, u
memcpy(new + newlen, buffer, size);
newlen += size;
- write_sha1_file(new, newlen, "commit", result_sha1);
+ write_sha1_file(new, newlen, commit_type, result_sha1);
free(new);
}
@@ -298,11 +301,11 @@ static struct entry * convert_entry(unsi
buffer = xmalloc(size);
memcpy(buffer, data, size);
- if (!strcmp(type, "blob")) {
- write_sha1_file(buffer, size, "blob", entry->new_sha1);
- } else if (!strcmp(type, "tree"))
+ if (!strcmp(type, blob_type)) {
+ write_sha1_file(buffer, size, blob_type, entry->new_sha1);
+ } else if (!strcmp(type, tree_type))
convert_tree(buffer, size, entry->new_sha1);
- else if (!strcmp(type, "commit"))
+ else if (!strcmp(type, commit_type))
convert_commit(buffer, size, entry->new_sha1);
else
die("unknown object type '%s' in %s", type, sha1_to_hex(sha1));
diff --git a/diff-tree.c b/diff-tree.c
index f55a35a..d1265d7 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -52,7 +52,7 @@ static int diff_root_tree(const unsigned
void *tree;
struct tree_desc empty, real;
- tree = read_object_with_reference(new, "tree", &real.size, NULL);
+ tree = read_object_with_reference(new, tree_type, &real.size, NULL);
if (!tree)
die("unable to read root tree (%s)", sha1_to_hex(new));
real.buf = tree;
diff --git a/entry.c b/entry.c
index 5d9aefd..793724f 100644
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,7 @@
#include <sys/types.h>
#include <dirent.h>
#include "cache.h"
+#include "blob.h"
static void create_directories(const char *path, struct checkout *state)
{
@@ -72,7 +73,7 @@ static int write_entry(struct cache_entr
char type[20];
new = read_sha1_file(ce->sha1, type, &size);
- if (!new || strcmp(type, "blob")) {
+ if (!new || strcmp(type, blob_type)) {
if (new)
free(new);
return error("git-checkout-index: unable to read sha1 file of %s (%s)",
diff --git a/hash-object.c b/hash-object.c
index 6502b5b..87e1277 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -5,6 +5,7 @@
* Copyright (C) Junio C Hamano, 2005
*/
#include "cache.h"
+#include "blob.h"
static void hash_object(const char *path, const char *type, int write_object)
{
@@ -35,7 +36,7 @@ static const char hash_object_usage[] =
int main(int argc, char **argv)
{
int i;
- const char *type = "blob";
+ const char *type = blob_type;
int write_object = 0;
const char *prefix = NULL;
int prefix_length = -1;
diff --git a/index-pack.c b/index-pack.c
index babe34b..b39953d 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -2,7 +2,11 @@ #include "cache.h"
#include "delta.h"
#include "pack.h"
#include "csum-file.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
static const char index_pack_usage[] =
"git-index-pack [-o index-file] pack-file";
@@ -224,10 +228,10 @@ static void sha1_object(const void *data
const char *type_str;
switch (type) {
- case OBJ_COMMIT: type_str = "commit"; break;
- case OBJ_TREE: type_str = "tree"; break;
- case OBJ_BLOB: type_str = "blob"; break;
- case OBJ_TAG: type_str = "tag"; break;
+ case OBJ_COMMIT: type_str = commit_type; break;
+ case OBJ_TREE: type_str = tree_type; break;
+ case OBJ_BLOB: type_str = blob_type; break;
+ case OBJ_TAG: type_str = tag_type; break;
default:
die("bad type %d", type);
}
diff --git a/ls-tree.c b/ls-tree.c
index 26258c3..e4ef200 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -56,7 +56,7 @@ static int show_tree(unsigned char *sha1
const char *pathname, unsigned mode, int stage)
{
int retval = 0;
- const char *type = "blob";
+ const char *type = blob_type;
if (S_ISDIR(mode)) {
if (show_recursive(base, baselen, pathname)) {
@@ -64,7 +64,7 @@ static int show_tree(unsigned char *sha1
if (!(ls_options & LS_SHOW_TREES))
return retval;
}
- type = "tree";
+ type = tree_type;
}
else if (ls_options & LS_TREE_ONLY)
return 0;
diff --git a/mktag.c b/mktag.c
index fc6a9bf..2328878 100644
--- a/mktag.c
+++ b/mktag.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "tag.h"
/*
* A signature file has a very simple fixed format: three lines
@@ -126,7 +127,7 @@ int main(int argc, char **argv)
if (verify_tag(buffer, size) < 0)
die("invalid tag signature file");
- if (write_sha1_file(buffer, size, "tag", result_sha1) < 0)
+ if (write_sha1_file(buffer, size, tag_type, result_sha1) < 0)
die("unable to write tag file");
printf("%s\n", sha1_to_hex(result_sha1));
return 0;
diff --git a/mktree.c b/mktree.c
index f853585..ab63cd9 100644
--- a/mktree.c
+++ b/mktree.c
@@ -6,6 +6,7 @@
#include "cache.h"
#include "strbuf.h"
#include "quote.h"
+#include "tree.h"
static struct treeent {
unsigned mode;
@@ -67,7 +68,7 @@ static void write_tree(unsigned char *sh
memcpy(buffer + offset, ent->sha1, 20);
offset += 20;
}
- write_sha1_file(buffer, offset, "tree", sha1);
+ write_sha1_file(buffer, offset, tree_type, sha1);
}
static const char mktree_usage[] = "mktree [-z]";
diff --git a/object.c b/object.c
index c9ca481..b5c0ecf 100644
--- a/object.c
+++ b/object.c
@@ -196,15 +196,15 @@ struct object *parse_object(const unsign
struct object *obj;
if (check_sha1_signature(sha1, buffer, size, type) < 0)
printf("sha1 mismatch %s\n", sha1_to_hex(sha1));
- if (!strcmp(type, "blob")) {
+ if (!strcmp(type, blob_type)) {
struct blob *blob = lookup_blob(sha1);
parse_blob_buffer(blob, buffer, size);
obj = &blob->object;
- } else if (!strcmp(type, "tree")) {
+ } else if (!strcmp(type, tree_type)) {
struct tree *tree = lookup_tree(sha1);
parse_tree_buffer(tree, buffer, size);
obj = &tree->object;
- } else if (!strcmp(type, "commit")) {
+ } else if (!strcmp(type, commit_type)) {
struct commit *commit = lookup_commit(sha1);
parse_commit_buffer(commit, buffer, size);
if (!commit->buffer) {
@@ -212,7 +212,7 @@ struct object *parse_object(const unsign
buffer = NULL;
}
obj = &commit->object;
- } else if (!strcmp(type, "tag")) {
+ } else if (!strcmp(type, tag_type)) {
struct tag *tag = lookup_tag(sha1);
parse_tag_buffer(tag, buffer, size);
obj = &tag->object;
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..4145f25 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1,5 +1,9 @@
#include "cache.h"
#include "object.h"
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
#include "delta.h"
#include "pack.h"
#include "csum-file.h"
@@ -603,7 +607,7 @@ static void add_pbase_tree(struct tree_d
if (!add_object_entry(sha1, hash, 1))
continue;
- if (!strcmp(type, "tree")) {
+ if (!strcmp(type, tree_type)) {
struct tree_desc sub;
void *elem;
struct name_path me;
@@ -626,7 +630,7 @@ static void add_preferred_base(unsigned
struct tree_desc tree;
void *elem;
- elem = read_object_with_reference(sha1, "tree", &tree.size, NULL);
+ elem = read_object_with_reference(sha1, tree_type, &tree.size, NULL);
tree.buf = elem;
if (!tree.buf)
return;
@@ -684,13 +688,13 @@ static void check_object(struct object_e
die("unable to get type of object %s",
sha1_to_hex(entry->sha1));
- if (!strcmp(type, "commit")) {
+ if (!strcmp(type, commit_type)) {
entry->type = OBJ_COMMIT;
- } else if (!strcmp(type, "tree")) {
+ } else if (!strcmp(type, tree_type)) {
entry->type = OBJ_TREE;
- } else if (!strcmp(type, "blob")) {
+ } else if (!strcmp(type, blob_type)) {
entry->type = OBJ_BLOB;
- } else if (!strcmp(type, "tag")) {
+ } else if (!strcmp(type, tag_type)) {
entry->type = OBJ_TAG;
} else
die("unable to pack object %s of type %s",
diff --git a/revision.c b/revision.c
index c2a95aa..902a99f 100644
--- a/revision.c
+++ b/revision.c
@@ -260,7 +260,7 @@ int rev_same_tree_as_empty(struct tree *
if (!t1)
return 0;
- tree = read_object_with_reference(t1->object.sha1, "tree", &real.size, NULL);
+ tree = read_object_with_reference(t1->object.sha1, tree_type, &real.size, NULL);
if (!tree)
return 0;
real.buf = tree;
diff --git a/sha1_file.c b/sha1_file.c
index 58edec0..ba8c4f7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -9,7 +9,11 @@
#include "cache.h"
#include "delta.h"
#include "pack.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
#define O_NOATIME 01000000
@@ -894,16 +898,16 @@ void packed_object_info_detail(struct pa
}
switch (kind) {
case OBJ_COMMIT:
- strcpy(type, "commit");
+ strcpy(type, commit_type);
break;
case OBJ_TREE:
- strcpy(type, "tree");
+ strcpy(type, tree_type);
break;
case OBJ_BLOB:
- strcpy(type, "blob");
+ strcpy(type, blob_type);
break;
case OBJ_TAG:
- strcpy(type, "tag");
+ strcpy(type, tag_type);
break;
default:
die("corrupted pack file %s containing object of kind %d",
@@ -934,16 +938,16 @@ static int packed_object_info(struct pac
unuse_packed_git(p);
return retval;
case OBJ_COMMIT:
- strcpy(type, "commit");
+ strcpy(type, commit_type);
break;
case OBJ_TREE:
- strcpy(type, "tree");
+ strcpy(type, tree_type);
break;
case OBJ_BLOB:
- strcpy(type, "blob");
+ strcpy(type, blob_type);
break;
case OBJ_TAG:
- strcpy(type, "tag");
+ strcpy(type, tag_type);
break;
default:
die("corrupted pack file %s containing object of kind %d",
@@ -1071,16 +1075,16 @@ void *unpack_entry_gently(struct pack_en
retval = unpack_delta_entry(pack, size, left, type, sizep, p);
return retval;
case OBJ_COMMIT:
- strcpy(type, "commit");
+ strcpy(type, commit_type);
break;
case OBJ_TREE:
- strcpy(type, "tree");
+ strcpy(type, tree_type);
break;
case OBJ_BLOB:
- strcpy(type, "blob");
+ strcpy(type, blob_type);
break;
case OBJ_TAG:
- strcpy(type, "tag");
+ strcpy(type, tag_type);
break;
default:
return NULL;
@@ -1241,9 +1245,9 @@ void *read_object_with_reference(const u
return buffer;
}
/* Handle references */
- else if (!strcmp(type, "commit"))
+ else if (!strcmp(type, commit_type))
ref_type = "tree ";
- else if (!strcmp(type, "tag"))
+ else if (!strcmp(type, tag_type))
ref_type = "object ";
else {
free(buffer);
@@ -1625,7 +1629,7 @@ int index_pipe(unsigned char *sha1, int
return -1;
}
if (!type)
- type = "blob";
+ type = blob_type;
if (write_object)
ret = write_sha1_file(buf, off, type, sha1);
else {
@@ -1652,7 +1656,7 @@ int index_fd(unsigned char *sha1, int fd
return -1;
if (!type)
- type = "blob";
+ type = blob_type;
if (write_object)
ret = write_sha1_file(buf, size, type, sha1);
else {
@@ -1690,9 +1694,9 @@ int index_path(unsigned char *sha1, cons
if (!write_object) {
unsigned char hdr[50];
int hdrlen;
- write_sha1_file_prepare(target, st->st_size, "blob",
+ write_sha1_file_prepare(target, st->st_size, blob_type,
sha1, hdr, &hdrlen);
- } else if (write_sha1_file(target, st->st_size, "blob", sha1))
+ } else if (write_sha1_file(target, st->st_size, blob_type, sha1))
return error("%s: failed to insert into database",
path);
free(target);
diff --git a/tar-tree.c b/tar-tree.c
index 705b8fa..87870b6 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -336,7 +336,7 @@ int main(int argc, char **argv)
} else
archive_time = time(NULL);
- tree.buf = read_object_with_reference(sha1, "tree", &tree.size,
+ tree.buf = read_object_with_reference(sha1, tree_type, &tree.size,
tree_sha1);
if (!tree.buf)
die("not a reference to a tag, commit or tree object: %s",
diff --git a/tree-diff.c b/tree-diff.c
index 7bb6109..701fbba 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -3,6 +3,7 @@
*/
#include "cache.h"
#include "diff.h"
+#include "tree.h"
// What paths are we interested in?
static int nr_paths = 0;
@@ -148,7 +149,7 @@ static int show_entry(struct diff_option
void *tree;
tree = read_sha1_file(sha1, type, &inner.size);
- if (!tree || strcmp(type, "tree"))
+ if (!tree || strcmp(type, tree_type))
die("corrupt tree sha %s", sha1_to_hex(sha1));
inner.buf = tree;
@@ -206,10 +207,10 @@ int diff_tree_sha1(const unsigned char *
struct tree_desc t1, t2;
int retval;
- tree1 = read_object_with_reference(old, "tree", &t1.size, NULL);
+ tree1 = read_object_with_reference(old, tree_type, &t1.size, NULL);
if (!tree1)
die("unable to read source tree (%s)", sha1_to_hex(old));
- tree2 = read_object_with_reference(new, "tree", &t2.size, NULL);
+ tree2 = read_object_with_reference(new, tree_type, &t2.size, NULL);
if (!tree2)
die("unable to read destination tree (%s)", sha1_to_hex(new));
t1.buf = tree1;
diff --git a/tree-walk.c b/tree-walk.c
index 0735f40..bf8bfdf 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "tree-walk.h"
+#include "tree.h"
void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1)
{
@@ -7,7 +8,7 @@ void *fill_tree_descriptor(struct tree_d
void *buf = NULL;
if (sha1) {
- buf = read_object_with_reference(sha1, "tree", &size, NULL);
+ buf = read_object_with_reference(sha1, tree_type, &size, NULL);
if (!buf)
die("unable to read tree %s", sha1_to_hex(sha1));
}
diff --git a/unpack-file.c b/unpack-file.c
index 3accb97..23a8562 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "blob.h"
static char *create_temp_file(unsigned char *sha1)
{
@@ -9,7 +10,7 @@ static char *create_temp_file(unsigned c
int fd;
buf = read_sha1_file(sha1, type, &size);
- if (!buf || strcmp(type, "blob"))
+ if (!buf || strcmp(type, blob_type))
die("unable to read blob object %s", sha1_to_hex(sha1));
strcpy(path, ".merge_file_XXXXXX");
diff --git a/unpack-objects.c b/unpack-objects.c
index 815a1b3..3b824b0 100644
--- a/unpack-objects.c
+++ b/unpack-objects.c
@@ -2,7 +2,11 @@ #include "cache.h"
#include "object.h"
#include "delta.h"
#include "pack.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
#include <sys/time.h>
static int dry_run, quiet;
@@ -148,10 +152,10 @@ static int unpack_non_delta_entry(enum o
const char *type;
switch (kind) {
- case OBJ_COMMIT: type = "commit"; break;
- case OBJ_TREE: type = "tree"; break;
- case OBJ_BLOB: type = "blob"; break;
- case OBJ_TAG: type = "tag"; break;
+ case OBJ_COMMIT: type = commit_type; break;
+ case OBJ_TREE: type = tree_type; break;
+ case OBJ_BLOB: type = blob_type; break;
+ case OBJ_TAG: type = tag_type; break;
default: die("bad type %d", kind);
}
if (!dry_run)
diff --git a/write-tree.c b/write-tree.c
index addb5de..dcad6e6 100644
--- a/write-tree.c
+++ b/write-tree.c
@@ -4,6 +4,7 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
+#include "tree.h"
static int missing_ok = 0;
@@ -78,7 +79,7 @@ static int write_tree(struct cache_entry
nr++;
}
- write_sha1_file(buffer, offset, "tree", returnsha1);
+ write_sha1_file(buffer, offset, tree_type, returnsha1);
free(buffer);
return nr;
}
--
1.3.0.rc1.g8eef8e
^ permalink raw reply related
* Re: [Patch] Key help for gitk
From: Alex Riesen @ 2006-04-02 12:18 UTC (permalink / raw)
To: paul; +Cc: paulus, git
In-Reply-To: <cc9bf44d0604011621m1952b17er6f8c7e0fe1595b53@mail.gmail.com>
Paul Schulz, Sun, Apr 02, 2006 02:21:16 +0200:
> +<Ctl-equal> - Incrument font size
> +<Ctl-KP_Add> - Incrument font size
Typo: "IncrEment"
^ permalink raw reply
* Re: [PATCH] Provide configurable UI font for gitk
From: Junio C Hamano @ 2006-04-02 10:57 UTC (permalink / raw)
To: Keith Packard; +Cc: git, Paul Mackerras
In-Reply-To: <1143969814.2303.71.camel@neko.keithp.com>
Keith Packard <keithp@keithp.com> writes:
> This makes the font used in the UI elements of gitk configurable in the
> same way the other fonts are. The default fonts used in the Xft build of
> tk8.5 are particularily horrific, making this change more important
> there.
>
> Signed-off-by: Keith Packard <keithp@neko.keithp.com>
Thanks for the patch. I haven't run it, but a quick eyeballing
suggests what you did is sane. However,..
> proc makewindow {rargs} {
> - global canv canv2 canv3 linespc charspc ctext cflist textfont
> + global canv canv2 canv3 linespc charspc ctext cflist textfont
> mainfont uifont
Your MUA seems to be line-wrapping the patch here and there...
> @@ -345,16 +345,20 @@ proc makewindow {rargs} {
>
> menu .bar
> .bar add cascade -label "File" -menu .bar.file
> + .bar configure -font $uifont
> menu .bar.file
> .bar.file add command -label "Update" -command [list updatecommits
> $rargs]
> .bar.file add command -label "Reread references" -command
> rereadrefs
>...
so the patch does not apply X-<.
Also, I prefer changes to gitk to be fed via Paul Mackerras
tree. If you send changes to gitk to me, I will forward patches
with my Acked-by: to him and wait for him to bounce the change
back to me through his tree, so it is not a big deal for me, and
the changes will _not_ be lost anyway, but I'd still appreciate
gitk patches to be sent to Paul first if possible.
^ permalink raw reply
* Solaris cloning woes partly diagnosed
From: Junio C Hamano @ 2006-04-02 10:41 UTC (permalink / raw)
To: git
This is just an interim report, but people might have heard that
OpenSolaris team are in the process of choosing a free DSCM and
we are one of the candidates. They initially wanted to try
1.2.4 but had trouble using it for local cloning, and the
evaluation is being done with 1.2.2.
I was on #git tonight with Oejet, and managed to reproduce this
problem. The local clone problem seems to disappear if we
disable the progress bar in pack-objects.
We do two funky things when we have progress bar. We play games
with timer signal (setitimer(ITIMER_REAL) and signal(SIGALRM)),
and we spit out messages to stderr.
It's too late tonight for me to continue digging this, but if
somebody with access to a Solaris box is so inclined, I'd really
appreciate help on this one.
^ permalink raw reply
* Re: parsecvs tool now creates git repositories
From: Jan-Benedict Glaw @ 2006-04-02 9:39 UTC (permalink / raw)
To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <1143956188.2303.39.camel@neko.keithp.com>
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
On Sat, 2006-04-01 21:36:28 -0800, Keith Packard <keithp@keithp.com> wrote:
> The UI is a total disaster, sufficient for testing. You must create an
> Authors file in the current directory which looks like the git-cvsimport
> authors file. You must also have a edit-change-log program in your path
> which edits the commit message in place. /bin/true will work if you
> don't need to edit the messages.
Well, at least this sounds quite promising. I'll give it a run once
I've arrived back home on the Binutils repository.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ 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