summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0509eb2)
raw | patch | inline | side by side (parent: 0509eb2)
author | Junio C Hamano <gitster@pobox.com> | |
Sat, 2 Feb 2008 03:06:56 +0000 (19:06 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 2 Feb 2008 03:08:14 +0000 (19:08 -0800) |
Because ':/substring' extended SHA1 expression cannot take
postfix modifiers such as ^{tree} and ^{commit}, we would need
to do it in multiple steps. With the patch, you can start a new
branch from a randomly-picked commit whose message has the named
string in it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
postfix modifiers such as ^{tree} and ^{commit}, we would need
to do it in multiple steps. With the patch, you can start a new
branch from a randomly-picked commit whose message has the named
string in it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-checkout.sh | patch | blob | history |
diff --git a/git-checkout.sh b/git-checkout.sh
index 5621c69d86062c7c75c0b8c2749d34efc78cafb4..bd74d701a1f0abb63e2bcdcb47035cb2c6eee745 100755 (executable)
--- a/git-checkout.sh
+++ b/git-checkout.sh
done
arg="$1"
-if rev=$(git rev-parse --verify "$arg^0" 2>/dev/null)
+rev=$(git rev-parse --verify "$arg" 2>/dev/null)
+if rev=$(git rev-parse --verify "$rev^0" 2>/dev/null)
then
[ -z "$rev" ] && die "unknown flag $arg"
new_name="$arg"
fi
new="$rev"
shift
-elif rev=$(git rev-parse --verify "$arg^{tree}" 2>/dev/null)
+elif rev=$(git rev-parse --verify "$rev^{tree}" 2>/dev/null)
then
# checking out selected paths from a tree-ish.
new="$rev"
- new_name="$arg^{tree}"
+ new_name="$rev^{tree}"
shift
fi
[ "$1" = "--" ] && shift