summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83ba99b)
raw | patch | inline | side by side (parent: 83ba99b)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 21 Jun 2005 16:47:37 +0000 (09:47 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 21 Jun 2005 16:47:37 +0000 (09:47 -0700) |
It is careful by default and refuses to overwrite old info, but if you
want to force everything to be re-read, use the "-f" flag.
Some day I'll make it take individual filenames too. Right now
it's all-or-nothing.
want to force everything to be re-read, use the "-f" flag.
Some day I'll make it take individual filenames too. Right now
it's all-or-nothing.
Makefile | patch | blob | history | |
git-checkout-script | [new file with mode: 0755] | patch | blob |
diff --git a/Makefile b/Makefile
index bf63984bb96c3c1cf709179c4d823cd649842df8..3372269f5a4fed7df212aee4f2a6d678406df96f 100644 (file)
--- a/Makefile
+++ b/Makefile
git-pull-script git-tag-script git-resolve-script git-whatchanged \
git-deltafy-script git-fetch-script git-status-script git-commit-script \
git-log-script git-shortlog git-cvsimport-script git-diff-script \
- git-reset-script git-add-script
+ git-reset-script git-add-script git-checkout-script
PROG= git-update-cache git-diff-files git-init-db git-write-tree \
git-read-tree git-commit-tree git-cat-file git-fsck-cache \
diff --git a/git-checkout-script b/git-checkout-script
--- /dev/null
+++ b/git-checkout-script
@@ -0,0 +1,30 @@
+#!/bin/sh
+: ${GIT_DIR=.git}
+old=$(git-rev-parse HEAD)
+new=$(git-rev-parse --revs-only "$@")
+new=${new:-$old}
+args=($(git-rev-parse --no-revs "$@"))
+
+i=0
+force=0
+while [ $i -lt ${#args} ]; do
+ case "${args[$i]}" in
+ "-f")
+ force=1;;
+ "")
+ ;;
+ *)
+ echo "unknown flag ${args[$i]}"
+ exit 1;;
+ esac
+ i=$(($i+1))
+done
+
+if $force
+then
+ git-read-tree --reset $new &&
+ git-checkout-cache -q -f -u -a &&
+ echo $new > "$GIT_DIR/HEAD"
+else
+ git-read-tree -m -u $old $new && echo $new > "$GIT_DIR/HEAD"
+fi