Code

Merge branch 'jc/maint-refresh-index-is-optional-for-status' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 21 Jan 2010 04:25:11 +0000 (20:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Jan 2010 04:25:11 +0000 (20:25 -0800)
* jc/maint-refresh-index-is-optional-for-status:
  status: don't require the repository to be writable

13 files changed:
Documentation/RelNotes-1.6.5.8.txt [new file with mode: 0644]
Documentation/RelNotes-1.6.6.1.txt
Documentation/git-add.txt
Documentation/git-rm.txt
Documentation/git.txt
GIT-VERSION-GEN
builtin-remote.c
builtin-reset.c
contrib/completion/git-completion.bash
git-merge-octopus.sh
t/t5505-remote.sh
t/t7103-reset-bare.sh
t/t7602-merge-octopus-many.sh

diff --git a/Documentation/RelNotes-1.6.5.8.txt b/Documentation/RelNotes-1.6.5.8.txt
new file mode 100644 (file)
index 0000000..8b24beb
--- /dev/null
@@ -0,0 +1,28 @@
+Git v1.6.5.8 Release Notes
+==========================
+
+Fixes since v1.6.5.7
+--------------------
+
+* "git count-objects" did not handle packfiles that are bigger than 4G on
+  platforms with 32-bit off_t.
+
+* "git rebase -i" did not abort cleanly if it failed to launch the editor.
+
+* "git blame" did not work well when commit lacked the author name.
+
+* "git fast-import" choked when handling a tag that points at an object
+  that is not a commit.
+
+* "git reset --hard" did not work correctly when GIT_WORK_TREE environment
+  variable is used to point at the root of the true work tree.
+
+* "git grep" fed a buffer that is not NUL-terminated to underlying
+  regexec().
+
+* "git checkout -m other" while on a branch that does not have any commit
+  segfaulted, instead of failing.
+
+* "git branch -a other" should have diagnosed the command as an error.
+
+Other minor documentation updates are also included.
index 406fbc4e0f9bc7f95ed576769c378f76dcd10d16..f1d0a4ae2d63e258cea94f8bca09d41121f1165e 100644 (file)
@@ -4,8 +4,16 @@ Git v1.6.6.1 Release Notes
 Fixes since v1.6.6
 ------------------
 
+ * "git blame" did not work well when commit lacked the author name.
+
  * "git branch -a name" wasn't diagnosed as an error.
 
+ * "git count-objects" did not handle packfiles that are bigger than 4G on
+   platforms with 32-bit off_t.
+
+ * "git checkout -m other" while on a branch that does not have any commit
+   segfaulted, instead of failing.
+
  * "git fast-import" choked when fed a tag that do not point at a
    commit.
 
@@ -15,6 +23,11 @@ Fixes since v1.6.6
  * "git grep -L" didn't show empty files (they should never match, and
    they should always appear in -L output as unmatching).
 
+ * "git rebase -i" did not abort cleanly if it failed to launch the editor.
+
+ * "git reset --hard" did not work correctly when GIT_WORK_TREE environment
+   variable is used to point at the root of the true work tree.
+
  * http-backend was not listed in the command list in the documentation.
 
  * Building on FreeBSD (both 7 and 8) needs OLD_ICONV set in the Makefile
@@ -22,9 +35,3 @@ Fixes since v1.6.6
  * "git checkout -m some-branch" while on an unborn branch crashed.
 
 Other minor documentation updates are included.
-
---
-exec >/var/tmp/1
-O=v1.6.6-39-g6304c40
-echo O=$(git describe maint)
-git shortlog --no-merges $O..maint
index e93e606f458356275964d0d7b438ca772abba47c..1f1b19996baa34b20bf08f4eb2889403cbc4c45d 100644 (file)
@@ -14,28 +14,32 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-This command adds the current content of new or modified files to the
-index, thus staging that content for inclusion in the next commit.
+This command updates the index using the current content found in
+the working tree, to prepare the content staged for the next commit.
+It typically adds the current content of existing paths as a whole,
+but with some options it can also be used to add content with
+only part of the changes made to the working tree files applied, or
+remove paths that do not exist in the working tree anymore.
 
 The "index" holds a snapshot of the content of the working tree, and it
 is this snapshot that is taken as the contents of the next commit.  Thus
 after making any changes to the working directory, and before running
