]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge branch 'sp/describe-lwtag'
authorJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:06:39 +0000 (16:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:06:39 +0000 (16:06 -0700)
* sp/describe-lwtag:
  describe: Make --tags and --all match lightweight tags more often

28 files changed:
Documentation/RelNotes-1.6.0.3.txt
Documentation/RelNotes-1.6.1.txt
Documentation/diff-options.txt
Documentation/git-check-attr.txt
Documentation/git-checkout.txt
Documentation/git-commit.txt
Documentation/git-rebase.txt
Documentation/gittutorial-2.txt
branch.c
builtin-checkout.c
builtin-commit.c
builtin-merge.c
contrib/examples/git-remote.perl
contrib/hooks/pre-auto-gc-battery
contrib/stats/packinfo.pl
git-rebase--interactive.sh
git-rebase.sh
index-pack.c
merge-recursive.c
remote.c
sha1_file.c
t/t1301-shared-repo.sh
t/t3409-rebase-hook.sh
t/t3409-rebase-preserve-merges.sh [new file with mode: 0755]
t/t4018-diff-funcname.sh
t/t4128-apply-root.sh
t/t7600-merge.sh
xdiff-interface.c

index 6cf8ae4ea1423d3dce3522890a666a424d163fb7..c0f037d6dbe4cfa98ea97a9b28d115e34ccfde75 100644 (file)
@@ -16,12 +16,20 @@ Fixes since v1.6.0.2
 * "git rebase -i" now honors the pre-rebase hook, just like the
   other rebase implementations "git rebase" and "git rebase -m".
 
+* "git rebase -i" incorrectly aborted when there is no commit to replay.
+
 * Behaviour of "git diff --quiet" was inconsistent with "diff --exit-code"
   with the output redirected to /dev/null.
 
 * "git diff --no-index" on binary files no longer outputs a bogus
   "diff --git" header line.
 
+* "git diff" hunk header patterns with multiple elements separated by LF
+  were not used correctly.
+
+* "git gc" when ejecting otherwise unreachable objects from packfiles into
+  loose form leaked memory.
+
 * Hunk headers in "git diff" default to using extended regular
   expressions, fixing some of the internal patterns on non-GNU
   platforms.
@@ -29,6 +37,9 @@ Fixes since v1.6.0.2
 * New config "diff.*.xfuncname" exposes extended regular expressions
   for user specified hunk header patterns.
 
+* "git index-pack" was recently broken and mishandled objects added by
+  thin-pack completion processing under memory pressure.
+
 * "git stash apply sash@{1}" was fixed to error out.  Prior versions
   would have applied stash@{0} incorrectly.
 
@@ -42,6 +53,8 @@ Fixes since v1.6.0.2
 
 * "git remote show -v" now displays all URLs of a remote.
 
+* "git checkout -b branch" was confused when branch already existed.
+
 * "git checkout -q" once again suppresses the locally modified file list.
 
 * "git clone -q", "git fetch -q" asks remote side to not send
@@ -56,9 +69,15 @@ Fixes since v1.6.0.2
 * "git merge" once again removes directories after the last file has
   been removed from it during the merge.
 
+* "git merge" did not allocate enough memory for the structure itself when
+  enumerating the parents of the resulting commit.
+
 * "git blame -C -C" no longer segfaults while trying to pass blame if
    it encounters a submodule reference.
 
+* "git rm" incorrectly claimed that you have local modifications when a
+  path was merely stat-dirty.
+
 * "git svn" fixed to display an error message when 'set-tree' failed,
    instead of a Perl compile error.
 
@@ -68,10 +87,16 @@ Fixes since v1.6.0.2
 * The "git commit" error message when there are still unmerged
   files present was clarified to match "git write-tree".
 
+* "git init" was confused when core.bare or core.sharedRepository are set
+  in system or user global configuration file by mistake.  When --bare or
+  --shared is given from the command line, these now override such
+  settings made outside the repositories.
+
 * Some segfaults due to uncaught NULL pointers were fixed in multiple
   tools such as apply, reset, update-index.
 
-* Solaris builds now default to OLD_ICONV=1 to avoid compile warnings.
+* Solaris builds now default to OLD_ICONV=1 to avoid compile warnings;
+  Solaris 8 does not define NEEDS_LIBICONV by default.
 
 * "Git.pm" tests relied on unnecessarily more recent version of Perl.
 
@@ -90,6 +115,6 @@ Many other documentation updates.
 
 --
 exec >/var/tmp/1
-O=v1.6.0.2-76-gd70b4a8
+O=v1.6.0.2-110-gf07c3c5
 echo O=$(git describe maint)
 git shortlog --no-merges $O..maint
index 906932cfa1a51c6cd0c7098eabd067b6698b7fa4..afd1150eaa4fc17600dd948f8d7dc4ec266aa162 100644 (file)
@@ -16,13 +16,16 @@ on.
 * gitk can call out to git-gui to view "git blame" output; git-gui in turn
   can run gitk from its blame view.
 
-(portability)
+* Various git-gui updates including updated translations.
+
+* Various gitweb updates from repo.or.cz installation.
 
-* ...
+(portability)
 
-(documentation)
+* A few test scripts used nonportable "grep" that did not work well on
+  some platforms, e.g. Solaris.
 
-* ...
+* Sample pre-auto-gc script has OS X support.
 
 (performance)
 
@@ -35,6 +38,14 @@ on.
 * Bash completion of refnames in a repository with massive number of
   refs has been optimized.
 
+* Cygwin port uses native stat/lstat implementations when applicable,
+  which leads to improved performance.
+
+* "git push" pays attention to alternate repositories to avoid sending
+  unnecessary objects.
+
+* "git svn" can rebuild an out-of-date rev_map file.
+
 (usability, bells and whistles)
 
 * When you mistype a command name, git helpfully suggests what it guesses
@@ -42,6 +53,12 @@ on.
   to a non-zero value to accept the suggestion when git can uniquely
   guess.
 
+* "git add -N path..." adds the named paths as an empty blob, so that
+  subsequent "git diff" will show a diff as if they are creation events.
+
+* "git apply" learned --include=paths option, similar to the existing
+  --exclude=paths option.
+
 * "git bisect" is careful about a user mistake and suggests testing of
   merge base first when good is not a strict ancestor of bad.
 
@@ -49,11 +66,20 @@ on.
   DWIMs to create a corresponding local branch "hack", i.e. acts as if you
   said "git checkout --track -b hack origin/hack".
 
+* "git checkout --ours/--theirs" can be used to check out one side of a
+  conflicting merge during conflict resolution.
+
+* "git checkout -m" can be used to recreate the initial conflicted state
+  during conflict resolution.
+
 * "git cherry-pick" can also utilize rerere for conflict resolution.
 
 * "git commit --author=$name" can look up author name from existing
   commits.
 
+* output from "git commit" has been reworded in a more concise and yet
+  more informative way.
+
 * "git count-objects" reports the on-disk footprint for packfiles and
   their corresponding idx files.
 
@@ -62,15 +88,22 @@ on.
 * "git diff" learned to mimic --suppress-blank-empty from GNU diff via a
   configuration option.
 
-* "git diff" learned to put more sensible hunk headers for Python and
-  HTML contents.
+* "git diff" learned to put more sensible hunk headers for Python,
+  HTML and ObjC contents.
 
 * "git diff" learned to vary the a/ vs b/ prefix depending on what are
   being compared, controlled by diff.mnemonicprefix configuration.
 
+* "git diff" learned --dirstat-by-file to count changed files, not number
+  of lines, when summarizing the global picture.
+
+* "git diff" hunk header pattern for ObjC has been added.
+
 * "git for-each-ref" learned "refname:short" token that gives an
   unambiguously abbreviated refname.
 
+* "git grep" learned to accept -z similar to GNU grep.
+
 * "git help" learned to use GIT_MAN_VIEWER environment variable before
   using "man" program.
 
@@ -103,12 +136,18 @@ on.
 * "git submodule sync" subcommands allows you to update the origin URL
   recorded in submodule directories from the toplevel .gitmodules file.
 
+* "git svn branch" can create new branches on the other end.
+
 (internal)
 
 * "git hash-object" learned to lie about the path being hashed, so that
   correct gitattributes processing can be done while hashing contents
   stored in a temporary file.
 
+* various callers of git-merge-recursive avoid forking it as an external
+  process.
+
+
 Fixes since v1.6.0
 ------------------
 
@@ -124,6 +163,11 @@ release, unless otherwise noted.
   but we dropped support for such a use case long time ago.  This has
   been resurrected.
 
+* Giving 3 or more tree-ish to "git diff" is supposed to show the combined
+  diff from second and subsequent trees to the first one.  b75271d ("git
+  diff <tree>{3,}": do not reverse order of arguments, 2008-10-10) needs
+  to be cherry-picked to 'maint'.
+
 * "git filter-branch" failed to rewrite a tag name with slashes in it.
 
 * "git push --tags --all $there" failed with generic usage message without
@@ -135,6 +179,6 @@ release, unless otherwise noted.
 
 --
 exec >/var/tmp/1
-O=v1.6.0.2-295-g34a5d35
+O=v1.6.0.2-553-g58e0fa5
 echo O=$(git describe master)
 git shortlog --no-merges $O..master ^maint
index 7788d4fa4a1209cbed564a20f882f0946ba400cf..c62b45cdbade990878b8e8e9371d41d4e3c43bfe 100644 (file)
@@ -137,7 +137,8 @@ endif::git-format-patch[]
 --diff-filter=[ACDMRTUXB*]::
        Select only files that are Added (`A`), Copied (`C`),
        Deleted (`D`), Modified (`M`), Renamed (`R`), have their
-       type (mode) changed (`T`), are Unmerged (`U`), are
+       type (i.e. regular file, symlink, submodule, ...) changed (`T`),
+       are Unmerged (`U`), are
        Unknown (`X`), or have had their pairing Broken (`B`).
        Any combination of the filter characters may be used.
        When `*` (All-or-none) is added to the combination, all
index 2b821f2a1d70fa108ce279135fd5028453a04fd9..4b3c2b0b06e9821124759d0cc6240d0a1953d2fa 100644 (file)
@@ -22,6 +22,56 @@ OPTIONS
        arguments as path names. If not supplied, only the first argument will
        be treated as an attribute.
 
+OUTPUT
+------
+
+The output is of the form:
+<path> COLON SP <attribute> COLON SP <info> LF
+
+Where <path> is the path of a file being queried, <attribute> is an attribute
+being queried and <info> can be either:
+
+'unspecified';; when the attribute is not defined for the path.
+'unset';;      when the attribute is defined to false.
+'set';;                when the attribute is defined to true.
+<value>;;      when a value has been assigned to the attribute.
+
+EXAMPLES
+--------
+
+In the examples, the following '.gitattributes' file is used:
+---------------
+*.java diff=java -crlf myAttr
+NoMyAttr.java !myAttr
+README caveat=unspecified
+---------------
+
+* Listing a single attribute:
+---------------
+$ git check-attr diff org/example/MyClass.java
+org/example/MyClass.java: diff: java
+---------------
+
+* Listing multiple attributes for a file:
+---------------
+$ git check-attr crlf diff myAttr -- org/example/MyClass.java
+org/example/MyClass.java: crlf: unset
+org/example/MyClass.java: diff: java
+org/example/MyClass.java: myAttr: set
+---------------
+
+* Listing attribute for multiple files:
+---------------
+$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
+org/example/MyClass.java: myAttr: set
+org/example/NoMyAttr.java: myAttr: unspecified
+---------------
+
+* Not all values are equally unambiguous:
+---------------
+$ git check-attr caveat README
+README: caveat: unspecified
+---------------
 
 SEE ALSO
 --------
index 82e154de4970c1c2cb35335591cfe457e80a89c1..168333a588e0828d2d14687774fd41cc57f43721 100644 (file)
@@ -88,7 +88,7 @@ This would tell us to use "hack" as the local branch when branching
 off of "origin/hack" (or "remotes/origin/hack", or even
 "refs/remotes/origin/hack").  If the given name has no slash, or the above
 guessing results in an empty name, the guessing is aborted.  You can
-exlicitly give a name with '-b' in such a case.
+explicitly give a name with '-b' in such a case.
 
 --no-track::
        Ignore the branch.autosetupmerge configuration variable.
index eb05b0f49b0c513581150415d1a4e679d7bfbea6..41809eecab9750746d2df4a0e148f09796e90224 100644 (file)
@@ -94,7 +94,8 @@ OPTIONS
 
 -s::
 --signoff::
-       Add Signed-off-by line at the end of the commit message.
+       Add Signed-off-by line by the commiter at the end of the commit
+       log message.
 
 -n::
 --no-verify::
index 32f0f122e937aab6b248d0ed86fa09854dbe253d..d639985693705930cba6f078b0bd1f8b61b65da4 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git rebase' [-i | --interactive] [-v | --verbose] [-m | --merge]
-       [-s <strategy> | --strategy=<strategy>]
+       [-s <strategy> | --strategy=<strategy>] [--no-verify]
        [-C<n>] [ --whitespace=<option>] [-p | --preserve-merges]
        [--onto <newbase>] <upstream> [<branch>]
 'git rebase' --continue | --skip | --abort
@@ -232,6 +232,9 @@ OPTIONS
 --verbose::
        Display a diffstat of what changed upstream since the last rebase.
 
+--no-verify::
+       This option bypasses the pre-rebase hook.  See also linkgit:githooks[5].
+
 -C<n>::
        Ensure at least <n> lines of surrounding context match before
        and after each change.  When fewer lines of surrounding
@@ -250,8 +253,7 @@ OPTIONS
 
 -p::
 --preserve-merges::
-       Instead of ignoring merges, try to recreate them.  This option
-       only works in interactive mode.
+       Instead of ignoring merges, try to recreate them.
 
 include::merge-strategies.txt[]
 
index 660904686c656fd00078aa272d0b9a5a198e1833..bab0f34b452bfab7174d216700b46220e3a4d2c3 100644 (file)
@@ -32,22 +32,27 @@ Initialized empty Git repository in .git/
 $ echo 'hello world' > file.txt
 $ git add .
 $ git commit -a -m "initial commit"
-Created initial commit 54196cc2703dc165cbd373a65a4dcf22d50ae7f7
+[master (root-commit)] created 54196cc: "initial commit"
+ 1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 file.txt
 $ echo 'hello world!' >file.txt
 $ git commit -a -m "add emphasis"
-Created commit c4d59f390b9cfd4318117afde11d601c1085f241
+[master] created c4d59f3: "add emphasis"
+ 1 files changed, 1 insertions(+), 1 deletions(-)
 ------------------------------------------------
 
-What are the 40 digits of hex that git responded to the commit with?
+What are the 7 digits of hex that git responded to the commit with?
 
 We saw in part one of the tutorial that commits have names like this.
 It turns out that every object in the git history is stored under
-such a 40-digit hex name.  That name is the SHA1 hash of the object's
+a 40-digit hex name.  That name is the SHA1 hash of the object's
 contents; among other things, this ensures that git will never store
 the same data twice (since identical data is given an identical SHA1
 name), and that the contents of a git object will never change (since
-that would change the object's name as well).
+that would change the object's name as well). The 7 char hex strings
+here are simply the abbreviation of such 40 character long strings.
+Abbreviations can be used everywhere where the 40 character strings
+can be used, so long as they are unambiguous.
 
 It is expected that the content of the commit object you created while
 following the example above generates a different SHA1 hash than
index b1e59f2196b933ab7169a30efc5d1d340f8f9c5c..205b89dc697eb4475355ab5b2a6528e404901c0c 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -168,5 +168,6 @@ void remove_branch_state(void)
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_RR"));
        unlink(git_path("MERGE_MSG"));
+       unlink(git_path("MERGE_MODE"));
        unlink(git_path("SQUASH_MSG"));
 }
index ad04a184a28b7cdbb5278cda9c467a2e37b0add8..57b94d282931187a0cb6394d4df707237038a7eb 100644 (file)
@@ -635,9 +635,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                git_xmerge_config("merge.conflictstyle", conflict_style, NULL);
        }
 
-       if (!opts.new_branch && (opts.track != git_branch_track))
-               die("git checkout: --track and --no-track require -b");
-
        if (opts.force && opts.merge)
                die("git checkout: -f and -m are incompatible");
 
index a2755dc3befeb5ed768f692ee58e5147ad933e26..33b659edce478fb0d3d4bb723e4f54c13db0efb1 100644 (file)
@@ -879,6 +879,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 {
        struct rev_info rev;
        struct commit *commit;
+       static const char *format = "format:%h: \"%s\"";
+       unsigned char junk_sha1[20];
+       const char *head = resolve_ref("HEAD", junk_sha1, 0, NULL);
 
        commit = lookup_commit(sha1);
        if (!commit)
@@ -896,18 +899,24 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 
        rev.verbose_header = 1;
        rev.show_root_diff = 1;
-       get_commit_format("format:%h: %s", &rev);
+       get_commit_format(format, &rev);
        rev.always_show_header = 0;
        rev.diffopt.detect_rename = 1;
        rev.diffopt.rename_limit = 100;
        rev.diffopt.break_opt = 0;
        diff_setup_done(&rev.diffopt);
 
-       printf("Created %scommit ", initial_commit ? "initial " : "");
+       printf("[%s%s]: created ",
+               !prefixcmp(head, "refs/heads/") ?
+                       head + 11 :
+                       !strcmp(head, "HEAD") ?
+                               "detached HEAD" :
+                               head,
+               initial_commit ? " (root-commit)" : "");
 
        if (!log_tree_commit(&rev, commit)) {
                struct strbuf buf = STRBUF_INIT;
-               format_commit_message(commit, "%h: %s", &buf, DATE_NORMAL);
+               format_commit_message(commit, format + 7, &buf, DATE_NORMAL);
                printf("%s\n", buf.buf);
                strbuf_release(&buf);
        }
@@ -934,6 +943,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
        unsigned char commit_sha1[20];
        struct ref_lock *ref_lock;
        struct commit_list *parents = NULL, **pptr = &parents;
+       struct stat statbuf;
+       int allow_fast_forward = 1;
 
        git_config(git_commit_config, NULL);
 
@@ -980,13 +991,22 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                }
                fclose(fp);
                strbuf_release(&m);
+               if (!stat(git_path("MERGE_MODE"), &statbuf)) {
+                       if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
+                               die("could not read MERGE_MODE: %s",
+                                               strerror(errno));
+                       if (!strcmp(sb.buf, "no-ff"))
+                               allow_fast_forward = 0;
+               }
+               if (allow_fast_forward)
+                       parents = reduce_heads(parents);
        } else {
                reflog_msg = "commit";
                pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
        }
