~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-updates

« back to all changes in this revision

Viewing changes to git-pull.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-04-22 13:31:05 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20070422133105-tkmhz328g2p0epz1
Tags: 1:1.5.1.2-1
* new upstream point release.
* debian/changelog.upstream: upstream changes taken from mailing list
  announcement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
USAGE='[-n | --no-summary] [--no-commit] [-s strategy]... [<fetch-options>] <repo> <head>...'
8
8
LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
 
9
SUBDIRECTORY_OK=Yes
9
10
. git-sh-setup
 
11
set_reflog_action "pull $*"
 
12
require_work_tree
 
13
cd_to_toplevel
 
14
 
 
15
test -z "$(git ls-files -u)" ||
 
16
        die "You are in the middle of a conflicted merge."
10
17
 
11
18
strategy_args= no_summary= no_commit= squash=
12
19
while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
45
52
done
46
53
 
47
54
orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
48
 
git-fetch --update-head-ok --reflog-action=pull "$@" || exit 1
 
55
git-fetch --update-head-ok "$@" || exit 1
49
56
 
50
57
curr_head=$(git-rev-parse --verify HEAD 2>/dev/null)
51
58
if test "$curr_head" != "$orig_head"
76
83
 
77
84
case "$merge_head" in
78
85
'')
 
86
        curr_branch=$(git-symbolic-ref -q HEAD)
 
87
        case $? in
 
88
          0) ;;
 
89
          1) echo >&2 "You are not currently on a branch; you must explicitly"
 
90
             echo >&2 "specify which branch you wish to merge:"
 
91
             echo >&2 "  git pull <remote> <branch>"
 
92
             exit 1;;
 
93
          *) exit $?;;
 
94
        esac
 
95
        curr_branch=${curr_branch#refs/heads/}
 
96
 
 
97
        echo >&2 "Warning: No merge candidate found because value of config option
 
98
         \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
79
99
        echo >&2 "No changes."
80
100
        exit 0
81
101
        ;;
85
105
                echo >&2 "Cannot merge multiple branches into empty head"
86
106
                exit 1
87
107
        fi
88
 
        var=`git-repo-config --get pull.octopus`
89
 
        if test -n "$var"
90
 
        then
91
 
                strategy_default_args="-s $var"
92
 
        fi
93
 
        ;;
94
 
*)
95
 
        var=`git-repo-config --get pull.twohead`
96
 
        if test -n "$var"
97
 
        then
98
 
                strategy_default_args="-s $var"
99
 
        fi
100
108
        ;;
101
109
esac
102
110
 
107
115
        exit
108
116
fi
109
117
 
110
 
case "$strategy_args" in
111
 
'')
112
 
        strategy_args=$strategy_default_args
113
 
        ;;
114
 
esac
115
 
 
116
118
merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
117
 
git-merge "--reflog-action=pull $*" \
118
 
        $no_summary $no_commit $squash $strategy_args \
 
119
exec git-merge $no_summary $no_commit $squash $strategy_args \
119
120
        "$merge_name" HEAD $merge_head