-the commit command, you must use the 'add' command to add any new or
+the commit command, you must use the `add` command to add any new or
 modified files to the index.
 
 This command can be performed multiple times before a commit.  It only
 adds the content of the specified file(s) at the time the add command is
 run; if you want subsequent changes included in the next commit, then
-you must run 'git add' again to add the new content to the index.
+you must run `git add` again to add the new content to the index.
 
-The 'git status' command can be used to obtain a summary of which
+The `git status` command can be used to obtain a summary of which
 files have changes that are staged for the next commit.
 
-The 'git add' command will not add ignored files by default.  If any
-ignored files were explicitly specified on the command line, 'git add'
+The `git add` command will not add ignored files by default.  If any
+ignored files were explicitly specified on the command line, `git add`
 will fail with a list of ignored files.  Ignored files reached by
 directory recursion or filename globbing performed by Git (quote your
-globs before the shell) will be silently ignored.  The 'add' command can
+globs before the shell) will be silently ignored.  The `add` command can
 be used to add ignored files with the `-f` (force) option.
 
 Please see linkgit:git-commit[1] for alternative ways to add content to a
@@ -92,28 +96,31 @@ apply.
 
 -u::
 --update::
-       Update only files that git already knows about, staging modified
-       content for commit and marking deleted files for removal. 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 in the
-       current directory and its subdirectories are updated.
+       Only match <filepattern> against already tracked files in
+       the index rather than the working tree. That means that it
+       will never stage new files, but that it will stage modified
+       new contents of tracked files and that it will remove files
+       from the index if the corresponding files in the working tree
+       have been removed.
++
+If no <filepattern> is given, default to "."; in other words,
+update all tracked files in the current directory and its
+subdirectories.
 
 -A::
 --all::
-       Update files that git already knows about (same as '\--update')
-       and add all untracked files that are not ignored by '.gitignore'
-       mechanism.
-
+       Like `-u`, but match <filepattern> against files in the
+       working tree in addition to the index. That means that it
+       will find new files as well as staging modified content and
+       removing files that are no longer in the working tree.
 
 -N::
 --intent-to-add::
        Record only the fact that the path will be added later. An entry
        for the path is placed in the index with no content. This is
        useful for, among other things, showing the unstaged content of
-       such files with 'git diff' and committing them with 'git commit
-       -a'.
+       such files with `git diff` and committing them with `git commit
+       -a`.
 
 --refresh::
        Don't add the file(s), but only refresh their stat()
@@ -133,7 +140,7 @@ apply.
 Configuration
 -------------
 
-The optional configuration variable 'core.excludesfile' indicates a path to a
+The optional configuration variable `core.excludesfile` indicates a path to a
 file containing patterns of file names to exclude from git-add, similar to
 $GIT_DIR/info/exclude.  Patterns in the exclude file are used in addition to
 those in info/exclude.  See linkgit:gitrepository-layout[5].
@@ -181,7 +188,7 @@ and type return, like this:
     What now> 1
 ------------
 
-You also could say "s" or "sta" or "status" above as long as the
+You also could say `s` or `sta` or `status` above as long as the
 choice is unique.
 
 The main command loop has 6 subcommands (plus help and quit).
@@ -189,9 +196,9 @@ The main command loop has 6 subcommands (plus help and quit).
 status::
 
    This shows the change between HEAD and index (i.e. what will be
-   committed if you say "git commit"), and between index and
+   committed if you say `git commit`), and between index and
    working tree files (i.e. what you could stage further before
-   "git commit" using "git-add") for each path.  A sample output
+   `git commit` using `git add`) for each path.  A sample output
    looks like this:
 +
 ------------
