Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Olivier Refalo
committed
Mar 5, 2013
1 parent
142f547
commit aeb7e8c
Showing
1 changed file
with
3 additions
and
3 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,13 +1,13 @@ | |||
#!/bin/bash | #!/bin/bash | ||
# | # | ||
# returns 1 if the given branch was force updated, 0 if not | # returns 0 if the given branch was force updated, 1 if not | ||
# if no parameters, figures the upstream branch from the tracking table | # if no parameters, figures the upstream branch from the tracking table | ||
|
|
||
remote=$1 | remote=$1 | ||
[[ -z $1 ]] && remote=$("$GIT_EXE" g2getremote) | [[ -z $1 ]] && remote=$("$GIT_EXE" g2getremote) | ||
[[ -n $remote ]] && { | [[ -n $remote ]] && { | ||
hash=$("$GIT_EXE" reflog $remote | head -1 | grep forced-update | cut -f 1 -d " ") | hash=$("$GIT_EXE" reflog $remote | head -1 | grep forced-update | cut -f 1 -d " ") | ||
branch=$("$GIT_EXE" branch | grep "*" | sed "s/* //") | branch=$("$GIT_EXE" branch | grep "*" | sed "s/* //") | ||
[[ -n $hash && $("$GIT_EXE" reflog $branch | grep $hash | grep -c reset) -eq 0 ]] && exit 1 | [[ -n $hash && $("$GIT_EXE" reflog $branch | grep $hash | grep -c reset) -eq 0 ]] && exit 0 | ||
} | } | ||
exit 0 | exit 1 |