summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/RelNotes-1.5.4.6.txt43
-rw-r--r--Documentation/RelNotes-1.5.5.5.txt11
-rw-r--r--Documentation/RelNotes-1.5.6.1.txt28
-rw-r--r--Documentation/RelNotes-1.5.6.2.txt31
-rw-r--r--Documentation/git-rev-parse.txt5
-rw-r--r--Documentation/git-svn.txt2
-rw-r--r--Documentation/git.txt11
-rw-r--r--Documentation/howto/update-hook-example.txt2
l---------RelNotes2
-rw-r--r--builtin-cat-file.c1
-rw-r--r--builtin-clone.c5
-rw-r--r--builtin-describe.c2
-rw-r--r--builtin-for-each-ref.c7
-rw-r--r--builtin-log.c2
-rw-r--r--builtin-merge-recursive.c13
-rw-r--r--builtin-upload-archive.c2
-rw-r--r--cache.h2
-rw-r--r--combine-diff.c7
-rw-r--r--diff.c8
-rwxr-xr-xgit-rebase.sh14
-rwxr-xr-xgit-svn.perl20
-rw-r--r--path.c17
-rw-r--r--setup.c3
-rw-r--r--sha1_file.c9
-rw-r--r--shell.c17
-rwxr-xr-xt/t4017-diff-retval.sh8
-rwxr-xr-xt/t5601-clone.sh22
-rwxr-xr-xt/t6120-describe.sh2
28 files changed, 246 insertions, 50 deletions
diff --git a/Documentation/RelNotes-1.5.4.6.txt b/Documentation/RelNotes-1.5.4.6.txt
new file mode 100644
index 0000000000..3e3c3e55a3
--- /dev/null
+++ b/Documentation/RelNotes-1.5.4.6.txt
@@ -0,0 +1,43 @@
+GIT v1.5.4.6 Release Notes
+==========================
+
+I personally do not think there is any reason anybody should want to
+run v1.5.4.X series these days, because 'master' version is always
+more stable than any tagged released version of git.
+
+This is primarily to futureproof "git-shell" to accept requests
+without a dash between "git" and subcommand name (e.g. "git
+upload-pack") which the newer client will start to make sometime in
+the future.
+
+Fixes since v1.5.4.5
+--------------------
+
+ * Command line option "-n" to "git-repack" was not correctly parsed.
+
+ * Error messages from "git-apply" when the patchfile cannot be opened
+ have been improved.
+
+ * Error messages from "git-bisect" when given nonsense revisions have
+ been improved.
+
+ * reflog syntax that uses time e.g. "HEAD@{10 seconds ago}:path" did not
+ stop parsing at the closing "}".
+
+ * "git rev-parse --symbolic-full-name ^master^2" printed solitary "^",
+ but it should print nothing.
+
+ * "git apply" did not enforce "match at the beginning" correctly.
+
+ * a path specification "a/b" in .gitattributes file should not match
+ "sub/a/b", but it did.
+
+ * "git log --date-order --topo-order" did not override the earlier
+ date-order with topo-order as expected.
+
+ * "git fast-export" did not export octopus merges correctly.
+
+ * "git archive --prefix=$path/" mishandled gitattributes.
+
+As usual, it also comes with many documentation fixes and clarifications.
+
diff --git a/Documentation/RelNotes-1.5.5.5.txt b/Documentation/RelNotes-1.5.5.5.txt
new file mode 100644
index 0000000000..30fa3615c7
--- /dev/null
+++ b/Documentation/RelNotes-1.5.5.5.txt
@@ -0,0 +1,11 @@
+GIT v1.5.5.5 Release Notes
+==========================
+
+I personally do not think there is any reason anybody should want to
+run v1.5.5.X series these days, because 'master' version is always
+more stable than any tagged released version of git.
+
+This is primarily to futureproof "git-shell" to accept requests
+without a dash between "git" and subcommand name (e.g. "git
+upload-pack") which the newer client will start to make sometime in
+the future.
diff --git a/Documentation/RelNotes-1.5.6.1.txt b/Documentation/RelNotes-1.5.6.1.txt
new file mode 100644
index 0000000000..4864b16445
--- /dev/null
+++ b/Documentation/RelNotes-1.5.6.1.txt
@@ -0,0 +1,28 @@
+GIT v1.5.6.1 Release Notes
+==========================
+
+Fixes since v1.5.6
+------------------
+
+* Last minute change broke loose object creation on AIX.
+
+* (performance fix) We used to make $GIT_DIR absolute path early in the
+ programs but keeping it relative to the current directory internally
+ gives 1-3 per-cent performance boost.
+
+* bash completion knows the new --graph option to git-log family.
+
+
+* git-diff -c/--cc showed unnecessary "deletion" lines at the context
+ boundary.
+
+* git-for-each-ref ignored %(object) and %(type) requests for tag
+ objects.
+
+* git-merge usage had a typo.
+
+* Rebuilding of git-svn metainfo database did not take rewriteRoot
+ option into account.
+
+* Running "git-rebase --continue/--skip/--abort" before starting a
+ rebase gave nonsense error messages.
diff --git a/Documentation/RelNotes-1.5.6.2.txt b/Documentation/RelNotes-1.5.6.2.txt
new file mode 100644
index 0000000000..02d5910d5c
--- /dev/null
+++ b/Documentation/RelNotes-1.5.6.2.txt
@@ -0,0 +1,31 @@
+GIT v1.5.6.2 Release Notes
+==========================
+
+Futureproof
+-----------
+
+ * "git-shell" accepts requests without a dash between "git" and
+ subcommand name (e.g. "git upload-pack") which the newer client will
+ start to make sometime in the future.
+
+Fixes since v1.5.6.1
+--------------------
+
+* Optimization for a large import via "git-svn" introduced in v1.5.6 had a
+ serious memory and temporary file leak, which made it unusable for
+ moderately large import.
+
+* "git-svn" mangled remote nickname used in the configuration file
+ unnecessarily.
+
+* "git diff --check" did not report the result via its exit status
+ reliably.
+
+* "git show" segfaulted when an annotated tag that points at another
+ annotated tag was given to it.
+
+--
+exec >/var/tmp/1
+echo O=$(git describe maint)
+O=v1.5.6.1-13-g4f3dcc2
+git shortlog --no-merges $O..maint
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 9e273bc5a6..59e95adf42 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -184,7 +184,10 @@ blobs contained in a commit.
second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value
of the ref at a prior point in time. This suffix may only be
used immediately following a ref name and the ref must have an
- existing log ($GIT_DIR/logs/<ref>).
+ existing log ($GIT_DIR/logs/<ref>). Note that this looks up the state
+ of your *local* ref at a given time; e.g., what was in your local
+ `master` branch last week. If you want to look at commits made during
+ certain times, see `--since` and `--until`.
* A ref followed by the suffix '@' with an ordinal specification
enclosed in a brace pair (e.g. '\{1\}', '\{15\}') to specify
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 97bed54fbd..c350ad0f83 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -513,7 +513,7 @@ have each person clone that repository with 'git clone':
cd project
git-init
git remote add origin server:/pub/project
- git config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/*
+ git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
# Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)
git-svn init http://svn.foo.org/project
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 7414238fe5..85468a154d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -43,12 +43,13 @@ unreleased) version of git, that is available from 'master'
branch of the `git.git` repository.
Documentation for older releases are available here:
-* link:v1.5.6/git.html[documentation for release 1.5.6]
+* link:v1.5.6.1/git.html[documentation for release 1.5.6.1]
* release notes for
- link:RelNotes-1.5.6.txt[1.5.6],
+ link:RelNotes-1.5.6.1.txt[1.5.6.1].
+ link:RelNotes-1.5.6.txt[1.5.6].
-* link:v1.5.5/git.html[documentation for release 1.5.5]
+* link:v1.5.5.4/git.html[documentation for release 1.5.5.4]
* release notes for
link:RelNotes-1.5.5.4.txt[1.5.5.4],
@@ -57,8 +58,6 @@ Documentation for older releases are available here:
link:RelNotes-1.5.5.1.txt[1.5.5.1],
link:RelNotes-1.5.5.txt[1.5.5].
-* link:v1.5.5.4/git.html[documentation for release 1.5.5.4]
-
* link:v1.5.4.5/git.html[documentation for release 1.5.4.5]
* release notes for
@@ -82,6 +81,8 @@ Documentation for older releases are available here:
link:RelNotes-1.5.3.1.txt[1.5.3.1],
link:RelNotes-1.5.3.txt[1.5.3].
+* link:v1.5.2.5/git.html[documentation for release 1.5.2.5]
+
* release notes for
link:RelNotes-1.5.2.5.txt[1.5.2.5],
link:RelNotes-1.5.2.4.txt[1.5.2.4],
diff --git a/Documentation/howto/update-hook-example.txt b/Documentation/howto/update-hook-example.txt
index 88765b5575..a8d3bae408 100644
--- a/Documentation/howto/update-hook-example.txt
+++ b/Documentation/howto/update-hook-example.txt
@@ -68,7 +68,7 @@ function info {
# - Branches should only be fast-forwarded.
case "$1" in
refs/tags/*)
- [ -f "$GIT_DIR/$1" ] &&
+ git rev-parse --verify -q "$1" &&
deny >/dev/null "You can't overwrite an existing tag"
;;
refs/heads/*)
diff --git a/RelNotes b/RelNotes
index e29d6504d9..0072160018 120000
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes-1.5.6.txt \ No newline at end of file
+Documentation/RelNotes-1.5.6.2.txt \ No newline at end of file
diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index bd343efae7..880e75af5e 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -181,6 +181,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
write_or_die(1, contents, size);
printf("\n");
fflush(stdout);
+ free(contents);
}
return 0;
diff --git a/builtin-clone.c b/builtin-clone.c
index 7190952071..b2dfe1ab5c 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -400,6 +400,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (!option_bare) {
junk_work_tree = work_tree;
+ if (safe_create_leading_directories_const(work_tree) < 0)
+ die("could not create leading directories of '%s'",
+ work_tree);
if (mkdir(work_tree, 0755))
die("could not create work tree dir '%s'.", work_tree);
set_git_work_tree(work_tree);
@@ -410,6 +413,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
setenv(CONFIG_ENVIRONMENT, xstrdup(mkpath("%s/config", git_dir)), 1);
+ if (safe_create_leading_directories_const(git_dir) < 0)
+ die("could not create leading directories of '%s'", git_dir);
set_git_dir(make_absolute_path(git_dir));
fprintf(stderr, "Initialize %s\n", git_dir);
diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1d06..e515f9ca9b 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
*/
display_name(n);
if (longformat)
- show_suffix(0, n->tag->tagged->sha1);
+ show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
printf("\n");
return;
}
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 07d9c57212..fef93d7488 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -234,6 +234,13 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
name++;
if (!strcmp(name, "tag"))
v->s = tag->tag;
+ else if (!strcmp(name, "type") && tag->tagged)
+ v->s = typename(tag->tagged->type);
+ else if (!strcmp(name, "object") && tag->tagged) {
+ char *s = xmalloc(41);
+ strcpy(s, sha1_to_hex(tag->tagged->sha1));
+ v->s = s;
+ }
}
}
diff --git a/builtin-log.c b/builtin-log.c
index 9817d6fbeb..9979e37f38 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -360,7 +360,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
ret = show_object(o->sha1, 1, &rev);
- objects[i].item = (struct object *)t->tagged;
+ objects[i].item = parse_object(t->tagged->sha1);
i--;
break;
}
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c
index 4aa28a1bab..43bf6aa45e 100644
--- a/builtin-merge-recursive.c
+++ b/builtin-merge-recursive.c
@@ -481,15 +481,6 @@ static char *unique_path(const char *path, const char *branch)
return newpath;
}
-static int mkdir_p(const char *path, unsigned long mode)
-{
- /* path points to cache entries, so xstrdup before messing with it */
- char *buf = xstrdup(path);
- int result = safe_create_leading_directories(buf);
- free(buf);
- return result;
-}
-
static void flush_buffer(int fd, const char *buf, unsigned long size)
{
while (size > 0) {
@@ -512,7 +503,7 @@ static int make_room_for_path(const char *path)
int status;
const char *msg = "failed to create path '%s'%s";
- status = mkdir_p(path, 0777);
+ status = safe_create_leading_directories_const(path);
if (status) {
if (status == -3) {
/* something else exists */
@@ -583,7 +574,7 @@ static void update_file_flags(const unsigned char *sha,
close(fd);
} else if (S_ISLNK(mode)) {
char *lnk = xmemdupz(buf, size);
- mkdir_p(path, 0777);
+ safe_create_leading_directories_const(path);
unlink(path);
symlink(lnk, path);
free(lnk);
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 48ae09e9b5..371400d49a 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -30,7 +30,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
if (argc != 2)
usage(upload_archive_usage);
- if (strlen(argv[1]) > sizeof(buf))
+ if (strlen(argv[1]) + 1 > sizeof(buf))
die("insanely long repository name");
strcpy(buf, argv[1]); /* enter-repo smudges its argument */
diff --git a/cache.h b/cache.h
index 81b7e17de2..ca382d4622 100644
--- a/cache.h
+++ b/cache.h
@@ -518,6 +518,7 @@ enum sharedrepo {
int git_config_perm(const char *var, const char *value);
int adjust_shared_perm(const char *path);
int safe_create_leading_directories(char *path);
+int safe_create_leading_directories_const(const char *path);
char *enter_repo(char *path, int strict);
static inline int is_absolute_path(const char *path)
{
@@ -525,6 +526,7 @@ static inline int is_absolute_path(const char *path)
}
const char *make_absolute_path(const char *path);
const char *make_nonrelative_path(const char *path);
+const char *make_relative_path(const char *abs, const char *base);
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
extern int sha1_object_info(const unsigned char *, unsigned long *);
diff --git a/combine-diff.c b/combine-diff.c
index 588c58bc55..9f80a1c5e3 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -84,6 +84,7 @@ struct sline {
/* bit 0 up to (N-1) are on if the parent has this line (i.e.
* we did not change it).
* bit N is used for "interesting" lines, including context.
+ * bit (N+1) is used for "do not show deletion before this".
*/
unsigned long flag;
unsigned long *p_lno;
@@ -308,6 +309,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
@@ -329,7 +331,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
/* Paint a few lines before the first interesting line. */
while (j < i)
- sline[j++].flag |= mark;
+ sline[j++].flag |= mark | no_pre_delete;
again:
/* we know up to i is to be included. where does the
@@ -502,6 +504,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int use_color)
{
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
int i;
unsigned long lno = 0;
const char *c_frag = diff_get_color(use_color, DIFF_FRAGINFO);
@@ -581,7 +584,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int j;
unsigned long p_mask;
sl = &sline[lno++];
- ll = sl->lost_head;
+ ll = (sl->flag & no_pre_delete) ? NULL : sl->lost_head;
while (ll) {
fputs(c_old, stdout);
for (j = 0; j < num_parent; j++) {
diff --git a/diff.c b/diff.c
index 5262490086..f281c5b82a 100644
--- a/diff.c
+++ b/diff.c
@@ -1150,12 +1150,14 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
char *err;
if (line[0] == '+') {
+ unsigned bad;
data->lineno++;
- data->status = check_and_emit_line(line + 1, len - 1,
+ bad = check_and_emit_line(line + 1, len - 1,
data->ws_rule, NULL, NULL, NULL, NULL);
- if (!data->status)
+ if (!bad)
return;
- err = whitespace_error_string(data->status);
+ data->status |= bad;
+ err = whitespace_error_string(bad);
fprintf(data->file, "%s:%d: %s.\n", data->filename, data->lineno, err);
free(err);
emit_line(data->file, set, reset, line, 1);
diff --git a/git-rebase.sh b/git-rebase.sh
index dd7dfe123c..e2d85eeeab 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -150,6 +150,9 @@ while test $# != 0
do
case "$1" in
--continue)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git diff-files --quiet --ignore-submodules || {
echo "You must edit all merge conflicts and then"
echo "mark them as resolved using git add"
@@ -178,6 +181,9 @@ do
exit
;;
--skip)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git reset --hard HEAD || exit $?
if test -d "$dotest"
then
@@ -203,16 +209,16 @@ do
exit
;;
--abort)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git rerere clear
if test -d "$dotest"
then
move_to_original_branch
- elif test -d .dotest
- then
+ else
dotest=.dotest
move_to_original_branch
- else
- die "No rebase in progress?"
fi
git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
diff --git a/git-svn.perl b/git-svn.perl
index 4c9c59bc3f..f789a6eeca 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1462,13 +1462,6 @@ sub verify_remotes_sanity {
}
}
-# we allow more chars than remotes2config.sh...
-sub sanitize_remote_name {
- my ($name) = @_;
- $name =~ tr{A-Za-z0-9:,/+-}{.}c;
- $name;
-}
-
sub find_existing_remote {
my ($url, $remotes) = @_;
return undef if $no_reuse_existing;
@@ -2853,7 +2846,7 @@ sub _new {
unless (defined $ref_id && length $ref_id) {
$_[2] = $ref_id = $Git::SVN::default_ref_id;
}
- $_[1] = $repo_id = sanitize_remote_name($repo_id);
+ $_[1] = $repo_id;
my $dir = "$ENV{GIT_DIR}/svn/$ref_id";
$_[3] = $path = '' unless (defined $path);
mkpath(["$ENV{GIT_DIR}/svn"]);
@@ -3243,7 +3236,9 @@ sub close_file {
my ($tmp_fh, $tmp_filename) = File::Temp::tempfile(UNLINK => 1);
my $result;
while ($result = sysread($fh, my $string, 1024)) {
- syswrite($tmp_fh, $string, $result);
+ my $wrote = syswrite($tmp_fh, $string, $result);
+ defined($wrote) && $wrote == $result
+ or croak("write $tmp_filename: $!\n");
}
defined $result or croak $!;
close $tmp_fh or croak $!;
@@ -3251,6 +3246,7 @@ sub close_file {
close $fh or croak $!;
$hash = $::_repository->hash_and_insert_object($tmp_filename);
+ unlink($tmp_filename);
$hash =~ /^[a-f\d]{40}$/ or die "not a sha1: $hash\n";
close $fb->{base} or croak $!;
} else {
@@ -4704,8 +4700,7 @@ sub minimize_connections {
# skip existing cases where we already connect to the root
if (($ra->{url} eq $ra->{repos_root}) ||
- (Git::SVN::sanitize_remote_name($ra->{repos_root}) eq
- $repo_id)) {
+ ($ra->{repos_root} eq $repo_id)) {
$root_repos->{$ra->{url}} = $repo_id;
next;
}
@@ -4744,8 +4739,7 @@ sub minimize_connections {
foreach my $url (keys %$new_urls) {
# see if we can re-use an existing [svn-remote "repo_id"]
# instead of creating a(n ugly) new section:
- my $repo_id = $root_repos->{$url} ||
- Git::SVN::sanitize_remote_name($url);
+ my $repo_id = $root_repos->{$url} || $url;
my $fetch = $new_urls->{$url};
foreach my $path (keys %$fetch) {
diff --git a/path.c b/path.c
index 7a35a26a16..6e3df18499 100644
--- a/path.c
+++ b/path.c
@@ -330,6 +330,23 @@ const char *make_nonrelative_path(const char *path)
/* We allow "recursive" symbolic links. Only within reason, though. */
#define MAXDEPTH 5
+const char *make_relative_path(const char *abs, const char *base)
+{
+ static char buf[PATH_MAX + 1];
+ int baselen;
+ if (!base)
+ return abs;
+ baselen = strlen(base);
+ if (prefixcmp(abs, base))
+ return abs;
+ if (abs[baselen] == '/')
+ baselen++;
+ else if (base[baselen - 1] != '/')
+ return abs;
+ strcpy(buf, abs + baselen);
+ return buf;
+}
+
const char *make_absolute_path(const char *path)
{
static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
diff --git a/setup.c b/setup.c
index d630e374e7..3b111ea7cf 100644
--- a/setup.c
+++ b/setup.c
@@ -292,9 +292,10 @@ void setup_work_tree(void)
work_tree = get_git_work_tree();
git_dir = get_git_dir();
if (!is_absolute_path(git_dir))
- set_git_dir(make_absolute_path(git_dir));
+ git_dir = make_absolute_path(git_dir);
if (!work_tree || chdir(work_tree))
die("This operation must be run in a work tree");
+ set_git_dir(make_relative_path(git_dir, work_tree));
initialized = 1;
}
diff --git a/sha1_file.c b/sha1_file.c
index 92299ed622..d1c406081e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -116,6 +116,15 @@ int safe_create_leading_directories(char *path)
return 0;
}
+int safe_create_leading_directories_const(const char *path)
+{
+ /* path points to cache entries, so xstrdup before messing with it */
+ char *buf = xstrdup(path);
+ int result = safe_create_leading_directories(buf);
+ free(buf);
+ return result;
+}
+
char *sha1_to_hex(const unsigned char *sha1)
{
static int bufno;
diff --git a/shell.c b/shell.c
index 9826109d5b..b27d01c9e4 100644
--- a/shell.c
+++ b/shell.c
@@ -7,6 +7,7 @@ static int do_generic_cmd(const char *me, char *arg)
{
const char *my_argv[4];
+ setup_path(NULL);
if (!arg || !(arg = sq_dequote(arg)))
die("bad argument");
if (prefixcmp(me, "git-"))
@@ -29,7 +30,6 @@ static int do_cvs_cmd(const char *me, char *arg)
die("git-cvsserver only handles server: %s", arg);
setup_path(NULL);
-
return execv_git_cmd(cvsserver_argv);
}
@@ -49,15 +49,24 @@ int main(int argc, char **argv)
char *prog;
struct commands *cmd;
+ /*
+ * Special hack to pretend to be a CVS server
+ */
if (argc == 2 && !strcmp(argv[1], "cvs server"))
argv--;
- /* We want to see "-c cmd args", and nothing else */
+
+ /*
+ * We do not accept anything but "-c" followed by "cmd arg",
+ * where "cmd" is a very limited subset of git commands.
+ */
else if (argc != 3 || strcmp(argv[1], "-c"))
die("What do you think I am? A shell?");
prog = argv[2];
- argv += 2;
- argc -= 2;
+ if (!strncmp(prog, "git", 3) && isspace(prog[3]))
+ /* Accept "git foo" as if the caller said "git-foo". */
+ prog[3] = '-';
+
for (cmd = cmd_list ; cmd->name ; cmd++) {
int len = strlen(cmd->name);
char *arg;
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index dc0b7126cc..0d0fb87f57 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -105,4 +105,12 @@ test_expect_success '--check with --no-pager returns 2 for dirty difference' '
'
+
+test_expect_success 'check should test not just the last line' '
+ echo "" >>a &&
+ git --no-pager diff --check
+ test $? = 2
+
+'
+
test_done
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 593d1a3877..b642fb260b 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -30,4 +30,26 @@ test_expect_success 'clone checks out files' '
'
+test_expect_success 'clone respects GIT_WORK_TREE' '
+
+ GIT_WORK_TREE=worktree git clone src bare &&
+ test -f bare/config &&
+ test -f worktree/file
+
+'
+
+test_expect_success 'clone creates intermediate directories' '
+
+ git clone src long/path/to/dst &&
+ test -f long/path/to/dst/file
+
+'
+
+test_expect_success 'clone creates intermediate directories for bare repo' '
+
+ git clone --bare src long/path/to/bare/dst &&
+ test -f long/path/to/bare/dst/config
+
+'
+
test_done
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index c6be2597f7..2fb672c3b4 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -139,4 +139,6 @@ check_describe "test1-lightweight-*" --tags --match="test1-*"
check_describe "test2-lightweight-*" --tags --match="test2-*"
+check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
+
test_done