index 5afb1e7428126c79171cf7e7b1fb027e1de64c86..c21d19e573d5192597b4766d8d87d17ab8f1c0f3 100644 (file)
@@ -12,13 +12,13 @@ SYNOPSIS
 DESCRIPTION
 -----------
 Remove files from the index, or from the working tree and the index.
-'git-rm' will not remove a file from just your working directory.
-(There is no option to remove a file only from the work tree
+`git rm` will not remove a file from just your working directory.
+(There is no option to remove a file only from the working tree
 and yet keep it in the index; use `/bin/rm` if you want to do that.)
 The files being removed have to be identical to the tip of the branch,
 and no updates to their contents can be staged in the index,
 though that default behavior can be overridden with the `-f` option.
-When '--cached' is given, the staged content has to
+When `--cached` is given, the staged content has to
 match either the tip of the branch or the file on disk,
 allowing the file to be removed from just the index.
 
@@ -64,7 +64,7 @@ OPTIONS
 
 -q::
 --quiet::
-       'git-rm' normally outputs one line (in the form of an "rm" command)
+       `git rm` normally outputs one line (in the form of an `rm` command)
        for each file removed. This option suppresses that output.
 
 
@@ -81,6 +81,58 @@ two directories `d` and `d2`, there is a difference between
 using `git rm \'d\*\'` and `git rm \'d/\*\'`, as the former will
 also remove all of directory `d2`.
 
+REMOVING FILES THAT HAVE DISAPPEARED FROM THE FILESYSTEM
+--------------------------------------------------------
+There is no option for `git rm` to remove from the index only
+the paths that have disappeared from the filesystem. However,
+depending on the use case, there are several ways that can be
+done.
+
+Using "git commit -a"
+~~~~~~~~~~~~~~~~~~~~~
+If you intend that your next commit should record all modifications
+of tracked files in the working tree and record all removals of
+files that have been removed from the working tree with `rm`
+(as opposed to `git rm`), use `git commit -a`, as it will
+automatically notice and record all removals.  You can also have a
+similar effect without committing by using `git add -u`.
+
+Using "git add -A"
+~~~~~~~~~~~~~~~~~~
+When accepting a new code drop for a vendor branch, you probably
+want to record both the removal of paths and additions of new paths
+as well as modifications of existing paths.
+
+Typically you would first remove all tracked files from the working
+tree using this command:
+
+----------------
+git ls-files -z | xargs -0 rm -f
+----------------
+
+and then "untar" the new code in the working tree. Alternately
+you could "rsync" the changes into the working tree.
+
+After that, the easiest way to record all removals, additions, and
+modifications in the working tree is:
+
+----------------
+git add -A
+----------------
+
+See linkgit:git-add[1].
+
+Other ways
+~~~~~~~~~~
+If all you really want to do is to remove from the index the files
+that are no longer present in the working tree (perhaps because
+your working tree is dirty so that you cannot use `git commit -a`),
+use the following command:
+
+----------------
+git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached
+----------------
+
 EXAMPLES
 --------
 git rm Documentation/\\*.txt::
index 352c23019f7dad59c735f88c0606cf056c84a578..b6df39ba36eddd640c456293a0233894beb1da5c 100644 (file)
@@ -43,14 +43,16 @@ unreleased) version of git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v1.6.6/git.html[documentation for release 1.6.6]
+* link:v1.6.6.1/git.html[documentation for release 1.6.6.1]
 
 * release notes for
+  link:RelNotes-1.6.6.1.txt[1.6.6.1],
   link:RelNotes-1.6.6.txt[1.6.6].
 
-* link:v1.6.5.7/git.html[documentation for release 1.6.5.7]
+* link:v1.6.5.8/git.html[documentation for release 1.6.5.8]
 
 * release notes for
