diff options
-rw-r--r-- | Documentation/RelNotes-1.6.5.8.txt | 28 | ||||
-rw-r--r-- | Documentation/RelNotes-1.6.6.1.txt | 19 | ||||
-rw-r--r-- | Documentation/git-add.txt | 57 | ||||
-rw-r--r-- | Documentation/git-rm.txt | 60 | ||||
-rw-r--r-- | Documentation/git.txt | 6 | ||||
-rwxr-xr-x | GIT-VERSION-GEN | 2 | ||||
-rw-r--r-- | builtin-remote.c | 10 | ||||
-rw-r--r-- | builtin-reset.c | 6 | ||||
-rwxr-xr-x | contrib/completion/git-completion.bash | 6 | ||||
-rwxr-xr-x | git-merge-octopus.sh | 15 | ||||
-rwxr-xr-x | t/t5505-remote.sh | 14 | ||||
-rwxr-xr-x | t/t7103-reset-bare.sh | 6 | ||||
-rwxr-xr-x | t/t7602-merge-octopus-many.sh | 51 |
13 files changed, 219 insertions, 61 deletions
diff --git a/Documentation/RelNotes-1.6.5.8.txt b/Documentation/RelNotes-1.6.5.8.txt new file mode 100644 index 0000000000..8b24bebb96 --- /dev/null +++ b/Documentation/RelNotes-1.6.5.8.txt @@ -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. diff --git a/Documentation/RelNotes-1.6.6.1.txt b/Documentation/RelNotes-1.6.6.1.txt index 406fbc4e0f..f1d0a4ae2d 100644 --- a/Documentation/RelNotes-1.6.6.1.txt +++ b/Documentation/RelNotes-1.6.6.1.txt @@ -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 diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index e93e606f45..1f1b19996b 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -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: + ------------ diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt index 5afb1e7428..c21d19e573 100644 --- a/Documentation/git-rm.txt +++ b/Documentation/git-rm.txt @@ -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:: diff --git a/Documentation/git.txt b/Documentation/git.txt index 352c23019f..b6df39ba36 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -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], diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 1628d986fe..4e0adcade9 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.6.6 +DEF_VER=v1.6.6.1 LF=' ' diff --git a/builtin-remote.c b/builtin-remote.c index a5019397ff..c4945b8708 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -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); diff --git a/builtin-reset.c b/builtin-reset.c index 11d1c6e4d6..e4418bced2 100644 --- a/builtin-reset.c +++ b/builtin-reset.c @@ -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 diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fbfa5f25c1..1a9943c012 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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 diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh index 825c52c243..615753c83c 100755 --- a/git-merge-octopus.sh +++ b/git-merge-octopus.sh @@ -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 diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index fd166d9de3..936fe0a1a6 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -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 && diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh index 68041df5f4..afb55b3a46 100755 --- a/t/t7103-reset-bare.sh +++ b/t/t7103-reset-bare.sh @@ -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 diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh index 01e5415e94..2746169514 100755 --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@ -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 |