1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 14:34:49 +01:00
This commit is contained in:
Peter Anvin 2005-09-28 23:20:08 -07:00
commit 0542f48c89
16 changed files with 124 additions and 83 deletions

2
.gitignore vendored
View file

@ -25,6 +25,7 @@ git-diff-stages
git-diff-tree git-diff-tree
git-fetch git-fetch
git-fetch-pack git-fetch-pack
git-fmt-merge-msg
git-format-patch git-format-patch
git-fsck-objects git-fsck-objects
git-get-tar-commit-id git-get-tar-commit-id
@ -86,6 +87,7 @@ git-tar-tree
git-unpack-file git-unpack-file
git-unpack-objects git-unpack-objects
git-update-index git-update-index
git-update-ref
git-update-server-info git-update-server-info
git-upload-pack git-upload-pack
git-var git-var

View file

@ -30,7 +30,7 @@ static void objreport(struct object *obj, const char *severity,
fputs("\n", stderr); fputs("\n", stderr);
} }
int objerror(struct object *obj, const char *err, ...) static int objerror(struct object *obj, const char *err, ...)
{ {
va_list params; va_list params;
va_start(params, err); va_start(params, err);
@ -39,7 +39,7 @@ int objerror(struct object *obj, const char *err, ...)
return -1; return -1;
} }
int objwarning(struct object *obj, const char *err, ...) static int objwarning(struct object *obj, const char *err, ...)
{ {
va_list params; va_list params;
va_start(params, err); va_start(params, err);

View file

@ -108,9 +108,10 @@ fi
tree=$(git-write-tree) || exit 1 tree=$(git-write-tree) || exit 1
echo Wrote tree $tree echo Wrote tree $tree
commit=$(git-commit-tree $tree -p $(cat "$GIT_DIR"/HEAD) < "$final") || exit 1 parent=$(git-rev-parse --verify HEAD) &&
commit=$(git-commit-tree $tree -p $parent <"$final") || exit 1
echo Committed: $commit echo Committed: $commit
echo $commit > "$GIT_DIR"/HEAD git-update-ref HEAD $commit $parent || exit
if test -x "$GIT_DIR"/hooks/post-applypatch if test -x "$GIT_DIR"/hooks/post-applypatch
then then

View file

@ -159,7 +159,9 @@ if [ ! -r "$GIT_DIR/HEAD" ]; then
exit 1 exit 1
fi fi
PARENTS="" PARENTS=""
current=
else else
current=$(git-rev-parse --verify HEAD)
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"` PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
fi fi
@ -220,7 +222,7 @@ if test -s .cmitchk
then then
tree=$(git-write-tree) && tree=$(git-write-tree) &&
commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) && commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&
echo $commit > "$GIT_DIR/HEAD" && git-update-ref HEAD $commit $current &&
rm -f -- "$GIT_DIR/MERGE_HEAD" rm -f -- "$GIT_DIR/MERGE_HEAD"
else else
echo >&2 "* no commit message? aborting commit." echo >&2 "* no commit message? aborting commit."

View file

@ -54,6 +54,10 @@ append_fetch_head () {
remote_name_="$3" remote_name_="$3"
remote_nick_="$4" remote_nick_="$4"
local_name_="$5" 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-nick is the URL given on the command line (or a shorthand)
# remote-name is the $GIT_DIR relative refs/ path we computed # remote-name is the $GIT_DIR relative refs/ path we computed
@ -78,10 +82,11 @@ append_fetch_head () {
if git-cat-file commit "$head_" >/dev/null 2>&1 if git-cat-file commit "$head_" >/dev/null 2>&1
then then
headc_=$(git-rev-parse --verify "$head_^0") || exit headc_=$(git-rev-parse --verify "$head_^0") || exit
echo "$headc_ $note_" >>$GIT_DIR/FETCH_HEAD echo "$headc_ $not_for_merge_ $note_" >>$GIT_DIR/FETCH_HEAD
echo >&2 "* committish: $head_" echo >&2 "* committish: $head_"
echo >&2 " $note_" echo >&2 " $note_"
else else
echo "$head_ not-for-merge $note_" >>$GIT_DIR/FETCH_HEAD
echo >&2 "* non-commit: $head_" echo >&2 "* non-commit: $head_"
echo >&2 " $note_" echo >&2 " $note_"
fi fi
@ -105,14 +110,16 @@ fast_forward_local () {
else else
echo >&2 "* $1: storing $3" echo >&2 "* $1: storing $3"
fi fi
echo "$2" >"$GIT_DIR/$1" ;; git-update-ref "$1" "$2"
;;
refs/heads/*) refs/heads/*)
# NEEDSWORK: use the same cmpxchg protocol here. # $1 is the ref being updated.
echo "$2" >"$GIT_DIR/$1.lock" # $2 is the new value for the ref.
if test -f "$GIT_DIR/$1" local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
if test "$local"
then then
local=$(git-rev-parse --verify "$1^0") && # Require fast-forward.
mb=$(git-merge-base "$local" "$2") && mb=$(git-merge-base "$local" "$2") &&
case "$2,$mb" in case "$2,$mb" in
$local,*) $local,*)
@ -120,34 +127,34 @@ fast_forward_local () {
;; ;;
*,$local) *,$local)
echo >&2 "* $1: fast forward to $3" echo >&2 "* $1: fast forward to $3"
git-update-ref "$1" "$2" "$local"
;; ;;
*) *)
false false
;; ;;
esac || { esac || {
echo >&2 "* $1: does not fast forward to $3;" echo >&2 "* $1: does not fast forward to $3;"
case "$force,$single_force" in case ",$force,$single_force," in
t,* | *,t) *,t,*)
echo >&2 " forcing update." echo >&2 " forcing update."
git-update-ref "$1" "$2" "$local"
;; ;;
*) *)
mv "$GIT_DIR/$1.lock" "$GIT_DIR/$1.remote" echo >&2 " not updating."
echo >&2 " leaving it in '$1.remote'"
;; ;;
esac esac
} }
else else
echo >&2 "* $1: storing $3" echo >&2 "* $1: storing $3"
git-update-ref "$1" "$2"
fi fi
test -f "$GIT_DIR/$1.lock" &&
mv "$GIT_DIR/$1.lock" "$GIT_DIR/$1"
;; ;;
esac esac
} }
case "$update_head_ok" in case "$update_head_ok" in
'') '')
orig_head=$(cat "$GIT_DIR/HEAD" 2>/dev/null) orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
;; ;;
esac esac
@ -157,6 +164,13 @@ do
# These are relative path from $GIT_DIR, typically starting at refs/ # These are relative path from $GIT_DIR, typically starting at refs/
# but may be HEAD # 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 if expr "$ref" : '\+' >/dev/null
then then
single_force=t single_force=t
@ -184,7 +198,7 @@ do
rsync://*) rsync://*)
TMP_HEAD="$GIT_DIR/TMP_HEAD" TMP_HEAD="$GIT_DIR/TMP_HEAD"
rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1 rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1
head=$(git-rev-parse TMP_HEAD) head=$(git-rev-parse --verify TMP_HEAD)
rm -f "$TMP_HEAD" rm -f "$TMP_HEAD"
test "$rsync_slurped_objects" || { test "$rsync_slurped_objects" || {
rsync -av --ignore-existing --exclude info \ rsync -av --ignore-existing --exclude info \
@ -216,7 +230,8 @@ do
continue ;; continue ;;
esac esac
append_fetch_head "$head" "$remote" "$remote_name" "$remote_nick" "$local_name" append_fetch_head "$head" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done done
@ -241,16 +256,27 @@ http://* | https://* | rsync://* )
case "$ref" in case "$ref" in
+$remote_name:*) +$remote_name:*)
single_force=t 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" found="$ref"
break ;; break ;;
$remote_name:*) $remote_name:*)
not_for_merge=
found="$ref" found="$ref"
break ;; break ;;
esac esac
done done
local_name=$(expr "$found" : '[^:]*:\(.*\)') local_name=$(expr "$found" : '[^:]*:\(.*\)')
append_fetch_head "$sha1" "$remote" "$remote_name" "$remote_nick" "$local_name" append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done || exit done || exit
;; ;;
esac esac
@ -261,10 +287,10 @@ case ",$update_head_ok,$orig_head," in
*,, | t,* ) *,, | t,* )
;; ;;
*) *)
curr_head=$(cat "$GIT_DIR/HEAD" 2>/dev/null) curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
if test "$curr_head" != "$orig_head" if test "$curr_head" != "$orig_head"
then then
echo "$orig_head" >$GIT_DIR/HEAD git-update-ref HEAD "$orig_head"
die "Cannot fetch into the current branch." die "Cannot fetch into the current branch."
fi fi
;; ;;

View file

@ -31,6 +31,8 @@ sub andjoin {
my ($bname, $tname, $gname, $src); my ($bname, $tname, $gname, $src);
chomp; chomp;
s/^[0-9a-f]* //; s/^[0-9a-f]* //;
next if (/^not-for-merge/);
s/^ //;
if (s/ of (.*)$//) { if (s/ of (.*)$//) {
$src = $1; $src = $1;
} else { } else {
@ -86,7 +88,7 @@ sub andjoin {
$src{$src}{GENERIC}); $src{$src}{GENERIC});
my $this = join(', ', @this); my $this = join(', ', @this);
if ($src ne '.') { if ($src ne '.') {
$this .= " from $src"; $this .= " of $src";
} }
push @msg, $this; push @msg, $this;
} }

View file

@ -24,7 +24,9 @@ dropsave() {
} }
savestate() { savestate() {
git diff -r -z --name-only $head | cpio -0 -o >"$GIR_DIR/MERGE_SAVE" # Stash away any local modifications.
git-diff-index -r -z --name-only $head |
cpio -0 -o >"$GIR_DIR/MERGE_SAVE"
} }
restorestate() { restorestate() {
@ -114,8 +116,9 @@ case "$#,$common" in
# Again the most common case of merging one remote. # Again the most common case of merging one remote.
echo "Updating from $head to $1." echo "Updating from $head to $1."
git-update-index --refresh 2>/dev/null git-update-index --refresh 2>/dev/null
git-read-tree -u -m $head "$1" || exit 1 git-read-tree -u -m $head "$1" &&
git-rev-parse --verify "$1^0" > "$GIT_DIR/HEAD" new_head=$(git-rev-parse --verify "$1^0") &&
git-update-ref HEAD "$new_head" "$head" || exit 1
summary "$1" summary "$1"
dropsave dropsave
exit 0 exit 0
@ -149,12 +152,7 @@ esac
# we use, it would operate on the index, possibly affecting the # we use, it would operate on the index, possibly affecting the
# working tree, and when resolved cleanly, have the desired tree # working tree, and when resolved cleanly, have the desired tree
# in the index -- this means that the index must be in sync with # in the index -- this means that the index must be in sync with
# the $head commit. # the $head commit. The strategies are responsible to ensure this.
files=$(git-diff-index --cached --name-only $head) || exit
if [ "$files" ]; then
echo >&2 "Dirty index: cannot merge (dirty: $files)"
exit 1
fi
case "$use_strategies" in case "$use_strategies" in
?*' '?*) ?*' '?*)
@ -218,9 +216,9 @@ then
do do
parents="$parents -p $remote" parents="$parents -p $remote"
done done
result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit
echo "Committed merge $result_commit, made by $wt_strategy." echo "Committed merge $result_commit, made by $wt_strategy."
echo $result_commit >"$GIT_DIR/HEAD" git-update-ref HEAD $result_commit $head
summary $result_commit summary $result_commit
dropsave dropsave
exit 0 exit 0

View file

@ -86,5 +86,5 @@ esac
result_commit=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD" | result_commit=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD" |
git-commit-tree $MRT $PARENT) git-commit-tree $MRT $PARENT)
echo "Committed merge $result_commit" echo "Committed merge $result_commit"
echo $result_commit >"$GIT_DIR"/HEAD git-update-ref HEAD $result_commit $head
git-diff-tree -p $head $result_commit | git-apply --stat git-diff-tree -p $head $result_commit | git-apply --stat

View file

@ -65,8 +65,11 @@ get_remote_default_refs_for_push () {
esac esac
} }
# Subroutine to canonicalize remote:local notation # Subroutine to canonicalize remote:local notation.
canon_refs_list_for_fetch () { canon_refs_list_for_fetch () {
# Leave only the first one alone; add prefix . to the rest
# to prevent the secondary branches to be merged by default.
dot_prefix=
for ref for ref
do do
force= force=
@ -91,7 +94,8 @@ canon_refs_list_for_fetch () {
heads/* | tags/* ) local="refs/$local" ;; heads/* | tags/* ) local="refs/$local" ;;
*) local="refs/heads/$local" ;; *) local="refs/heads/$local" ;;
esac esac
echo "${force}${remote}:${local}" echo "${dot_prefix}${force}${remote}:${local}"
dot_prefix=.
done done
} }
@ -107,6 +111,9 @@ get_remote_default_refs_for_fetch () {
echo "refs/heads/${remote_branch}:refs/heads/$1" echo "refs/heads/${remote_branch}:refs/heads/$1"
;; ;;
remotes) remotes)
# This prefixes the second and later default refspecs
# with a '.', to signal git-fetch to mark them
# not-for-merge.
canon_refs_list_for_fetch $(sed -ne '/^Pull: */{ canon_refs_list_for_fetch $(sed -ne '/^Pull: */{
s///p s///p
}' "$GIT_DIR/remotes/$1") }' "$GIT_DIR/remotes/$1")

View file

@ -6,10 +6,10 @@
. git-sh-setup || die "Not a git archive" . git-sh-setup || die "Not a git archive"
orig_head=$(cat "$GIT_DIR/HEAD") || die "Pulling into a black hole?" orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?"
git-fetch --update-head-ok "$@" || exit 1 git-fetch --update-head-ok "$@" || exit 1
curr_head=$(cat "$GIT_DIR/HEAD") curr_head=$(git-rev-parse --verify HEAD)
if test "$curr_head" != "$orig_head" if test "$curr_head" != "$orig_head"
then then
# The fetch involved updating the current branch. # The fetch involved updating the current branch.
@ -24,7 +24,9 @@ then
die "You need to first update your working tree." die "You need to first update your working tree."
fi fi
merge_head=$(sed -e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | tr '\012' ' ') merge_head=$(sed -e '/ not-for-merge /d' \
-e 's/ .*//' "$GIT_DIR"/FETCH_HEAD | \
tr '\012' ' ')
case "$merge_head" in case "$merge_head" in
'') '')
@ -38,4 +40,4 @@ case "$merge_head" in
esac esac
merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD")
git-resolve "$(cat "$GIT_DIR"/HEAD)" $merge_head "$merge_name" git-resolve "$curr_head" $merge_head "$merge_name"

View file

@ -33,7 +33,8 @@ test "$different1$different2" = "" ||
die "Your working tree does not match $ours_symbolic." die "Your working tree does not match $ours_symbolic."
git-read-tree -m -u $ours $upstream && git-read-tree -m -u $ours $upstream &&
git-rev-parse --verify "$upstream^0" >"$GIT_DIR/HEAD" || exit new_head=$(git-rev-parse --verify "$upstream^0") &&
git-update-ref HEAD "$new_head" || exit
tmp=.rebase-tmp$$ tmp=.rebase-tmp$$
fail=$tmp-fail fail=$tmp-fail
@ -50,7 +51,7 @@ do
continue ;; continue ;;
esac esac
echo >&2 "* Applying: $msg" echo >&2 "* Applying: $msg"
S=`cat "$GIT_DIR/HEAD"` && S=$(git-rev-parse --verify HEAD) &&
git-cherry-pick --replay $commit || { git-cherry-pick --replay $commit || {
echo >&2 "* Not applying the patch and continuing." echo >&2 "* Not applying the patch and continuing."
echo $commit >>$fail echo $commit >>$fail

View file

@ -60,7 +60,7 @@ then
else else
rm -f "$GIT_DIR/ORIG_HEAD" rm -f "$GIT_DIR/ORIG_HEAD"
fi fi
echo "$rev" >"$GIT_DIR/HEAD" git-update-ref HEAD "$rev"
case "$reset_type" in case "$reset_type" in
--hard ) --hard )

View file

@ -45,7 +45,7 @@ case "$common" in
"$head") "$head")
echo "Updating from $head to $merge." echo "Updating from $head to $merge."
git-read-tree -u -m $head $merge || exit 1 git-read-tree -u -m $head $merge || exit 1
echo $merge > "$GIT_DIR"/HEAD git-update-ref HEAD "$merge" "$head"
git-diff-tree -p $head $merge | git-apply --stat git-diff-tree -p $head $merge | git-apply --stat
dropheads dropheads
exit 0 exit 0
@ -99,6 +99,6 @@ if [ $? -ne 0 ]; then
fi fi
result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge) result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge)
echo "Committed merge $result_commit" echo "Committed merge $result_commit"
echo $result_commit > "$GIT_DIR"/HEAD git-update-ref HEAD "$result_commit" "$head"
git-diff-tree -p $head $result_commit | git-apply --stat git-diff-tree -p $head $result_commit | git-apply --stat
dropheads dropheads