+  link:RelNotes-1.6.5.8.txt[1.6.5.8],
   link:RelNotes-1.6.5.7.txt[1.6.5.7],
   link:RelNotes-1.6.5.6.txt[1.6.5.6],
   link:RelNotes-1.6.5.5.txt[1.6.5.5],
index 1628d986fe44aabf33d7b9e88082b52cb2640986..4e0adcade959a188c0d6e7d44a99b042e8280aec 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.6.6
+DEF_VER=v1.6.6.1
 
 LF='
 '
index a5019397ff840204963e4e4b23d2ca16de1a332a..c4945b870882834fdaa75fd3d65f664570f6a5da 100644 (file)
@@ -1238,13 +1238,11 @@ static int update(int argc, const char **argv)
                fetch_argv[fetch_argc++] = "--prune";
        if (verbose)
                fetch_argv[fetch_argc++] = "-v";
-       if (argc < 2) {
+       fetch_argv[fetch_argc++] = "--multiple";
+       if (argc < 2)
                fetch_argv[fetch_argc++] = "default";
-       } else {
-               fetch_argv[fetch_argc++] = "--multiple";
-               for (i = 1; i < argc; i++)
-                       fetch_argv[fetch_argc++] = argv[i];
-       }
+       for (i = 1; i < argc; i++)
+               fetch_argv[fetch_argc++] = argv[i];
 
        if (strcmp(fetch_argv[fetch_argc-1], "default") == 0) {
                git_config(get_remote_default, &default_defined);
index 11d1c6e4d6d2ec0580cae3725f6b3a093e68aa67..e4418bced23807df174e600a4babbf1d604bac8e 100644 (file)
@@ -286,10 +286,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
        if (reset_type == NONE)
                reset_type = MIXED; /* by default */
 
-       if ((reset_type == HARD || reset_type == MERGE)
-           && !is_inside_work_tree())
-               die("%s reset requires a work tree",
-                   reset_type_names[reset_type]);
+       if (reset_type == HARD || reset_type == MERGE)
+               setup_work_tree();
 
        /* Soft reset does not touch the index file nor the working tree
         * at all, but requires them in a good order.  Other resets reset
index fbfa5f25c1b2c75943464757d571d3fa89e209aa..1a9943c012d2efc47132e09d383332cb5efaead2 100755 (executable)
@@ -142,11 +142,9 @@ __git_ps1 ()
                elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
                        if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
                                if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
-                                       git diff --no-ext-diff --ignore-submodules \
-                                               --quiet --exit-code || w="*"
+                                       git diff --no-ext-diff --quiet --exit-code || w="*"
                                        if git rev-parse --quiet --verify HEAD >/dev/null; then
-                                               git diff-index --cached --quiet \
-                                                       --ignore-submodules HEAD -- || i="+"
+                                               git diff-index --cached --quiet HEAD -- || i="+"
                                        else
                                                i="#"
                                        fi
index 825c52c2436d15edb12a2ce7850437e0e531e0e3..615753c83c38f4a97752d5ca3400beeef4acd5f1 100755 (executable)
@@ -44,9 +44,8 @@ esac
 # MRC is the current "merge reference commit"
 # MRT is the current "merge result tree"
 
-MRC=$head MSG= PARENT="-p $head"
+MRC=$(git rev-parse --verify -q $head)
 MRT=$(git write-tree)
-CNT=1 ;# counting our head
 NON_FF_MERGE=0
 OCTOPUS_FAILURE=0
 for SHA1 in $remotes
@@ -61,19 +60,17 @@ do
                exit 2
        esac
 
+       eval pretty_name=\${GITHEAD_$SHA1:-$SHA1}
        common=$(git merge-base --all $SHA1 $MRC) ||
-               die "Unable to find common commit with $SHA1"
+               die "Unable to find common commit with $pretty_name"
 
        case "$LF$common$LF" in
        *"$LF$SHA1$LF"*)
-               echo "Already up-to-date with $SHA1"
+               echo "Already up-to-date with $pretty_name"
                continue
                ;;
        esac
 
-       CNT=`expr $CNT + 1`
-       PARENT="$PARENT -p $SHA1"
-
        if test "$common,$NON_FF_MERGE" = "$MRC,0"
        then
                # The first head being merged was a fast-forward.
@@ -81,7 +78,7 @@ do
                # tree as the intermediate result of the merge.
                # We still need to count this as part of the parent set.
 
-               echo "Fast-forwarding to: $SHA1"
+               echo "Fast-forwarding to: $pretty_name"
                git read-tree -u -m $head $SHA1 || exit
                MRC=$SHA1 MRT=$(git write-tree)
                continue
@@ -89,7 +86,7 @@ do
 
        NON_FF_MERGE=1
 
-       echo "Trying simple merge with $SHA1"
+       echo "Trying simple merge with $pretty_name"
        git read-tree -u -m --aggressive  $common $MRT $SHA1 || exit 2
        next=$(git write-tree 2>/dev/null)
        if test $? -ne 0
index fd166d9de356dafb000504506285a6f77fcc0a37..936fe0a1a635bc8a553962f13bff32e873c358cd 100755 (executable)
@@ -419,6 +419,20 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
 
 '
 
+test_expect_success 'update (with remotes.default defined)' '
+
+       (cd one &&
+        for b in $(git branch -r)
+        do
+               git branch -r -d $b || break
+        done &&
+        git config remotes.default "drosophila" &&
+        git remote update &&
+        git branch -r > output &&
+        test_cmp expect output)
+
+'
+
 test_expect_success '"remote show" does not show symbolic refs' '
 
        git clone one three &&
index 68041df5f49e046c2b7ccd1f3a1c71071498da39..afb55b3a463f79be83c0e3cc4a8aff8a0c6676be 100755 (executable)
@@ -29,6 +29,12 @@ test_expect_success 'soft reset is ok' '
        (cd .git && git reset --soft)
 '
 
+test_expect_success 'hard reset works with GIT_WORK_TREE' '
+       mkdir worktree &&
+       GIT_WORK_TREE=$PWD/worktree GIT_DIR=$PWD/.git git reset --hard &&
+       test_cmp file worktree/file
+'
+
 test_expect_success 'setup bare' '
        git clone --bare . bare.git &&
        cd bare.git
index 01e5415e943f3e16154f2f4d999f85a9d8b6ae49..2746169514f9bd1629f05eed8f9ff2fcfdba8cb5 100755 (executable)
@@ -49,4 +49,55 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
        done
 '
 
+cat >expected <<\EOF
+Trying simple merge with c2
+Trying simple merge with c3
+Trying simple merge with c4
+Merge made by octopus.
+ c2.c |    1 +
+ c3.c |    1 +
+ c4.c |    1 +
+ 3 files changed, 3 insertions(+), 0 deletions(-)
+ create mode 100644 c2.c
+ create mode 100644 c3.c
+ create mode 100644 c4.c
+EOF
+
+test_expect_success 'merge output uses pretty names' '
+       git reset --hard c1 &&
+       git merge c2 c3 c4 >actual &&
+       test_cmp actual expected
+'
+
+cat >expected <<\EOF
+Already up-to-date with c4
+Trying simple merge with c5
+Merge made by octopus.
+ c5.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+ create mode 100644 c5.c
+EOF
+
+test_expect_success 'merge up-to-date output uses pretty names' '
+       git merge c4 c5 >actual &&
+       test_cmp actual expected
+'
+
+cat >expected <<\EOF
+Fast-forwarding to: c1
+Trying simple merge with c2
+Merge made by octopus.
+ c1.c |    1 +
+ c2.c |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 c1.c
+ create mode 100644 c2.c
+EOF
+
+test_expect_success 'merge fast-forward output uses pretty names' '
+       git reset --hard c0 &&
+       git merge c1 c2 >actual &&
+       test_cmp actual expected
+'
+
 test_done