aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bin/getStatus.sh
blob: a1bff083e721baeee66cf12212d2eb853dc35ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

GIT_DIRECTORY=$1
GIT_REPO=`basename ${GIT_DIRECTORY}`

cd ${GIT_DIRECTORY}

CURRENT_SHA=`git branch -av | grep "\*" | awk '{print $3}'`
CURRENT_BRANCH=`git branch -av | grep "\*" | awk '{print $2}'`
UPSTREAM_SHA=`git branch -av | grep "remotes/ccnx_upstream/master" | awk '{print $2}'`

if [ x${UPSTREAM_SHA} = x ]; then
  # We don't have an upstream...
  UPSTREAM_SHA="NO_UPSTREAM"
else
  PARC_MASTER_IN_BRANCH=`git branch -v --contains $UPSTREAM_SHA | grep "\*" | awk '{print $3}'`
fi


echo '===================================================================='

if [ "x${CCNX_MASTER_IN_BRANCH}" != "x" ]; then
  # This branch is master OR ahead of master
  if [ x${CURRENT_SHA} = x${UPSTREAM_SHA} ]; then
    echo "CCNX    ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
  else
    echo "CCNX++  ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
  fi
else
    echo "------  ${GIT_REPO} ${CURRENT_BRANCH} ${CURRENT_SHA}::${UPSTREAM_SHA}"
fi
git status -s