-       parents = reduce_heads(parents);
 
        /* Finally, get the commit message */
+       strbuf_reset(&sb);
        if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
                rollback_index_files();
                die("could not read commit message");
@@ -1035,6 +1055,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_MSG"));
+       unlink(git_path("MERGE_MODE"));
        unlink(git_path("SQUASH_MSG"));
 
        if (commit_index_files())
index 5e2b7f12c35ab1bfebda66f7ee9180c68e7f23c4..5e7910bd8da0a603dd82e7502c28a603bf80fa82 100644 (file)
@@ -179,6 +179,7 @@ static void drop_save(void)
 {
        unlink(git_path("MERGE_HEAD"));
        unlink(git_path("MERGE_MSG"));
+       unlink(git_path("MERGE_MODE"));
 }
 
 static void save_state(void)
@@ -1210,6 +1211,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
                        merge_msg.len)
                        die("Could not write to %s", git_path("MERGE_MSG"));
                close(fd);
+               fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT | O_TRUNC, 0666);
+               if (fd < 0)
+                       die("Could open %s for writing", git_path("MERGE_MODE"));
+               strbuf_reset(&buf);
+               if (!allow_fast_forward)
+                       strbuf_addf(&buf, "no-ff");
+               if (write_in_full(fd, buf.buf, buf.len) != buf.len)
+                       die("Could not write to %s", git_path("MERGE_MODE"));
+               close(fd);
        }
 
        if (merge_was_ok) {
index 36bd54c985080f8dd5558a3e7a4e19ede9fbab93..b17952a785d9e45dea8a71c211f76f0271e659da 100755 (executable)
@@ -309,7 +309,7 @@ sub update_remote {
                        }
                }
        } else {
-               print STDERR "Remote group $name does not exists.\n";
+               print STDERR "Remote group $name does not exist.\n";
                exit(1);
        }
        for (@remotes) {
index b0a8caae9e7822fd4ea5c6e9b202373b2947e6af..1f914c94aa748f57bd6c70fdd18dfb681c684556 100644 (file)
@@ -28,6 +28,9 @@ elif grep -q 'on-line' /proc/acpi/ac_adapter/AC/state 2>/dev/null
 then
        exit 0
 elif grep -q '0x01$' /proc/apm 2>/dev/null
+then
+       exit 0
+elif grep -q "AC Power \+: 1" /proc/pmu/info 2>/dev/null
 then
        exit 0
 elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |
index f4a7b62cd9f1a397118b95792c04c2f70f910f9e..be188c0f11dbea8320737b4fdf426a2f5acd1a00 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl
 #
 # This tool will print vaguely pretty information about a pack.  It
-# expects the output of "git-verify-pack -v" as input on stdin.
+# expects the output of "git verify-pack -v" as input on stdin.
 #
-# $ git-verify-pack -v | packinfo.pl
+# $ git verify-pack -v | packinfo.pl
 #
 # This prints some full-pack statistics; currently "all sizes", "all
 # path sizes", "tree sizes", "tree path sizes", and "depths".
@@ -20,7 +20,7 @@
 #
 # When run as:
 #
-# $ git-verify-pack -v | packinfo.pl -tree
+# $ git verify-pack -v | packinfo.pl -tree
 #
 # the trees of objects are output along with the stats.  This looks
 # like:
@@ -43,7 +43,7 @@
 #
 # When run as:
 #
-# $ git-verify-pack -v | packinfo.pl -tree -filenames
+# $ git verify-pack -v | packinfo.pl -tree -filenames
 #
 # it adds filenames to the tree.  Getting this information is slow:
 #
@@ -58,7 +58,7 @@
 #
 # When run as:
 #
-# $ git-verify-pack -v | packinfo.pl -dump
+# $ git verify-pack -v | packinfo.pl -dump
 #
 # it prints out "sha1 size pathsize depth" for each sha1 in lexical
 # order.
@@ -106,7 +106,7 @@ while (<STDIN>) {
 }
 
 if ($filenames && ($tree || $dump)) {
-    open(NAMES, "git-name-rev --all|");
+    open(NAMES, "git name-rev --all|");
     while (<NAMES>) {
         if (/^(\S+)\s+(.*)$/) {
             my ($sha1, $name) = ($1, $2);
@@ -117,7 +117,7 @@ if ($filenames && ($tree || $dump)) {
 
     for my $commit (@commits) {
         my $name = $names{$commit};
-        open(TREE, "git-ls-tree -t -r $commit|");
+        open(TREE, "git ls-tree -t -r $commit|");
         print STDERR "Plumbing tree $name\n";
         while (<TREE>) {
             if (/^(\S+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
index 124cb5846b07ee9aa72fac4cbb88098c94f5741a..86290f63b25f921de5c78b087e111e6b872676fb 100755 (executable)
@@ -26,6 +26,7 @@ i,interactive      always used (no-op)
 continue           continue rebasing process
 abort              abort rebasing process and restore original branch
 skip               skip current patch and continue rebasing process
+no-verify          override pre-rebase hook from stopping the operation
 "
 
 . git-sh-setup
@@ -41,6 +42,7 @@ PRESERVE_MERGES=
 STRATEGY=
 ONTO=
 VERBOSE=
+OK_TO_SKIP_PRE_REBASE=
 
 GIT_CHERRY_PICK_HELP="  After resolving the conflicts,
 mark the corrected paths with 'git add <paths>', and
@@ -66,7 +68,8 @@ output () {
 }
 
 run_pre_rebase_hook () {
-       if test -x "$GIT_DIR/hooks/pre-rebase"
+       if test -z "$OK_TO_SKIP_PRE_REBASE" &&
+          test -x "$GIT_DIR/hooks/pre-rebase"
        then
                "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
                        echo >&2 "The pre-rebase hook refused to rebase."
@@ -421,6 +424,11 @@ get_saved_options () {
 while test $# != 0
 do
        case "$1" in
+       --no-verify)
+               OK_TO_SKIP_PRE_REBASE=yes
+               ;;
+       --verify)
+               ;;
        --continue)
                is_standalone "$@" || usage
                get_saved_options
index a30d40c0056dc32aa6123adc9856e649c469fcd0..023a6dc94a48f7abf2801359ad68d40909e9b6aa 100755 (executable)
@@ -34,6 +34,7 @@ set_reflog_action rebase
 require_work_tree
 cd_to_toplevel
 
+OK_TO_SKIP_PRE_REBASE=
 RESOLVEMSG="
 When you have resolved this problem run \"git rebase --continue\".
 If you would prefer to skip this patch, instead run \"git rebase --skip\".
@@ -138,14 +139,31 @@ finish_rb_merge () {
 }
 
 is_interactive () {
-       test -f "$dotest"/interactive ||
-       while :; do case $#,"$1" in 0,|*,-i|*,--interactive) break ;; esac
+       while test $# != 0
+       do
+               case "$1" in
+                       -i|--interactive)
+                               interactive_rebase=explicit
+                               break
+                       ;;
+                       -p|--preserve-merges)
+                               interactive_rebase=implied
+                       ;;
+               esac
                shift
-       done && test -n "$1"
+       done
+
+       if [ "$interactive_rebase" = implied ]; then
+               GIT_EDITOR=:
+               export GIT_EDITOR
+       fi
+
+       test -n "$interactive_rebase" || test -f "$dotest"/interactive
 }
 
 run_pre_rebase_hook () {
-       if test -x "$GIT_DIR/hooks/pre-rebase"
+       if test -z "$OK_TO_SKIP_PRE_REBASE" &&
+          test -x "$GIT_DIR/hooks/pre-rebase"
        then
                "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
                        echo >&2 "The pre-rebase hook refused to rebase."
@@ -170,6 +188,9 @@ fi
 while test $# != 0
 do
        case "$1" in
+       --no-verify)
+               OK_TO_SKIP_PRE_REBASE=yes
+               ;;
        --continue)
                test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply ||
                        die "No rebase in progress?"
index d3a4d31b4e92d69eb32d1a18ebb7be1f7470d1d1..aec11cb94066bc2d0fc75cad2b9f675c9d9bdb53 100644 (file)
@@ -790,7 +790,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                err = close(output_fd);
                if (err)
                        die("error while closing pack file: %s", strerror(errno));
-               chmod(curr_pack_name, 0444);
        }
 
        if (keep_msg) {
@@ -824,8 +823,9 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                if (move_temp_to_file(curr_pack_name, final_pack_name))
                        die("cannot store pack file");
        }
+       if (from_stdin)
+               chmod(final_pack_name, 0444);
 
-       chmod(curr_index_name, 0444);
        if (final_index_name != curr_index_name) {
                if (!final_index_name) {
                        snprintf(name, sizeof(name), "%s/pack/pack-%s.idx",
@@ -835,6 +835,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                if (move_temp_to_file(curr_index_name, final_index_name))
                        die("cannot store index file");
        }
+       chmod(final_index_name, 0444);
 
        if (!from_stdin) {
                printf("%s\n", sha1_to_hex(sha1));
index 245232a4083bbd8cdadf3b32a0a20db559941f8a..7472d3ecc9b8412a697a64c1307259a104e0abf9 100644 (file)
@@ -1332,7 +1332,7 @@ static int merge_recursive_config(const char *var, const char *value, void *cb)
                o->merge_rename_limit = git_config_int(var, value);
                return 0;
        }
-       return git_default_config(var, value, cb);
+       return git_xmerge_config(var, value, cb);
 }
 
 void init_merge_options(struct merge_options *o)
index d5efadd93d63b2c39176763eb325ecddb6c1215a..8a04066d6142823183033aaff8754febe31ad1b0 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -341,13 +341,14 @@ static int handle_config(const char *key, const char *value, void *cb)
        if (prefixcmp(key,  "remote."))
                return 0;
        name = key + 7;
+       if (*name == '/') {
+               warning("Config remote shorthand cannot begin with '/': %s",
+                       name);
+               return 0;
+       }
        subkey = strrchr(name, '.');
        if (!subkey)
                return error("Config with no key for remote %s", name);
-       if (*subkey == '/') {
-               warning("Config remote shorthand cannot begin with '/': %s", name);
-               return 0;
-       }
        remote = make_remote(name, subkey - name);
        if (!strcmp(subkey, ".mirror"))
                remote->mirror = git_config_bool(key, value);
index 3fbb0820a0e01faa1d9786d5fbeb8b4d1b6e591d..70bb453be25d4e5ba05ee5f2565630a8994842f2 100644 (file)
@@ -2333,6 +2333,7 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
        enum object_type type;
        char hdr[32];
        int hdrlen;
+       int ret;
 
        if (has_loose_object(sha1))
                return 0;
@@ -2340,7 +2341,10 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
        if (!buf)
                return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
        hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1;
-       return write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
+       ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
+       free(buf);
+
+       return ret;
 }
 
 int has_pack_index(const unsigned char *sha1)
index dc85e8b60a5c10e57047d1692e383f177e2c478d..2275caa317c8b7237c6f118251dc2d34cf10e218 100755 (executable)
@@ -7,6 +7,9 @@ test_description='Test shared repository initialization'
 
 . ./test-lib.sh
 
+# Remove a default ACL from the test dir if possible.
+setfacl -k . 2>/dev/null
+
 # User must have read permissions to the repo -> failure on --shared=0400
 test_expect_success 'shared = 0400 (faulty permission u-w)' '
        mkdir sub && (
index bc93dda8fdecf1a5c939bca10f21ebcbc16c69ce..1f1b85067773e40262c2ace48a67b60179663931 100755 (executable)
@@ -123,4 +123,20 @@ test_expect_success 'pre-rebase hook stops rebase (2)' '
        test 0 = $(git rev-list HEAD...side | wc -l)
 '
 
+test_expect_success 'rebase --no-verify overrides pre-rebase (1)' '
+       git checkout test &&
+       git reset --hard side &&
+       git rebase --no-verify master &&
+       test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
+       test "z$(cat git)" = zworld
+'
+
+test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
+       git checkout test &&
+       git reset --hard side &&
+       EDITOR=true git rebase --no-verify -i master &&
+       test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
+       test "z$(cat git)" = zworld
+'
+
 test_done
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
new file mode 100755 (executable)
index 0000000..8cde40f
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright(C) 2008 Stephen Habermann & Andreas Ericsson
+#
+test_description='git rebase -p should preserve merges
+
+Run "git rebase -p" and check that merges are properly carried along
+'
+. ./test-lib.sh
+
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL
+
+#echo 'Setting up:
+#
+#A1--A2  <-- origin/master
+# \   \
+#  B1--M  <-- topic
+#   \
+#    B2  <-- origin/topic
+#
+#'
+
+test_expect_success 'setup for merge-preserving rebase' \
+       'echo First > A &&
+       git add A &&
+       git-commit -m "Add A1" &&
+       git checkout -b topic &&
+       echo Second > B &&
+       git add B &&
+       git-commit -m "Add B1" &&
+       git checkout -f master &&
+       echo Third >> A &&
+       git-commit -a -m "Modify A2" &&
+
+       git clone ./. clone1 &&
+       cd clone1 &&
+       git checkout -b topic origin/topic &&
+       git merge origin/master &&
+       cd ..
+
+       git clone ./. clone2
+       cd clone2 &&
+       git checkout -b topic origin/topic &&
+       git merge origin/master &&
+       cd .. &&
+
+       git checkout topic &&
+       echo Fourth >> B &&
+       git commit -a -m "Modify B2"
+'
+
+test_expect_success 'rebase -p fakes interactive rebase' '
+       cd clone2 &&
+       git fetch &&
+       git rebase -p origin/topic &&
+       test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
+       test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
+'
+
+test_done
index 520e095c597a61f0f263a274a53ae0aa2781da85..be541348c6f8d469428e2fcc7abaf6d25168c08f 100755 (executable)
@@ -32,7 +32,7 @@ EOF
 
 sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
 
-builtin_patterns="bibtex html java pascal php python ruby tex"
+builtin_patterns="bibtex html java objc pascal php python ruby tex"
 for p in $builtin_patterns
 do
        test_expect_success "builtin $p pattern compiles" '
@@ -65,7 +65,14 @@ test_expect_success 'custom pattern' '
 
 test_expect_success 'last regexp must not be negated' '
        git config diff.java.funcname "!static" &&
-       test_must_fail git diff --no-index Beer.java Beer-correct.java
+       git diff --no-index Beer.java Beer-correct.java 2>&1 |
+       grep "fatal: Last expression must not be negated:"
+'
+
+test_expect_success 'pattern which matches to end of line' '
+       git config diff.java.funcname "Beer$" &&
+       git diff --no-index Beer.java Beer-correct.java |
+       grep "^@@.*@@ Beer"
 '
 
 test_expect_success 'alternation in pattern' '
index bc7a8a8689c8ca2b9902c577c9d9bdd1fa97815c..8f6aea48d84621ae3b7304636452c724a4bbe5b6 100755 (executable)
@@ -72,7 +72,7 @@ test_expect_success 'apply --directory (delete file)' '
        echo content >some/sub/dir/delfile &&
        git add some/sub/dir/delfile &&
        git apply --directory=some/sub/dir/ --index patch &&
-       ! git ls-files | grep delfile
+       ! (git ls-files | grep delfile)
 '
 
 cat > patch << 'EOF'
index 7313ac278cb7cb1d741e49f261e65d929ddeffb7..e5b210bc960c8433d6758f3932a86647208297ef 100755 (executable)
@@ -518,6 +518,46 @@ test_expect_success 'refresh the index before merging' '
        git merge c3
 '
 
+cat >expected <<EOF
+Merge branch 'c5' (early part)
+EOF
+
+test_expect_success 'merge early part of c2' '
+       git reset --hard c3 &&
+       echo c4 > c4.c &&
+       git add c4.c &&
+       git commit -m c4 &&
+       git tag c4 &&
+       echo c5 > c5.c &&
+       git add c5.c &&
+       git commit -m c5 &&
+       git tag c5 &&
+       git reset --hard c3 &&
+       echo c6 > c6.c &&
+       git add c6.c &&
+       git commit -m c6 &&
+       git tag c6 &&
+       git merge c5~1 &&
+       git show -s --pretty=format:%s HEAD > actual &&
+       test_cmp actual expected
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge --no-ff --no-commit && commit' '
+       git reset --hard c0 &&
+       git merge --no-ff --no-commit c1 &&
+       EDITOR=: git commit &&
+       verify_parents $c0 $c1
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'amending no-ff merge commit' '
+       EDITOR=: git commit --amend &&
+       verify_parents $c0 $c1
+'
+
 test_debug 'gitk --all'
 
 test_done
index f3f6db3297e4fd367d7af05a4755037aaf2aaf42..49e06af710ceee5538eb10f0c6cf9c30f31748b4 100644 (file)
@@ -207,6 +207,16 @@ static long ff_regexp(const char *line, long len,
 
        line_buffer = xstrndup(line, len); /* make NUL terminated */
 
+       /* Exclude terminating newline (and cr) from matching */
+       if (len > 0 && line[len-1] == '\n') {
+               if (len > 1 && line[len-2] == '\r')
+                       len -= 2;
+               else
+                       len--;
+       }
+
+       line_buffer = xstrndup(line, len); /* make NUL terminated */
+
        for (i = 0; i < regs->nr; i++) {
                struct ff_reg *reg = regs->array + i;
                if (!regexec(&reg->re, line_buffer, 2, pmatch, 0)) {