Merge branch 'se/http' into next
authorJunio C Hamano <junkio@cox.net>
Tue, 23 May 2006 01:54:19 +0000 (18:54 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 23 May 2006 01:54:19 +0000 (18:54 -0700)
* se/http:
  Remove possible segfault in http-fetch.
  Install git builtins into gitexecdir rather than bindir.
  Change GIT-VERSION-GEN to call git commands with "git" not "git-".
  cvsimport: replace anonymous sub ref with a normal sub
  cvsimport: minor fixups
  Problem: 'trap...exit' causes error message when /bin/sh is ash.
  Avoid segfault in diff --stat rename output.
  Tutorial #2: broken link fix.
  git help: remove whatchanged from list of common commands

Documentation/tutorial-2.txt
GIT-VERSION-GEN
Makefile
diff.c
generate-cmdlist.sh
git-clone.sh
git-cvsimport.perl
http-fetch.c

index 7de91aa..08d3453 100644 (file)
@@ -375,7 +375,7 @@ What next?
 
 At this point you should know everything necessary to read the man
 pages for any of the git commands; one good place to start would be
-with the commands mentioned in link:everday.html[Everyday git].  You
+with the commands mentioned in link:everyday.html[Everyday git].  You
 should be able to find any unknown jargon in the
 link:glossary.html[Glosssay].
 
index 7fcefcd..a461518 100755 (executable)
@@ -5,7 +5,7 @@ DEF_VER=v1.3.GIT
 
 # First try git-describe, then see if there is a version file
 # (included in release tarballs), then default
-if VN=$(git-describe --abbrev=4 HEAD 2>/dev/null); then
+if VN=$(git describe --abbrev=4 HEAD 2>/dev/null); then
        VN=$(echo "$VN" | sed -e 's/-/./g');
 elif test -f version
 then
@@ -16,7 +16,7 @@ fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
 
-dirty=$(sh -c 'git-diff-index --name-only HEAD' 2>/dev/null) || dirty=
+dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
 case "$dirty" in
 '')
        ;;
index 5bf820c..677bc13 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -631,7 +631,14 @@ install: all
        $(MAKE) -C templates install
        $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
        $(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
-       $(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(bindir_SQ)/$p' && ln '$(DESTDIR_SQ)$(bindir_SQ)/git$X' '$(DESTDIR_SQ)$(bindir_SQ)/$p' ;)
+       if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
+       then \
+               ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
+                       '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' || \
+               cp '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
+                       '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X'; \
+       fi
+       $(foreach p,$(BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git$X' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
 
 install-doc:
        $(MAKE) -C Documentation install
diff --git a/diff.c b/diff.c
index 7f35e59..a7bb9b9 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -237,7 +237,7 @@ static char *pprint_rename(const char *a, const char *b)
                if (a_midlen < 0) a_midlen = 0;
                if (b_midlen < 0) b_midlen = 0;
 
-               name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7);
+               name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7);
                sprintf(name, "%.*s{%.*s => %.*s}%s",
                        pfx_length, a,
                        a_midlen, a + pfx_length,
index 6c59dbd..ec1eda2 100755 (executable)
@@ -37,7 +37,6 @@ show-branch
 status
 tag
 verify-tag
-whatchanged
 EOF
 while read cmd
 do
index 227245c..d96894d 100755 (executable)
@@ -199,7 +199,7 @@ dir="$2"
 [ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
-trap 'err=$?; cd ..; rm -r "$D"; exit $err' exit
+trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
 case "$bare" in
 yes) GIT_DIR="$D" ;;
 *) GIT_DIR="$D/.git" ;;
@@ -407,5 +407,5 @@ Pull: refs/heads/$head_points_at:$origin_track" &&
 fi
 rm -f "$GIT_DIR/CLONE_HEAD" "$GIT_DIR/REMOTE_HEAD"
 
-trap - exit
+trap - 0
 
index 8c707f2..d257e66 100755 (executable)
@@ -563,7 +563,7 @@ my $state = 0;
 
 my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
 my(@old,@new,@skipped);
-my $commit = sub {
+sub commit {
        my $pid;
        while(@old) {
                my @o2;
@@ -650,6 +650,8 @@ my $commit = sub {
                        "GIT_COMMITTER_DATE=".strftime("+0000 %Y-%m-%d %H:%M:%S",gmtime($date)),
                        "git-commit-tree", $tree,@par);
                die "Cannot exec git-commit-tree: $!\n";
+
+               close OUT;
        }
        $pw->writer();
        $pr->reader();
@@ -661,6 +663,7 @@ my $commit = sub {
        if (@skipped) {
            $logmsg .= "\n\n\nSKIPPED:\n\t";
            $logmsg .= join("\n\t", @skipped) . "\n";
+           @skipped = ();
        }
 
        print $pw "$logmsg\n"
@@ -849,7 +852,7 @@ while(<CVS>) {
        } elsif($state == 9 and /^\s*$/) {
                $state = 10;
        } elsif(($state == 9 or $state == 10) and /^-+$/) {
-               &$commit();
+               commit();
                $state = 1;
        } elsif($state == 11 and /^-+$/) {
                $state = 1;
@@ -859,7 +862,7 @@ while(<CVS>) {
                print "* UNKNOWN LINE * $_\n";
        }
 }
-&$commit() if $branch and $state != 11;
+commit() if $branch and $state != 11;
 
 unlink($git_index);
 
index 861644b..178f1ee 100644 (file)
@@ -1269,10 +1269,10 @@ int main(int argc, char **argv)
        if (pull(commit_id))
                rc = 1;
 
-       curl_slist_free_all(no_pragma_header);
-
        http_cleanup();
 
+       curl_slist_free_all(no_pragma_header);
+
        if (corrupt_object_found) {
                fprintf(stderr,
 "Some loose object were found to be corrupt, but they might be just\n"