Merge branch 'master' into next

* master:
  Rename get_ident() to fmt_ident() and make it available to outside
  git-archimport: initial import needs empty directory
  Revert "Allow branch.*.merge to talk about remote tracking branches."
  Why is it bad to rewind a branch that has already been pushed out?
  git-clone --reference: saner handling of borrowed symrefs.
This commit is contained in:
Junio C Hamano
2007-02-04 19:06:35 -08:00
7 changed files with 85 additions and 12 deletions

View File

@@ -461,6 +461,8 @@ this branch. If this branch is the only branch containing those
commits, they will be lost. Also, don't use "git reset" on a
publicly-visible branch that other developers pull from, as it will
force needless merges on other developers to clean up the history.
If you need to undo changes that you have pushed, use gitlink:git-revert[1]
instead.
The git grep command can search for strings in any version of your
project, so

View File

@@ -321,6 +321,7 @@ unsigned long approxidate(const char *);
extern const char *git_author_info(int);
extern const char *git_committer_info(int);
extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int);
struct checkout {
const char *base_dir;

View File

@@ -95,6 +95,15 @@ $ENV{'TMPDIR'} = $opt_t if $opt_t; # $ENV{TMPDIR} will affect tempdir() calls:
my $tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1);
$opt_v && print "+ Using $tmp as temporary directory\n";
unless (-d $git_dir) { # initial import needs empty directory
opendir DIR, '.' or die "Unable to open current directory: $!\n";
while (my $entry = readdir DIR) {
$entry =~ /^\.\.?$/ or
die "Initial import needs an empty current working directory.\n"
}
closedir DIR
}
my %reachable = (); # Arch repositories we can access
my %unreachable = (); # Arch repositories we can't access :<
my @psets = (); # the collection

View File

@@ -190,7 +190,34 @@ then
(cd "$GIT_DIR/refs" &&
mkdir reference-tmp &&
cd reference-tmp &&
tar xf -)
tar xf - &&
find refs ! -type d -print |
while read ref
do
if test -h "$ref"
then
# Old-style symbolic link ref. Not likely
# to appear under refs/ but we might as well
# deal with them.
:
elif test -f "$ref"
then
point=$(cat "$ref") &&
case "$point" in
'ref: '*) ;;
*) continue ;;
esac
fi
# The above makes true ref to 'continue' and
# we will come here when we are looking at
# symbolic link ref or a textual symref (or
# garbage, like fifo).
# The true ref pointed at by it is enough to
# ensure that we do not fetch objects reachable
# from it.
rm -f "$ref"
done
)
else
die "reference repository '$reference' is not a local directory."
fi

View File

@@ -174,12 +174,8 @@ canon_refs_list_for_fetch () {
else
for merge_branch in $merge_branches
do
if test "$remote" = "$merge_branch" ||
test "$local" = "$merge_branch"
then
dot_prefix=
break
fi
[ "$remote" = "$merge_branch" ] &&
dot_prefix= && break
done
fi
case "$remote" in

View File

@@ -185,8 +185,8 @@ static const char *env_hint =
"Add --global to set your account\'s default\n"
"\n";
static const char *get_ident(const char *name, const char *email,
const char *date_str, int error_on_no_name)
const char *fmt_ident(const char *name, const char *email,
const char *date_str, int error_on_no_name)
{
static char buffer[1000];
char date[50];
@@ -233,7 +233,7 @@ static const char *get_ident(const char *name, const char *email,
const char *git_author_info(int error_on_no_name)
{
return get_ident(getenv("GIT_AUTHOR_NAME"),
return fmt_ident(getenv("GIT_AUTHOR_NAME"),
getenv("GIT_AUTHOR_EMAIL"),
getenv("GIT_AUTHOR_DATE"),
error_on_no_name);
@@ -241,7 +241,7 @@ const char *git_author_info(int error_on_no_name)
const char *git_committer_info(int error_on_no_name)
{
return get_ident(getenv("GIT_COMMITTER_NAME"),
return fmt_ident(getenv("GIT_COMMITTER_NAME"),
getenv("GIT_COMMITTER_EMAIL"),
getenv("GIT_COMMITTER_DATE"),
error_on_no_name);

View File

@@ -26,7 +26,7 @@ git prune'
cd "$base_dir"
test_expect_success 'cloning with reference' \
test_expect_success 'cloning with reference (-l -s)' \
'git clone -l -s --reference B A C'
cd "$base_dir"
@@ -50,6 +50,28 @@ diff expected current'
cd "$base_dir"
test_expect_success 'cloning with reference (no -l -s)' \
'git clone --reference B A D'
cd "$base_dir"
test_expect_success 'existence of info/alternates' \
'test `wc -l <D/.git/objects/info/alternates` = 1'
cd "$base_dir"
test_expect_success 'pulling from reference' \
'cd D && git pull ../B'
cd "$base_dir"
test_expect_success 'that reference gets used' \
'cd D && echo "0 objects, 0 kilobytes" > expected &&
git count-objects > current &&
diff expected current'
cd "$base_dir"
test_expect_success 'updating origin' \
'cd A &&
echo third > file3 &&
@@ -75,4 +97,20 @@ diff expected current'
cd "$base_dir"
test_expect_success 'pulling changes from origin' \
'cd D &&
git pull origin'
cd "$base_dir"
# the 5 local objects are expected; file3 blob, commit in A to add it
# and its tree, and 2 are our tree and the merge commit.
test_expect_success 'check objects expected to exist locally' \
'cd D &&
echo "5 objects" > expected &&
git count-objects | cut -d, -f1 > current &&
diff expected current'
cd "$base_dir"
test_done