Merge branch 'js/maint-http-push' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 27 Feb 2008 19:09:44 +0000 (11:09 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Feb 2008 19:09:44 +0000 (11:09 -0800)
* js/maint-http-push:
http-push: avoid a needless goto
http-push: do not get confused by submodules
http-push: avoid invalid memory accesses

39 files changed:
.mailmap
Documentation/RelNotes-1.5.4.1.txt [new file with mode: 0644]
Documentation/RelNotes-1.5.4.2.txt [new file with mode: 0644]
Documentation/RelNotes-1.5.4.3.txt [new file with mode: 0644]
Documentation/git-add.txt
Documentation/git-am.txt
Documentation/git-filter-branch.txt
Documentation/git-push.txt
Documentation/git-reset.txt
Documentation/git-stash.txt
GIT-VERSION-GEN
Makefile
RelNotes
builtin-commit.c
builtin-fast-export.c
builtin-init-db.c
builtin-push.c
builtin-rerere.c
builtin-rev-parse.c
cache.h
copy.c
date.c
diff.c
git-clone.sh
git-filter-branch.sh
git-gui/Makefile
git-gui/git-gui.sh
git-gui/lib/choose_repository.tcl
git-gui/lib/error.tcl
git-gui/macosx/Info.plist
git-send-email.perl
git.spec.in
hash.c
refs.c
t/t1502-rev-parse-parseopt.sh [new file with mode: 0755]
t/t5505-remote.sh
t/t5701-clone-local.sh
t/t7003-filter-branch.sh
t/t7502-status.sh
index 695739ea704ae1530a5b0a31d60c5eabba70a89c..a32d9e2a3f95a4d6cdfb050f2454e31192dea34e 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -43,6 +43,7 @@ Steven Grimm <koreth@midwinter.com>
 Theodore Ts'o <tytso@mit.edu>
 Tony Luck <tony.luck@intel.com>
 Uwe Kleine-König <Uwe_Zeisberger@digi.com>
+Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
 Uwe Kleine-König <uzeisberger@io.fsforth.de>
 Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
diff --git a/Documentation/RelNotes-1.5.4.1.txt b/Documentation/RelNotes-1.5.4.1.txt
new file mode 100644 (file)
index 0000000..d4e44b8
--- /dev/null
@@ -0,0 +1,17 @@
+GIT v1.5.4.1 Release Notes
+==========================
+
+Fixes since v1.5.4
+------------------
+
+ * "git-commit -C $tag" used to work but rewrite in C done in
+   1.5.4 broke it.
+
+ * An entry in the .gitattributes file that names a pattern in a
+   subdirectory of the directory it is in did not match
+   correctly (e.g. pattern "b/*.c" in "a/.gitattributes" should
+   match "a/b/foo.c" but it didn't).
+
+ * Customized color specification was parsed incorrectly when
+   numeric color values are used.  This was fixed in 1.5.4.1.
+
diff --git a/Documentation/RelNotes-1.5.4.2.txt b/Documentation/RelNotes-1.5.4.2.txt
new file mode 100644 (file)
index 0000000..21d0df5
--- /dev/null
@@ -0,0 +1,43 @@
+GIT v1.5.4.2 Release Notes
+==========================
+
+Fixes since v1.5.4
+------------------
+
+ * The configuration parser was not prepared to see string
+   valued variables misspelled as boolean and segfaulted.
+
+ * Temporary files left behind due to interrupted object
+   transfers were not cleaned up with "git prune".
+
+ * "git config --unset" was confused when the unset variables
+   were spelled with continuation lines in the config file.
+
+ * The merge message detection in "git cvsimport" did not catch
+   a message that began with "Merge...".
+
+ * "git status" suggests "git rm --cached" for unstaging the
+   earlier "git add" before the initial commit.
+
+ * "git status" output was incorrect during a partial commit.
+
+ * "git bisect" refused to start when the HEAD was detached.
+
+ * "git bisect" allowed a wildcard character in the commit
+   message expanded while writing its log file.
+
+ * Manual pages were not formatted correctly with docbook xsl
+   1.72; added a workaround.
+
+ * "git-commit -C $tag" used to work but rewrite in C done in
+   1.5.4 broke it.  This was fixed in 1.5.4.1.
+
+ * An entry in the .gitattributes file that names a pattern in a
+   subdirectory of the directory it is in did not match
+   correctly (e.g. pattern "b/*.c" in "a/.gitattributes" should
+   match "a/b/foo.c" but it didn't).  This was fixed in 1.5.4.1.
+
+ * Customized color specification was parsed incorrectly when
+   numeric color values are used.  This was fixed in 1.5.4.1.
+
+ * http transport misbehaved when linked with curl-gnutls.
diff --git a/Documentation/RelNotes-1.5.4.3.txt b/Documentation/RelNotes-1.5.4.3.txt
new file mode 100644 (file)
index 0000000..b0fc67f
--- /dev/null
@@ -0,0 +1,27 @@
+GIT v1.5.4.3 Release Notes
+==========================
+
+Fixes since v1.5.4.2
+--------------------
+
+ * RPM spec used to pull in everything with 'git'.  This has been
+   changed so that 'git' package contains just the core parts,
+   and we now supply 'git-all' metapackage to slurp in everything.
+   This should match end user's expectation better.
+
+ * When some refs failed to update, git-push reported "failure"
+   which was unclear if some other refs were updated or all of
+   them failed atomically (the answer is the former).  Reworded
+   the message to clarify this.
+
+ * "git clone" from a repository whose HEAD was misconfigured
+   did not set up the remote properly.  Now it tries to do
+   better.
+
+ * Updated git-push documentation to clarify what "matching"
+   means, in order to reduce user confusion.
+
+ * Updated git-add documentation to clarify "add -u" operates in
+   the current subdirectory you are in, just like other commands.
+
+ * git-gui updates to work on OSX and Windows better.
index 9d2ac865d29164dd594c801dd42e3492128f7b91..47799097ce97da34fac60eafabd25576e077e362 100644 (file)
@@ -74,8 +74,8 @@ OPTIONS
        Update only files that git already knows about. This is similar
        to what "git commit -a" does in preparation for making a commit,
        except that the update is limited to paths specified on the
-       command line. If no paths are specified, all tracked files are
-       updated.
+       command line. If no paths are specified, all tracked files in the
+       current directory and its subdirectories are updated.
 
 \--refresh::
        Don't add the file(s), but only refresh their stat()
index 2ffba2102b1c2a7dbd093fed89a15b2e644aa398..e640fc75cd3c463370f62b623a4060b014d9371a 100644 (file)
@@ -138,7 +138,7 @@ aborts in the middle,.  You can recover from this in one of two ways:
 
 The command refuses to process new mailboxes while `.dotest`
 directory exists, so if you decide to start over from scratch,
-run `rm -f .dotest` before running the command with mailbox
+run `rm -f -r .dotest` before running the command with mailbox
 names.
 
 
index e22dfa580383c0a7af00d9d56e01a1869fb6ce75..543a1cf105b6df5953e529ecb4f9f88db273164f 100644 (file)
@@ -56,7 +56,9 @@ notable exception of the commit filter, for technical reasons).
 Prior to that, the $GIT_COMMIT environment variable will be set to contain
 the id of the commit being rewritten.  Also, GIT_AUTHOR_NAME,
 GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL,
-and GIT_COMMITTER_DATE are set according to the current commit.
+and GIT_COMMITTER_DATE are set according to the current commit. If any
+evaluation of <command> returns a non-zero exit status, the whole operation
+will be aborted.
 
 A 'map' function is available that takes an "original sha1 id" argument
 and outputs a "rewritten sha1 id" if the commit has been already
@@ -197,7 +199,7 @@ happened).  If this is not the case, use:
 
 --------------------------------------------------------------------------
 git filter-branch --parent-filter \
-       'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' HEAD
+       'test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>" || cat' HEAD
 --------------------------------------------------------------------------
 
 or even simpler:
@@ -240,6 +242,15 @@ committed a merge between P1 and P2, it will be propagated properly
 and all children of the merge will become merge commits with P1,P2
 as their parents instead of the merge commit.
 
+You can rewrite the commit log messages using `--message-filter`.  For
+example, `git-svn-id` strings in a repository created by `git-svn` can
+be removed this way:
+
+-------------------------------------------------------
+git filter-branch --message-filter '
+       sed -e "/^git-svn-id:/d"
+'
+-------------------------------------------------------
 
 To restrict rewriting to only part of the history, specify a revision
 range in addition to the new branch name.  The new branch name will
index 5f2494495bcec47d0de2daf109d46ec3c76cd912..3128170bcd1c3e3eb5981ed4c2f35221dfb06658 100644 (file)
@@ -47,9 +47,9 @@ even if it does not result in a fast forward update.
 +
 Note: If no explicit refspec is found, (that is neither
 on the command line nor in any Push line of the
-corresponding remotes file---see below), then all the
-heads that exist both on the local side and on the remote
-side are updated.
+corresponding remotes file---see below), then "matching" heads are
+pushed: for every head that exists on the local side, the remote side is
+updated if a head of the same name already exists on the remote side.
 +
 `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
 +
@@ -108,6 +108,55 @@ the remote repository.
 
 include::urls-remotes.txt[]
 
+OUTPUT
+------
+
+The output of "git push" depends on the transport method used; this
+section describes the output when pushing over the git protocol (either
+locally or via ssh).
+
+The status of the push is output in tabular form, with each line
+representing the status of a single ref. Each line is of the form:
+
+-------------------------------
+ <flag> <summary> <from> -> <to> (<reason>)
+-------------------------------
+
+flag::
+       A single character indicating the status of the ref. This is
+       blank for a successfully pushed ref, `!` for a ref that was
+       rejected or failed to push, and '=' for a ref that was up to
+       date and did not need pushing (note that the status of up to
+       date refs is shown only when `git push` is running verbosely).
+
+summary::
+       For a successfully pushed ref, the summary shows the old and new
+       values of the ref in a form suitable for using as an argument to
+       `git log` (this is `<old>..<new>` in most cases, and
+       `<old>...<new>` for forced non-fast forward updates). For a
+       failed update, more details are given for the failure.
+       The string `rejected` indicates that git did not try to send the
+       ref at all (typically because it is not a fast forward). The
+       string `remote rejected` indicates that the remote end refused
+       the update; this rejection is typically caused by a hook on the
+       remote side. The string `remote failure` indicates that the
+       remote end did not report the successful update of the ref
+       (perhaps because of a temporary error on the remote side, a
+       break in the network connection, or other transient error).
+
+from::
+       The name of the local ref being pushed, minus its
+       `refs/<type>/` prefix. In the case of deletion, the
+       name of the local ref is omitted.
+
+to::
+       The name of the remote ref being updated, minus its
+       `refs/<type>/` prefix.
+
+reason::
+       A human-readable explanation. In the case of successfully pushed
+       refs, no explanation is needed. For a failed ref, the reason for
+       failure is described.
 
 Examples
 --------
index a4e0a779de6a8e2de7ec9012bc66f15ca351e2aa..fac59c972659111aa2bba365c6aba94577d95702 100644 (file)
@@ -8,8 +8,8 @@ git-reset - Reset current HEAD to the specified state
 SYNOPSIS
 --------
 [verse]
-'git-reset' [--mixed | --soft | --hard] [-q] [<commit>]
-'git-reset' [--mixed] [-q] [<commit>] [--] <paths>...
+'git reset' [--mixed | --soft | --hard] [-q] [<commit>]
+'git reset' [-q] [<commit>] [--] <paths>...
 
 DESCRIPTION
 -----------
@@ -37,7 +37,7 @@ OPTIONS
 --soft::
        Does not touch the index file nor the working tree at all, but
        requires them to be in a good order. This leaves all your changed
-       files "Added but not yet committed", as linkgit:git-status[1] would
+       files "Changes to be committed", as linkgit:git-status[1] would
        put it.
 
 --hard::
@@ -176,6 +176,23 @@ $ git reset                                       <3>
     committed as 'snapshot WIP'.  This updates the index to show your
     WIP files as uncommitted.
 
+Reset a single file in the index::
++
+Suppose you have added a file to your index, but later decide you do not
+want to add it to your commit. You can remove the file from the index
+while keeping your changes with git reset.
++
+------------
+$ git reset -- frotz.c                      <1>
+$ git commit -m "Commit files in index"     <2>
+$ git add frotz.c                           <3>
+------------
++
+<1> This removes the file from the index while keeping it in the working
+    directory.
+<2> This commits all other changes in the index.
+<3> Adds the file to the index again.
+
 Author
 ------
 Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org>
index cd0dc1bd9d53282d65c52e6b9ded6d40fe087598..48e6f5a3f7a85e886639381dfa70434ecdeccfc2 100644 (file)
@@ -43,7 +43,7 @@ save [<message>]::
        subcommand is given. The <message> part is optional and gives
        the description along with the stashed state.
 
-list::
+list [<options>]::
 
        List the stashes that you currently have.  Each 'stash' is listed
        with its name (e.g. `stash@\{0}` is the latest stash, `stash@\{1}` is
@@ -55,6 +55,9 @@ list::
 stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
 stash@{1}: On master: 9cc0589... Add git-stash
 ----------------------------------------------------------------
++
+The command takes options applicable to the linkgit:git-log[1]
+command to control what is shown and how.
 
 show [<stash>]::
 
index 38a3273974e3313550218cdb8b50f3f2a8b4dec6..0d4c2f79c58a2141dc5d5d6998f7ab2a2fa31881 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.5.4.GIT
+DEF_VER=v1.5.4.3.GIT
 
 LF='
 '
@@ -15,7 +15,9 @@ elif test -d .git &&
        VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
        case "$VN" in
        *$LF*) (exit 1) ;;
-       v[0-9]*) : happy ;;
+       v[0-9]*)
+               test -z "$(git diff-index --name-only HEAD)" ||
+               VN="$VN-dirty" ;;
        esac
 then
        VN=$(echo "$VN" | sed -e 's/-/./g');
@@ -25,14 +27,6 @@ fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
 
-dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
-case "$dirty" in
-'')
-       ;;
-*)
-       VN="$VN-dirty" ;;
-esac
-
 if test -r $GVF
 then
        VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
index 92341c4bbe3f65671271211c9cbac3d4ffdc3eef..7a3c6d1456c32cb79f04cda9dd245bdc9de77a67 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1087,7 +1087,7 @@ git.spec: git.spec.in
        mv $@+ $@
 
 GIT_TARNAME=git-$(GIT_VERSION)
-dist: git.spec git-archive configure
+dist: git.spec git-archive$(X) configure
        ./git-archive --format=tar \
                --prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
        @mkdir -p $(GIT_TARNAME)
index 46308cee0ba1ca2cf7d7d9c3de6abafe20c1493f..3084ce6946658475767c3098d79c60aff2bb7347 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes-1.5.4.txt
\ No newline at end of file
+Documentation/RelNotes-1.5.4.3.txt
\ No newline at end of file
index a43f2019959a950639f013ff534610e228d8c149..45232a11c408530e7ca011f7262532df236c2576 100644 (file)
@@ -317,6 +317,10 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
        if (write_cache(fd, active_cache, active_nr) ||
            close_lock_file(&false_lock))
                die("unable to write temporary index file");
+
+       discard_cache();
+       read_cache_from(false_lock.filename);
+
        return false_lock.filename;
 }
 
index ef27eee71bdef2cac6f751e07b1da71588989b03..724cff35d37a42daa85edd41b97f0ef20d01f684 100755 (executable)
@@ -123,7 +123,7 @@ static void show_filemodify(struct diff_queue_struct *q,
                        printf("D %s\n", spec->path);
                else {
                        struct object *object = lookup_object(spec->sha1);
-                       printf("M 0%06o :%d %s\n", spec->mode,
+                       printf("M %06o :%d %s\n", spec->mode,
                               get_object_mark(object), spec->path);
                }
        }
index e1393b8d1e74c03ff2b45ec93e268daa2e286fd8..ff6e87777ae4c2a883db3836cb9acfee31a7281d 100644 (file)
@@ -29,27 +29,6 @@ static void safe_create_dir(const char *dir, int share)
                die("Could not make %s writable by group\n", dir);
 }
 
-static int copy_file(const char *dst, const char *src, int mode)
-{
-       int fdi, fdo, status;
-
-       mode = (mode & 0111) ? 0777 : 0666;
-       if ((fdi = open(src, O_RDONLY)) < 0)
-               return fdi;
-       if ((fdo = open(dst, O_WRONLY | O_CREAT | O_EXCL, mode)) < 0) {
-               close(fdi);
-               return fdo;
-       }
-       status = copy_fd(fdi, fdo);
-       if (close(fdo) != 0)
-               return error("%s: write error: %s", dst, strerror(errno));
-
-       if (!status && adjust_shared_perm(dst))
-               return -1;
-
-       return status;
-}
-
 static void copy_templates_1(char *path, int baselen,
                             char *template, int template_baselen,
                             DIR *dir)
index c8cb63e23840915ecd7445d1fe4a18f9c6cb694d..9f727c00f689ae23373502c7fb21b2234a1c1748 100644 (file)
@@ -90,7 +90,7 @@ static int do_push(const char *repo, int flags)
                if (!err)
                        continue;
 
-               error("failed to push to '%s'", remote->url[i]);
+               error("failed to push some refs to '%s'", remote->url[i]);
                errs++;
        }
        return !!errs;
index a9e3ebc13725cbe8658478797d6e1d8e097e5292..b2971f34456d15cd155b9ac7d207602f9822d149 100644 (file)
@@ -267,23 +267,6 @@ static int diff_two(const char *file1, const char *label1,
        return 0;
 }
 
-static int copy_file(const char *src, const char *dest)
-{
-       FILE *in, *out;
-       char buffer[32768];
-       int count;
-
-       if (!(in = fopen(src, "r")))
-               return error("Could not open %s", src);
-       if (!(out = fopen(dest, "w")))
-               return error("Could not open %s", dest);
-       while ((count = fread(buffer, 1, sizeof(buffer), in)))
-               fwrite(buffer, 1, count, out);
-       fclose(in);
-       fclose(out);
-       return 0;
-}
-
 static int do_plain_rerere(struct path_list *rr, int fd)
 {
        struct path_list conflict = { NULL, 0, 0, 1 };
@@ -343,7 +326,7 @@ static int do_plain_rerere(struct path_list *rr, int fd)
                        continue;
 
                fprintf(stderr, "Recorded resolution for '%s'.\n", path);
-               copy_file(path, rr_path(name, "postimage"));
+               copy_file(rr_path(name, "postimage"), path, 0666);
 tail_optimization:
                if (i < rr->nr - 1)
                        memmove(rr->items + i,
index b9af1a5a554e21338531b88cd34bcb767d5f3848..90dbb9d7c1a28fd463ba827cb8da2eab42e489df 100644 (file)
@@ -315,7 +315,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
                s = strchr(sb.buf, ' ');
                if (!s || *sb.buf == ' ') {
                        o->type = OPTION_GROUP;
-                       o->help = xstrdup(skipspaces(s));
+                       o->help = xstrdup(skipspaces(sb.buf));
                        continue;
                }
 
diff --git a/cache.h b/cache.h
index 43ba6a3ba568fb0b9e93c8aeb78782e12bfda416..98cfed63ee7f11ef647474057077fdb4e669a376 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -602,6 +602,7 @@ extern const char *git_log_output_encoding;
 /* IO helper functions */
 extern void maybe_flush_or_die(FILE *, const char *);
 extern int copy_fd(int ifd, int ofd);
+extern int copy_file(const char *dst, const char *src, int mode);
 extern int read_in_full(int fd, void *buf, size_t count);
 extern int write_in_full(int fd, const void *buf, size_t count);
 extern void write_or_die(int fd, const void *buf, size_t count);
diff --git a/copy.c b/copy.c
index c225d1b0ff0a67e637f7200ab5c2a917b550af4f..afc4fbf41405d42d2751ea35ec7a9a32f8df6274 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -34,3 +34,24 @@ int copy_fd(int ifd, int ofd)
        close(ifd);
        return 0;
 }
+
+int copy_file(const char *dst, const char *src, int mode)
+{
+       int fdi, fdo, status;
+
+       mode = (mode & 0111) ? 0777 : 0666;
+       if ((fdi = open(src, O_RDONLY)) < 0)
+               return fdi;
+       if ((fdo = open(dst, O_WRONLY | O_CREAT | O_EXCL, mode)) < 0) {
+               close(fdi);
+               return fdo;
+       }
+       status = copy_fd(fdi, fdo);
+       if (close(fdo) != 0)
+               return error("%s: write error: %s", dst, strerror(errno));
+
+       if (!status && adjust_shared_perm(dst))
+               return -1;
+
+       return status;
+}
diff --git a/date.c b/date.c
index 8f7050027053a4e2390097e341327b117404c26a..a74ed86422763e7d7e5dccf73530e52551a6929a 100644 (file)
--- a/date.c
+++ b/date.c
@@ -213,9 +213,9 @@ static const struct {
        { "EAST", +10, 0, },    /* Eastern Australian Standard */
        { "EADT", +10, 1, },    /* Eastern Australian Daylight */
        { "GST",  +10, 0, },    /* Guam Standard, USSR Zone 9 */
-       { "NZT",  +11, 0, },    /* New Zealand */
-       { "NZST", +11, 0, },    /* New Zealand Standard */
-       { "NZDT", +11, 1, },    /* New Zealand Daylight */
+       { "NZT",  +12, 0, },    /* New Zealand */
+       { "NZST", +12, 0, },    /* New Zealand Standard */
+       { "NZDT", +12, 1, },    /* New Zealand Daylight */
        { "IDLE", +12, 0, },    /* International Date Line East */
 };
 
diff --git a/diff.c b/diff.c
index 39f6e21aa39db53b3d72cb221156b92267272033..76ba5f4afc162d6cbc31bfaa6cb1875a3975833e 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -272,8 +272,8 @@ static void print_line_count(int count)
        }
 }
 
-static void copy_file(int prefix, const char *data, int size,
-               const char *set, const char *reset)
+static void copy_file_with_prefix(int prefix, const char *data, int size,
+                                 const char *set, const char *reset)
 {
        int ch, nl_just_seen = 1;
        while (0 < size--) {
@@ -331,9 +331,9 @@ static void emit_rewrite_diff(const char *name_a,
        print_line_count(lc_b);
        printf(" @@%s\n", reset);
        if (lc_a)
-               copy_file('-', one->data, one->size, old, reset);
+               copy_file_with_prefix('-', one->data, one->size, old, reset);
        if (lc_b)
-               copy_file('+', two->data, two->size, new, reset);
+               copy_file_with_prefix('+', two->data, two->size, new, reset);
 }
 
 static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one)
index b4e858c3885dab55398670d9497304eb83545d1f..0d686c3a03a15d73e086d3a54afeee269365ffcd 100755 (executable)
@@ -409,11 +409,12 @@ else
        cd "$D" || exit
 fi
 
-if test -z "$bare" && test -f "$GIT_DIR/REMOTE_HEAD"
+if test -z "$bare"
 then
        # a non-bare repository is always in separate-remote layout
        remote_top="refs/remotes/$origin"
-       head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
+       head_sha1=
+       test ! -r "$GIT_DIR/REMOTE_HEAD" || head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
        case "$head_sha1" in
        'ref: refs/'*)
                # Uh-oh, the remote told us (http transport done against
@@ -470,9 +471,16 @@ then
                git config branch."$head_points_at".merge "refs/heads/$head_points_at"
                ;;
        '')
-               # Source had detached HEAD pointing nowhere
-               git update-ref --no-deref HEAD "$head_sha1" &&
-               rm -f "refs/remotes/$origin/HEAD"
+               if test -z "$head_sha1"
+               then
+                       # Source had nonexistent ref in HEAD
+                       echo >&2 "Warning: Remote HEAD refers to nonexistent ref, unable to checkout."
+                       no_checkout=t
+               else
+                       # Source had detached HEAD pointing nowhere
+                       git update-ref --no-deref HEAD "$head_sha1" &&
+                       rm -f "refs/remotes/$origin/HEAD"
+               fi
                ;;
        esac
 
index ff716cabb084526ddb5655c3b7c6dd02f4ed1b39..49e13f0bb1ed2bcb6e85455f24dffa912927d67a 100755 (executable)
@@ -276,10 +276,11 @@ while read commit parents; do
                eval "$filter_tree" < /dev/null ||
                        die "tree filter failed: $filter_tree"
 
-               git diff-index -r $commit | cut -f 2- | tr '\012' '\000' | \
-                       xargs -0 git update-index --add --replace --remove
-               git ls-files -z --others | \
-                       xargs -0 git update-index --add --replace --remove
+               (
+                       git diff-index -r --name-only $commit
+                       git ls-files --others
+               ) |
+               git update-index --add --replace --remove --stdin
        fi
 
        eval "$filter_index" < /dev/null ||
index 34438cdf5cc219ac71cbc90a23c23550276f5af2..01e0a46ba56faa8a17ed8710346b18dd215899c7 100644 (file)
@@ -13,6 +13,7 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
+uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 
 SCRIPT_SH = git-gui.sh
 GITGUI_MAIN := git-gui
@@ -91,9 +92,20 @@ ifndef V
        REMOVE_F1 = && echo '   ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst"
 endif
 
-TCL_PATH   ?= tclsh
 TCLTK_PATH ?= wish
-TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
+ifeq (./,$(dir $(TCLTK_PATH)))
+       TCL_PATH ?= $(subst wish,tclsh,$(TCLTK_PATH))
+else
+       TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH)))
+endif
+
+ifeq ($(uname_S),Darwin)
+       TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
+       ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
+               TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
+       endif
+       TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
+endif
 
 ifeq ($(findstring $(MAKEFLAGS),s),s)
 QUIET_GEN =
@@ -119,7 +131,17 @@ GITGUI_MACOSXAPP :=
 
 ifeq ($(uname_O),Cygwin)
        GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
-       gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
+
+       # Is this a Cygwin Tcl/Tk binary?  If so it knows how to do
+       # POSIX path translation just like cygpath does and we must
+       # keep libdir in POSIX format so Cygwin packages of git-gui
+       # work no matter where the user installs them.
+       #
+       ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
+               gg_libdir_sed_in := $(gg_libdir)
+       else
+               gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
+       endif
 else
        ifeq ($(exedir),$(gg_libdir))
                GITGUI_RELATIVE := 1
@@ -147,7 +169,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
        echo then >>$@+ && \
        echo '  'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
        echo else >>$@+ && \
-       echo '  'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \
+       echo '  'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
                '"$$0" "$$@"' >>$@+ && \
        echo fi >>$@+ && \
        chmod +x $@+ && \
@@ -157,14 +179,15 @@ Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
                macosx/Info.plist \
                macosx/git-gui.icns \
                macosx/AppMain.tcl \
-               $(TKFRAMEWORK)/Contents/MacOS/Wish
+               $(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)
        $(QUIET_GEN)rm -rf '$@' '$@'+ && \
        mkdir -p '$@'+/Contents/MacOS && \
        mkdir -p '$@'+/Contents/Resources/Scripts && \
-       cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \
+       cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \
                '$@'+/Contents/MacOS && \
        cp macosx/git-gui.icns '$@'+/Contents/Resources && \
        sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
+               -e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \
                macosx/Info.plist \
                >'$@'+/Contents/Info.plist && \
        sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \
index f42e461fd42ad37075d433f3509d6bd415a0b97a..04bd42576eae325b848b1438f1a4ff2820645df3 100755 (executable)
@@ -662,7 +662,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
 }
 
 set _real_git_version $_git_version
-regsub -- {-dirty$} $_git_version {} _git_version
+regsub -- {[\-\.]dirty$} $_git_version {} _git_version
 regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version
 regsub {\.rc[0-9]+$} $_git_version {} _git_version
 regsub {\.GIT$} $_git_version {} _git_version
index 86faf24cc8788701983f4ff49dc407ecce6d3148..0adcf9d958b76b5a52386effe6afbca95f0abaf9 100644 (file)
@@ -11,6 +11,7 @@ field w_quit      ; # Quit button
 field o_cons      ; # Console object (if active)
 field w_types     ; # List of type buttons in clone
 field w_recentlist ; # Listbox containing recent repositories
+field w_localpath  ; # Entry widget bound to local_path
 
 field done              0 ; # Finished picking the repository?
 field local_path       {} ; # Where this repository is locally
@@ -385,6 +386,7 @@ method _do_new {} {
        button $w_body.where.b \
                -text [mc "Browse"] \
                -command [cb _new_local_path]
+       set w_localpath $w_body.where.t
 
        pack $w_body.where.b -side right
        pack $w_body.where.l -side left
@@ -416,6 +418,7 @@ method _new_local_path {} {
                return
        }
        set local_path $p
+       $w_localpath icursor end
 }
 
 method _do_new2 {} {
@@ -481,6 +484,7 @@ method _do_clone {} {
                -text [mc "Browse"] \
                -command [cb _new_local_path]
        grid $args.where_l $args.where_t $args.where_b -sticky ew
+       set w_localpath $args.where_t
 
        label $args.type_l -text [mc "Clone Type:"]
        frame $args.type_f
index 0fdd7531dac07e68315cebc2efa87e99947821b6..08a24622c7ff199399805ef34f0396f6cb81613c 100644 (file)
@@ -1,6 +1,14 @@
 # git-gui branch (create/delete) support
 # Copyright (C) 2006, 2007 Shawn Pearce
 
+proc _error_parent {} {
+       set p [grab current .]
+       if {$p eq {}} {
+               return .
+       }
+       return $p
+}
+
 proc error_popup {msg} {
        set title [appname]
        if {[reponame] ne {}} {
@@ -11,8 +19,8 @@ proc error_popup {msg} {
                -type ok \
                -title [append "$title: " [mc "error"]] \
                -message $msg]
-       if {[winfo ismapped .]} {
-               lappend cmd -parent .
+       if {[winfo ismapped [_error_parent]]} {
+               lappend cmd -parent [_error_parent]
        }
        eval $cmd
 }
@@ -27,13 +35,13 @@ proc warn_popup {msg} {
                -type ok \
                -title [append "$title: " [mc "warning"]] \
                -message $msg]
-       if {[winfo ismapped .]} {
-               lappend cmd -parent .
+       if {[winfo ismapped [_error_parent]]} {
+               lappend cmd -parent [_error_parent]
        }
        eval $cmd
 }
 
-proc info_popup {msg {parent .}} {
+proc info_popup {msg} {
        set title [appname]
        if {[reponame] ne {}} {
                append title " ([reponame])"
@@ -56,8 +64,8 @@ proc ask_popup {msg} {
                -type yesno \
                -title $title \
                -message $msg]
-       if {[winfo ismapped .]} {
-               lappend cmd -parent .
+       if {[winfo ismapped [_error_parent]]} {
+               lappend cmd -parent [_error_parent]
        }
        eval $cmd
 }
index 99913ec57a346ad996fefa2d3f1f51be3265170b..b3bf15fa1c1a41265460664417caf47265553a4f 100644 (file)
@@ -5,7 +5,7 @@
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
-       <string>Wish</string>
+       <string>@@GITGUI_TKEXECUTABLE@@</string>
        <key>CFBundleGetInfoString</key>
        <string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
        <key>CFBundleIconFile</key>
index a1a9d14b00d01844509a87c598314e2ffbbfa47c..8e6f3b22c83d25a46069c48c13a0eebbd2196ec2 100755 (executable)
@@ -406,7 +406,7 @@ sub expand_aliases {
 
        $initial_reply_to = $_;
 }
-if (defined $initial_reply_to && $_ ne "") {
+if (defined $initial_reply_to) {
        $initial_reply_to =~ s/^\s*<?/</;
        $initial_reply_to =~ s/>?\s*$/>/;
 }
index 3f9f88815b865cb6c405268d83f67f1b2f858f88..97a26be29a5e6e64ca33760ba0010693e0fa07f9 100644 (file)
@@ -3,7 +3,7 @@
 Name:          git
 Version:       @@VERSION@@
 Release:       1%{?dist}
-Summary:       Git core and tools
+Summary:       Core git tools
 License:       GPL
 Group:                 Development/Tools
 URL:           http://kernel.org/pub/software/scm/git/
@@ -11,80 +11,86 @@ Source:     http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
 BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel, gettext  %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-Requires:      git-core = %{version}-%{release}
-Requires:      git-svn = %{version}-%{release}
-Requires:      git-cvs = %{version}-%{release}
-Requires:      git-arch = %{version}-%{release}
-Requires:      git-email = %{version}-%{release}
-Requires:      gitk = %{version}-%{release}
-Requires:      git-gui = %{version}-%{release}
 Requires:      perl-Git = %{version}-%{release}
+Requires:      zlib >= 1.2, rsync, curl, less, openssh-clients, expat
+Provides:      git-core = %{version}-%{release}
+Obsoletes:     git-core <= 1.5.4.2
+Obsoletes:     git-p4
 
 %description
 Git is a fast, scalable, distributed revision control system with an
 unusually rich command set that provides both high-level operations
 and full access to internals.
 
-This is a dummy package which brings in all subpackages.
+The git rpm installs the core tools with minimal dependencies.  To
+install all git packages, including tools for integrating with other
+SCMs, install the git-all meta-package.
 
-%package core
-Summary:       Core git tools
+%package all
+Summary:       Meta-package to pull in all git tools
 Group:         Development/Tools
-Requires:      zlib >= 1.2, rsync, curl, less, openssh-clients, expat
-Obsoletes:     git-p4
-%description core
+Requires:      git = %{version}-%{release}
+Requires:      git-svn = %{version}-%{release}
+Requires:      git-cvs = %{version}-%{release}
+Requires:      git-arch = %{version}-%{release}
+Requires:      git-email = %{version}-%{release}
+Requires:      gitk = %{version}-%{release}
+Requires:      git-gui = %{version}-%{release}
+Obsoletes:     git <= 1.5.4.2
+
+%description all
 Git is a fast, scalable, distributed revision control system with an
 unusually rich command set that provides both high-level operations
 and full access to internals.
 
-These are the core tools with minimal dependencies.
+This is a dummy package which brings in all subpackages.
 
 %package svn
 Summary:        Git tools for importing Subversion repositories
 Group:          Development/Tools
-Requires:       git-core = %{version}-%{release}, subversion
+Requires:       git = %{version}-%{release}, subversion
 %description svn
 Git tools for importing Subversion repositories.
 
 %package cvs
 Summary:        Git tools for importing CVS repositories
 Group:          Development/Tools
-Requires:       git-core = %{version}-%{release}, cvs, cvsps
+Requires:       git = %{version}-%{release}, cvs, cvsps
 %description cvs
 Git tools for importing CVS repositories.
 
 %package arch
 Summary:        Git tools for importing Arch repositories
 Group:          Development/Tools
-Requires:       git-core = %{version}-%{release}, tla
+Requires:       git = %{version}-%{release}, tla
 %description arch
 Git tools for importing Arch repositories.
 
 %package email
 Summary:        Git tools for sending email
 Group:          Development/Tools
-Requires:      git-core = %{version}-%{release}
+Requires:      git = %{version}-%{release}
 %description email
 Git tools for sending email.
 
 %package gui
 Summary:        Git GUI tool
 Group:          Development/Tools
-Requires:       git-core = %{version}-%{release}, tk >= 8.4
+Requires:       git = %{version}-%{release}, tk >= 8.4
 %description gui
 Git GUI tool
 
 %package -n gitk
 Summary:        Git revision tree visualiser ('gitk')
 Group:          Development/Tools
-Requires:       git-core = %{version}-%{release}, tk >= 8.4
+Requires:       git = %{version}-%{release}, tk >= 8.4
 %description -n gitk
 Git revision tree visualiser ('gitk')
 
 %package -n perl-Git
 Summary:        Perl interface to Git
 Group:          Development/Libraries
-Requires:       git-core = %{version}-%{release}
+Requires:       git = %{version}-%{release}
 Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
 BuildRequires:  perl(Error)
 
@@ -121,8 +127,12 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%files
-# These are no files in the root package
+%files -f bin-man-doc-files
+%defattr(-,root,root)
+%{_datadir}/git-core/
+%doc README COPYING Documentation/*.txt
+%{!?_without_docs: %doc Documentation/*.html Documentation/howto}
+%{!?_without_docs: %doc Documentation/technical}
 
 %files svn
 %defattr(-,root,root)
@@ -173,14 +183,13 @@ rm -rf $RPM_BUILD_ROOT
 %files -n perl-Git -f perl-files
 %defattr(-,root,root)
 
-%files core -f bin-man-doc-files
-%defattr(-,root,root)
-%{_datadir}/git-core/
-%doc README COPYING Documentation/*.txt
-%{!?_without_docs: %doc Documentation/*.html Documentation/howto}
-%{!?_without_docs: %doc Documentation/technical}
+%files all
+# No files for you!
 
 %changelog
+* Fri Feb 15 2008 Kristian Høgsberg <krh@redhat.com>
+- Rename git-core to just git and rename meta package from git to git-all.
+
 * Sun Feb 03 2008 James Bowes <jbowes@dangerouslyinc.com>
 - Add a BuildRequires for gettext
 
diff --git a/hash.c b/hash.c
index 7b492d4fc039898b975a1122b4e4eb90e3eb8923..d9ec82fa663804210e8ef200f2f300e914662f22 100644 (file)
--- a/hash.c
+++ b/hash.c
@@ -70,7 +70,7 @@ void *lookup_hash(unsigned int hash, struct hash_table *table)
 {
        if (!table->array)
                return NULL;
-       return &lookup_hash_entry(hash, table)->ptr;
+       return lookup_hash_entry(hash, table)->ptr;
 }
 
 void **insert_hash(unsigned int hash, void *ptr, struct hash_table *table)
diff --git a/refs.c b/refs.c
index 67d2a502afb60050f0ce750c21ae1a42fa5cb803..fb33da111240d9a3d579dfebb05eef951fecee23 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -506,7 +506,7 @@ int peel_ref(const char *ref, unsigned char *sha1)
 
        /* fallback - callers should not call this for unpacked refs */
        o = parse_object(base);
-       if (o->type == OBJ_TAG) {
+       if (o && o->type == OBJ_TAG) {
                o = deref_tag(o, ref, 0);
                if (o) {
                        hashcpy(sha1, o->sha1);
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
new file mode 100755 (executable)
index 0000000..762af5f
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+test_description='test git rev-parse --parseopt'
+. ./test-lib.sh
+
+cat > expect.err <<EOF
+usage: some-command [options] <args>...
+    
+    some-command does foo and bar!
+
+    -h, --help            show the help
+    --foo                 some nifty option --foo
+    --bar ...             some cool option --bar with an argument
+
+An option group Header
+    -C [...]              option C with an optional argument
+
+Extras
+    --extra1              line above used to cause a segfault but no longer does
+
+EOF
+
+test_expect_success 'test --parseopt help output' '
+       git rev-parse --parseopt -- -h 2> output.err <<EOF
+some-command [options] <args>...
+
+some-command does foo and bar!
+--
+h,help    show the help
+
+foo       some nifty option --foo
+bar=      some cool option --bar with an argument
+
+ An option group Header
+C?        option C with an optional argument
+
+Extras
+extra1    line above used to cause a segfault but no longer does
+EOF
+       git diff expect.err output.err
+'
+
+test_done
index 636aec2f7139cad63591d64e8c89e82d2ed4760b..4fc62f550cbced0f1e257fa5057e43f4c54ed5dd 100755 (executable)
@@ -4,9 +4,6 @@ test_description='git remote porcelain-ish'
 
 . ./test-lib.sh
 
-GIT_CONFIG=.git/config
-export GIT_CONFIG
-
 setup_repository () {
        mkdir "$1" && (
        cd "$1" &&
index 822ac8c28e112dc1da61cb7fecdab1b4f25717ec..59a165a6d44190a1ce9ef9575dc6c8a2ce9f4efb 100755 (executable)
@@ -63,4 +63,12 @@ test_expect_success 'Even without -l, local will make a hardlink' '
        test 0 = $copied
 '
 
+test_expect_success 'local clone of repo with nonexistent ref in HEAD' '
+       cd "$D" &&
+       echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
+       git clone a d &&
+       cd d &&
+       git fetch &&
+       test ! -e .git/refs/remotes/origin/HEAD'
+
 test_done
index 5f60b22d872b5d034e137e0c6c7c5a9d664e57ee..868babc4b2350526192a8df53f6cbec3f81c644e 100755 (executable)
@@ -165,4 +165,18 @@ test_expect_success '"map" works in commit filter' '
        git rev-parse --verify master
 '
 
+test_expect_success 'Name needing quotes' '
+
+       git checkout -b rerere A &&
+       mkdir foo &&
+       name="れれれ" &&
+       >foo/$name &&
+       git add foo &&
+       git commit -m "Adding a file" &&
+       git filter-branch --tree-filter "rm -fr foo" &&
+       ! git ls-files --error-unmatch "foo/$name" &&
+       test $(git rev-parse --verify rerere) != $(git rev-parse --verify A)
+
+'
+
 test_done
index b64ce30ff1c28a44b24eb6dd07a2cd9e260e0326..e00607490bcb0439c6557003a3419d84823a8f00 100755 (executable)
@@ -128,4 +128,25 @@ test_expect_success 'status without relative paths' '
 
 '
 
+cat <<EOF >expect
+# On branch master
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#      modified:   dir1/modified
+#
+# Untracked files:
+#   (use "git add <file>..." to include in what will be committed)
+#
+#      dir1/untracked
+#      dir2/
+#      expect
+#      output
+#      untracked
+EOF
+test_expect_success 'status of partial commit excluding new file in index' '
+       git status dir1/modified >output &&
+       diff -u expect output
+'
+
 test_done