3 . /sys/lib/git/common.rc
16 {git/fetch $dflag $bflag -u $upstream $url >[2=3] || die $status} | awk '
22 gsub("^refs/heads", "refs/remotes/'$upstream'", ref)
24 system("mkdir -p `{basename -d "outfile"}");
28 ' |[3] tr '\x0d' '\x0a'
33 flagfmt='a:allbranch, b:branch branch, d:debug,
34 f:fetchonly, u:upstream upstream, q:quiet'
36 eval `''{aux/getflags $*} || exec aux/usage
39 branch=refs/`{git/branch}
45 remote=`$nl{git/conf 'remote "'$upstream'".url'}
51 update $branch $upstream $remote
56 remote=`{git/branch | subst '^(refs/)?heads' 'remotes/'$upstream}
58 # we have local commits, but the remote hasn't changed.
59 # in this case, we want to keep the local commits untouched.
60 if(~ `{git/query HEAD $remote @} `{git/query $remote}){
61 echo 'up to date' >[1=2]
64 # The remote repository and our HEAD have diverged: we
66 if(! ~ `{git/query HEAD $remote @} `{git/query HEAD}){
68 echo ours: `{git/query HEAD}
69 echo theirs: `{git/query $remote}
70 echo common: `{git/query HEAD $remote @}
71 echo git/merge $remote
75 # The remote is directly ahead of the local, and we have
76 # no local commits that need merging.
78 git/log -s -e $local'..'$remote >[1=2]
80 echo $remote':' `{git/query $local} '=>' `{git/query $remote} >[1=2]
81 git/branch -mnb $remote $local