View file

@ -27,7 +27,7 @@ struct alt_base
struct alt_base *next; struct alt_base *next;
}; };
struct alt_base *alt = NULL; static struct alt_base *alt = NULL;
static SHA_CTX c; static SHA_CTX c;
static z_stream stream; static z_stream stream;
@ -36,6 +36,10 @@ static int local;
static int zret; static int zret;
static int curl_ssl_verify; static int curl_ssl_verify;
static char *ssl_cert;
static char *ssl_key;
static char *ssl_capath;
static char *ssl_cainfo;
struct buffer struct buffer
{ {
@ -350,7 +354,7 @@ static int fetch_pack(struct alt_base *repo, unsigned char *sha1)
return 0; return 0;
} }
int fetch_object(struct alt_base *repo, unsigned char *sha1) static int fetch_object(struct alt_base *repo, unsigned char *sha1)
{ {
char *hex = sha1_to_hex(sha1); char *hex = sha1_to_hex(sha1);
char *filename = sha1_file_name(sha1); char *filename = sha1_file_name(sha1);
@ -522,6 +526,21 @@ int main(int argc, char **argv)
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
#endif #endif
if ((ssl_cert = getenv("GIT_SSL_CERT")) != NULL) {
curl_easy_setopt(curl, CURLOPT_SSLCERT, ssl_cert);
}
if ((ssl_key = getenv("GIT_SSL_KEY")) != NULL) {
curl_easy_setopt(curl, CURLOPT_SSLKEY, ssl_key);
}
#if LIBCURL_VERSION_NUM >= 0x070908
if ((ssl_capath = getenv("GIT_SSL_CAPATH")) != NULL) {
curl_easy_setopt(curl, CURLOPT_CAPATH, ssl_capath);
}
#endif
if ((ssl_cainfo = getenv("GIT_SSL_CAINFO")) != NULL) {
curl_easy_setopt(curl, CURLOPT_CAINFO, ssl_cainfo);
}
alt = xmalloc(sizeof(*alt)); alt = xmalloc(sizeof(*alt));
alt->base = url; alt->base = url;
alt->got_indices = 0; alt->got_indices = 0;

View file

@ -158,49 +158,33 @@ test_expect_success \
We have so far tested only empty index and clean-and-matching-A index We have so far tested only empty index and clean-and-matching-A index
case which are trivial. Make sure index requirements are also case which are trivial. Make sure index requirements are also
checked. The table also lists alternative semantics which is not checked.
currently implemented.
"git-diff-tree -m O A B" "git-read-tree -m O A B"
O A B result index requirements O A B result index requirements
------------------------------------------------------------------- -------------------------------------------------------------------
1 missing missing missing - must not exist. 1 missing missing missing - must not exist.
------------------------------------------------------------------ ------------------------------------------------------------------
2 missing missing exists no merge must not exist. 2 missing missing exists take B* must match B, if exists.
------------------------------------
(ALT) take B* must match B, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
3 missing exists missing no merge must match A and be 3 missing exists missing take A* must match A, if exists.
up-to-date, if exists.
------------------------------------
(ALT) take A* must match A, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
4 missing exists A!=B no merge must match A and be 4 missing exists A!=B no merge must match A and be
up-to-date, if exists. up-to-date, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
5 missing exists A==B no merge must match A and be 5 missing exists A==B take A must match A, if exists.
up-to-date, if exists.
------------------------------------
(ALT) take A must match A, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
6 exists missing missing no merge must not exist. 6 exists missing missing remove must not exist.
------------------------------------
(ALT) remove must not exist.
------------------------------------------------------------------ ------------------------------------------------------------------
7 exists missing O!=B no merge must not exist. 7 exists missing O!=B no merge must not exist.
------------------------------------------------------------------ ------------------------------------------------------------------
8 exists missing O==B no merge must not exist. 8 exists missing O==B remove must not exist.
------------------------------------
(ALT) remove must not exist.
------------------------------------------------------------------ ------------------------------------------------------------------
9 exists O!=A missing no merge must match A and be 9 exists O!=A missing no merge must match A and be
up-to-date, if exists. up-to-date, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
10 exists O==A missing no merge must match A and be 10 exists O==A missing remove ditto
up-to-date, if exists.
------------------------------------
(ALT) remove ditto
------------------------------------------------------------------ ------------------------------------------------------------------
11 exists O!=A O!=B no merge must match A and be 11 exists O!=A O!=B no merge must match A and be
A!=B up-to-date, if exists. A!=B up-to-date, if exists.
@ -210,10 +194,7 @@ currently implemented.
------------------------------------------------------------------ ------------------------------------------------------------------
13 exists O!=A O==B take A must match A, if exists. 13 exists O!=A O==B take A must match A, if exists.
------------------------------------------------------------------ ------------------------------------------------------------------
14 exists O==A O!=B take B must match A and be 14 exists O==A O!=B take B if exists, must either (1)
be up-to-date, if exists.
------------------------------------
(ALT) take B if exists, must either (1)
match A and be up-to-date, match A and be up-to-date,
or (2) match B. or (2) match B.
------------------------------------------------------------------ ------------------------------------------------------------------
@ -223,9 +204,9 @@ currently implemented.
*multi* in one in another *multi* in one in another
------------------------------------------------------------------- -------------------------------------------------------------------
Note: if we want to implement 2ALT and 3ALT we need to be careful. Note: we need to be careful in case 2 and 3. The tree A may contain
The tree A may contain DF (file) when tree B require DF to be a DF (file) when tree B require DF to be a directory by having DF/DF
directory by having DF/DF (file). (file).
END_OF_CASE_TABLE END_OF_CASE_TABLE

View file

@ -6,7 +6,7 @@ static const char git_update_ref_usage[] = "git-update-ref <refname> <value> [<o
#define MAXDEPTH 5 #define MAXDEPTH 5
const char *resolve_ref(const char *path, unsigned char *sha1) static const char *resolve_ref(const char *path, unsigned char *sha1)
{ {
int depth = MAXDEPTH, len; int depth = MAXDEPTH, len;
char buffer[256]; char buffer[256];