@matheusbsbs / matheus-bagliano / commits / 533b70390e
Fork 0

Allow whole-tree operations to be started from a subdirectory

This updates five commands (merge, pull, rebase, revert and cherry-pick) so that they can be started from a subdirectory. This may not actually be what we want to do. These commands are inherently whole-tree operations, and an inexperienced user may mistakenly expect a "git pull" from a subdirectory would merge only the subdirectory the command started from. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 12, 2007 at 12:52 UTC 533b70390e540de4e0faed4823ee561c8368e5ec
4 files changed +12 -2
git-merge.sh
+3 -1
@@ -5,12 +5,14 @@
5
6 USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commit>+'
7
8 +SUBDIRECTORY_OK=Yes
9 . git-sh-setup
10 set_reflog_action "merge $*"
11 require_work_tree
12 +cd_to_toplevel
13
14 test -z "$(git ls-files -u)" ||
13 - die "You are in a middle of conflicted merge."
15 + die "You are in the middle of a conflicted merge."
16
17 LF='
18 '
git-pull.sh
+3 -1
@@ -6,12 +6,14 @@
6
7 USAGE='[-n | --no-summary] [--no-commit] [-s strategy]... [<fetch-options>] <repo> <head>...'
8 LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
9 +SUBDIRECTORY_OK=Yes
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)" ||
14 - die "You are in a middle of conflicted merge."
16 + die "You are in the middle of a conflicted merge."
17
18 strategy_args= no_summary= no_commit= squash=
19 while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
git-rebase.sh
+3
@@ -27,9 +27,12 @@ Example: git-rebase master~1 topic
27 / --> /
28 D---E---F---G master D---E---F---G master
29 '
30 +
31 +SUBDIRECTORY_OK=Yes
32 . git-sh-setup
33 set_reflog_action rebase
34 require_work_tree
35 +cd_to_toplevel
36
37 RESOLVEMSG="
38 When you have resolved this problem run \"git rebase --continue\".
git-revert.sh
+3
@@ -19,8 +19,11 @@ case "$0" in
19 echo >&2 "What are you talking about?"
20 exit 1 ;;
21 esac
22 +
23 +SUBDIRECTORY_OK=Yes ;# we will cd up
24 . git-sh-setup
25 require_work_tree
26 +cd_to_toplevel
27
28 no_commit=
29 while case "$#" in 0) break ;; esac