Code

Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Thu, 29 Nov 2007 01:06:57 +0000 (17:06 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Nov 2007 01:06:57 +0000 (17:06 -0800)
* maint:
  scripts: do not get confused with HEAD in work tree
  Improve description of git-branch -d and -D in man page.

Documentation/git-branch.txt
contrib/examples/git-merge-ours.sh
git-am.sh
git-filter-branch.sh
git-rebase--interactive.sh
git-rebase.sh
git-stash.sh

index 5ce905de862253aa2bd2ed619819306165e978f0..f87b6968b4808ebc7f831c814ca7e62924a19642 100644 (file)
@@ -45,17 +45,22 @@ to happen.
 
 With a `-d` or `-D` option, `<branchname>` will be deleted.  You may
 specify more than one branch for deletion.  If the branch currently
-has a reflog then the reflog will also be deleted. Use -r together with -d
-to delete remote-tracking branches.
+has a reflog then the reflog will also be deleted.
+
+Use -r together with -d to delete remote-tracking branches. Note, that it
+only makes sense to delete remote-tracking branches if they no longer exist
+in remote repository or if gitlink:git-fetch[1] was configured not to fetch
+them again. See also 'prune' subcommand of gitlink:git-remote[1] for way to
+clean up all obsolete remote-tracking branches.
 
 
 OPTIONS
 -------
 -d::
-       Delete a branch. The branch must be fully merged.
+       Delete a branch. The branch must be fully merged in HEAD.
 
 -D::
-       Delete a branch irrespective of its index status.
+       Delete a branch irrespective of its merged status.
 
 -l::
        Create the branch's reflog.  This activates recording of
@@ -153,9 +158,11 @@ $ git branch -d -r origin/todo origin/html origin/man   <1>
 $ git branch -D test                                    <2>
 ------------
 +
-<1> Delete remote-tracking branches "todo", "html", "man"
-<2> Delete "test" branch even if the "master" branch does not have all
-commits from test branch.
+<1> Delete remote-tracking branches "todo", "html", "man". Next 'fetch' or
+'pull' will create them again unless you configure them not to. See
+gitlink:git-fetch[1].
+<2> Delete "test" branch even if the "master" branch (or whichever branch is
+currently checked out) does not have all commits from test branch.
 
 
 Notes
index c81a790aa60ea08144dd0899d1aee2ec334a1825..29dba4ba3a57c15bd430bd23c1cebe78e6dc03be 100755 (executable)
@@ -9,6 +9,6 @@
 # because the current index is what we will be committing as the
 # merge result.
 
-git diff-index --quiet --cached HEAD || exit 2
+git diff-index --quiet --cached HEAD -- || exit 2
 
 exit 0
index 4126f0e857bad273d6f44cabe34565de860bd119..76c1c844a95d8af19f64a3278706daf907dace01 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -218,7 +218,7 @@ fi
 
 case "$resolved" in
 '')
-       files=$(git diff-index --cached --name-only HEAD) || exit
+       files=$(git diff-index --cached --name-only HEAD --) || exit
        if [ "$files" ]; then
           echo "Dirty index: cannot apply patches (dirty: $files)" >&2
           exit 1
@@ -352,7 +352,7 @@ do
                case "$resolved$interactive" in
                tt)
                        # This is used only for interactive view option.
-                       git diff-index -p --cached HEAD >"$dotest/patch"
+                       git diff-index -p --cached HEAD -- >"$dotest/patch"
                        ;;
                esac
        esac
@@ -411,7 +411,7 @@ do
                # trust what the user has in the index file and the
                # working tree.
                resolved=
-               git diff-index --quiet --cached HEAD && {
+               git diff-index --quiet --cached HEAD -- && {
                        echo "No changes - did you forget to use 'git add'?"
                        stop_here_user_resolve $this
                }
@@ -433,7 +433,7 @@ do
                then
                    # Applying the patch to an earlier tree and merging the
                    # result may have produced the same tree as ours.
-                   git diff-index --quiet --cached HEAD && {
+                   git diff-index --quiet --cached HEAD -- && {
                        echo No changes -- Patch already applied.
                        go_next
                        continue
index 19cab5a9a8b7ebbdf740158ba4f651457e3d53e5..674a25d27e50b421e516e8ca6e1190d04e323e9c 100755 (executable)
@@ -98,7 +98,7 @@ OPTIONS_SPEC=
 . git-sh-setup
 
 git diff-files --quiet &&
-       git diff-index --cached --quiet HEAD ||
+       git diff-index --cached --quiet HEAD -- ||
        die "Cannot rewrite branch(es) with a dirty working directory."
 
 tempdir=.git-rewrite
index bf44b6af58574273df9e7f549136a735f6e549fe..e9cd6fd999695daa1c5ba49835f53041d4131f3a 100755 (executable)
@@ -53,7 +53,7 @@ require_clean_work_tree () {
        git rev-parse --verify HEAD > /dev/null &&
        git update-index --refresh &&
        git diff-files --quiet &&
-       git diff-index --cached --quiet HEAD ||
+       git diff-index --cached --quiet HEAD -- ||
        die "Working tree is dirty"
 }
 
@@ -356,7 +356,7 @@ do
                git rev-parse --verify HEAD > /dev/null &&
                git update-index --refresh &&
                git diff-files --quiet &&
-               ! git diff-index --cached --quiet HEAD &&
+               ! git diff-index --cached --quiet HEAD -- &&
                . "$DOTEST"/author-script && {
                        test ! -f "$DOTEST"/amend || git reset --soft HEAD^
                } &&
index 461ca8d93f4ab5c43792b4658d53b2e39ad18af1..bdcea0ed703057e08fd4204245f4f0c8a308f8d0 100755 (executable)
@@ -61,7 +61,7 @@ continue_merge () {
        fi
 
        cmt=`cat "$dotest/current"`
-       if ! git diff-index --quiet HEAD
+       if ! git diff-index --quiet HEAD --
        then
                if ! git-commit -C "$cmt"
                then
@@ -285,7 +285,7 @@ fi
 
 # The tree must be really really clean.
 git update-index --refresh || exit
-diff=$(git diff-index --cached --name-status -r HEAD)
+diff=$(git diff-index --cached --name-status -r HEAD --)
 case "$diff" in
 ?*)    echo "cannot rebase: your index is not up-to-date"
        echo "$diff"
index dd155568d96771b2dcd62ecae0cc2c050169bf52..b1529e28b1c4eb8b236bd497c83690c20621d369 100755 (executable)
@@ -15,7 +15,7 @@ trap 'rm -f "$TMP-*"' 0
 ref_stash=refs/stash
 
 no_changes () {
-       git diff-index --quiet --cached HEAD &&
+       git diff-index --quiet --cached HEAD -- &&
        git diff-files --quiet
 }