Write gitception_get in a simpler way

This commit is contained in:
root 2013-02-14 00:00:00 +00:00
parent 903e9a5bbc
commit 1a7e58db58

View file

@ -43,10 +43,10 @@ gitception_get()
local RETVAL
FHEAD="$GIT_DIR/FETCH_HEAD"
[ -e "$FHEAD" ] && command mv -f "$FHEAD" "$FHEAD.$$~" || :
git fetch -q -f "$1" HEAD:"$GREF" 2>/dev/tty >/dev/null && \
OBJID=$(git ls-tree "$GREF" | xgrep -E "\b$2$" |
awk '{print $3}') && [ -n "$OBJID" ] && \
git cat-file blob "$OBJID" && RETVAL=: || \
git fetch -q -f "$1" HEAD:"$GREF" 2>/dev/tty >/dev/null &&
OBJID="$(git ls-tree "$GREF" |
xgrep -E "\b$2$" | awk '{print $3}')" &&
[ -n "$OBJID" ] && git cat-file blob "$OBJID" && RETVAL=: ||
{ RETVAL=false && : ; }
[ -e "$FHEAD.$$~" ] && command mv -f "$FHEAD.$$~" "$FHEAD" || :
$RETVAL