Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
"git checkout": add "-u" flag to update HEAD conditionally
author
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 16:59:26 +0000
(09:59 -0700)
committer
Linus Torvalds
<torvalds@ppc970.osdl.org>
Tue, 21 Jun 2005 16:59:26 +0000
(09:59 -0700)
And fix braino on testing "-f".
git-checkout-script
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
303e5f4
)
diff --git
a/git-checkout-script
b/git-checkout-script
index e8e777f1f23e71fde909ce0d831d4a319993c0ab..dc1cffde0bd214b90f0c0b754f0e5f33bd3023b2 100755
(executable)
--- a/
git-checkout-script
+++ b/
git-checkout-script
@@
-6,11
+6,14
@@
new=${new:-$old}
args=($(git-rev-parse --no-revs "$@"))
i=0
args=($(git-rev-parse --no-revs "$@"))
i=0
-force=0
+force=
+update=
while [ $i -lt ${#args} ]; do
case "${args[$i]}" in
"-f")
force=1;;
while [ $i -lt ${#args} ]; do
case "${args[$i]}" in
"-f")
force=1;;
+ "-u")
+ update=1;;
"")
;;
*)
"")
;;
*)
@@
-20,11
+23,11
@@
while [ $i -lt ${#args} ]; do
i=$(($i+1))
done
i=$(($i+1))
done
-if
$force
+if
[ "$force" ]
then
git-read-tree --reset $new &&
then
git-read-tree --reset $new &&
- git-checkout-cache -q -f -u -a &&
- echo $new > "$GIT_DIR/HEAD"
+ git-checkout-cache -q -f -u -a
else
else
- git-read-tree -m -u $old $new && echo $new > "$GIT_DIR/HEAD"
-fi
+ git-read-tree -m -u $old $new
+fi && [ "$update" ] && echo $new > "$GIT_DIR/HEAD"
+