forked from mozilla/moz-git-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding git-tracks -d (defaults to origin/master).
- Loading branch information
Showing
5 changed files
with
23 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Like |hg qparent|, gives last common revision between HEAD and upstream. | ||
# Like |hg qparent|, gives last common revision between HEAD and upstream | ||
# | ||
# The upstream branch is set via git branch --set-upstream <branch> <upstream>. | ||
# If no upstream branch has been explicitly set, we use origin/master. | ||
|
||
PATH="$(dirname $0):$PATH" | ||
git merge-base HEAD $(git tracks) | ||
git merge-base HEAD $(git tracks -d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
#!/bin/bash | ||
# | ||
# Get the upstream branch for the current branch. If -d/--default is passed, | ||
# outputs origin/master if there's no upstream branch. | ||
# | ||
# To set <branch>'s upstream branch, run | ||
# | ||
# $ git branch --set-upstream <branch> <upstream> | ||
# | ||
# | ||
# Based on http://serverfault.com/a/352236/38694 | ||
|
||
branch=$(git symbolic-ref HEAD) || exit $? | ||
branch=${branch##refs/heads/} | ||
remote=$(git config "branch.${branch}.remote") || exit $? | ||
remoteBranch=$(git config "branch.${branch}.merge") || exit $? | ||
remote=$(git config "branch.${branch}.remote" || echo '.') | ||
remoteBranch=$(git config "branch.${branch}.merge" || echo '') | ||
remoteBranch=${remoteBranch##refs/heads/} | ||
|
||
if [[ "$remote" != "." ]]; then | ||
echo "${remote:?}/${remoteBranch:?}" | ||
else | ||
elif [[ "$remoteBranch" != "" ]]; then | ||
echo "${remoteBranch:?}" | ||
elif [[ "$1" == '-d' || "$1" == '--default' ]]; then | ||
echo "origin/master" | ||
fi |